Skip to content

Commit

Permalink
Strip footnote anchors from auto ToC (#777)
Browse files Browse the repository at this point in the history
Problem occurs if chapter heading has FN anchor.

Because only one anchor can be linked from a footnote,
this should be the one in the chapter heading itself, not
one in the Autogenerated ToC.

Fixes #775
  • Loading branch information
windymilla authored Feb 22, 2025
1 parent 4a7851f commit 42138be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/guiguts/html_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@ def reset_ibs_dict() -> None:
maintext().replace(
f"{line_start}-2l lineend", f"{line_start}-1l lineend", "</h2>\n"
)
# Don't want footnote anchors in auto ToC
chap_heading = re.sub(r"\[.{1,5}\]", "", chap_heading)
auto_toc += f'<a href="#{chap_id}">{chap_heading}</a><br>\n'
in_chap_heading = False
continue
Expand Down

0 comments on commit 42138be

Please sign in to comment.