Skip to content

Commit f4b5a54

Browse files
Merge pull request #3804 from raspberrypi/tags-in-url
Remove context tags from toc links/urls
2 parents 1112481 + 2f5b132 commit f4b5a54

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

scripts/create_nav.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def heading_to_anchor(filepath, heading, anchor):
1717
if anchor is None:
1818
# The replace(' -- ', '') is needed because AsciiDoc transforms ' -- ' to ' — ' (narrow-space, em-dash, narrow-space) which then collapses down to '' when calculating the anchor
1919
anchor = re.sub(r'\-+', '-', re.sub(r'[^-\w]', '', heading.lower().replace(' -- ', '').replace(' ', '-').replace('.', '-')))
20+
# remove any context tags that slipped into the anchor
21+
anchor = re.sub(r'(strong-classcontexttag-)(rp\d+)(rp\d+strong)', '\\2', anchor)
2022
if filepath not in file_headings:
2123
file_headings[filepath] = set()
2224
proposed_anchor = anchor

0 commit comments

Comments
 (0)