Skip to content

Commit 434a938

Browse files
authored
fixing links to subsections
1 parent 047deff commit 434a938

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pipeline/instance.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def _build_plurals(self, term: str) -> str:
4242
else:
4343
return f"{term}s"
4444

45+
def _replace_multi(self, term:str, old:List[str], new:str) -> str:
46+
for letter in old:
47+
term.replace(letter, new)
48+
return term
49+
4550
def _build_single_instance_link(self, instanceReference:Dict) -> str:
4651
# get instance identity and create instance heading
4752
instance_id = instanceReference["@id"]
@@ -66,7 +71,7 @@ def _build_single_instance_link(self, instanceReference:Dict) -> str:
6671
page_heading = instance_type
6772

6873
# create link and return RST hyperlink
69-
link = os.path.join(link_dir, f"{page_heading}.html#{instance_heading}")
74+
link = os.path.join(link_dir, f"{page_heading}.html#{self._replace_multi(instance_heading, ['_', '.'], '-')}")
7075
return f"`{instance_id.split('/')[-1]} <{link}>`_"
7176

7277
def _build_multi_instance_links(self, instanceReferenceList:List) -> str:

0 commit comments

Comments
 (0)