Skip to content

Commit

Permalink
add underscore to the regex used in maybe_get_link function (#127)
Browse files Browse the repository at this point in the history
The link in the report page wasn't rendering link for the APOLLO_SV
ontology because when checking for the curie, the regex wasn't checking
for the underscore.

Co-authored-by: Anita Caron <[email protected]>
  • Loading branch information
Anita Caron and Anita Caron authored Jun 24, 2024
1 parent ca7061b commit 64255c2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion util/create_report_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,23 @@ def main(args):

def maybe_get_link(cell, context):
"""
Returns an HTML link for the given cell value if it matches certain patterns.
Args:
cell (str): The cell value to check for link patterns.
context (dict): A dictionary containing prefix-context mappings.
Returns:
str: An HTML link if a matching pattern is found, otherwise the original cell value.
"""
url = None
if cell in report_doc_map:
# First check if it is a ROBOT report link
url = report_doc_map[cell]
else:
# Otherwise try to parse as CURIE or IRI
curie = re.search(r'([A-Za-z0-9]+):([A-Za-z0-9-]+)', cell)
curie = re.search(r'([A-Za-z0-9_]+):([A-Za-z0-9-]+)', cell)
if curie:
# This is a CURIE
prefix = curie.group(1)
Expand Down

0 comments on commit 64255c2

Please sign in to comment.