Skip to content

Commit

Permalink
Also link to the keyword itself
Browse files Browse the repository at this point in the history
To provide a consistent markup experience for the keywords, we should
also link the keyword to itself
  • Loading branch information
hakonhagland committed Nov 5, 2024
1 parent e017362 commit fe7873d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/python/src/fodt/keyword_linker2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def __init__(self, keyword_name: str, kw_uri_map: dict[str, str]) -> None:
def compile_regex(self) -> re.Pattern:
# Do not include the keyword name itself in the regex pattern
pattern = re.compile(
r'\b(' +
r'\b(' +
'|'.join(
re.escape(k) for k in self.kw_uri_map.keys() if k != self.keyword_name
# re.escape(k) for k in self.kw_uri_map.keys() if k != self.keyword_name
re.escape(k) for k in self.kw_uri_map.keys()
) +
r')\b'
)
Expand Down

0 comments on commit fe7873d

Please sign in to comment.