Skip to content

Commit

Permalink
Fix #10175: LaTeX: named footnote ref is linked to an incorrect footnote
Browse files Browse the repository at this point in the history
A named footnote reference will be converted to a hyperlink to an
incorrect footnote if the name is also used in the different document.
  • Loading branch information
tk0miya committed Feb 13, 2022
1 parent 6f0a8f3 commit 01d06f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -32,6 +32,8 @@ Bugs fixed
unhashable object
* #9529: LaTeX: named auto numbered footnote (ex. ``[#named]``) that is referred
multiple times was rendered to a question mark
* #10175: LaTeX: named footnote reference is linked to an incorrect footnote if
the name is also used in the different document
* #10181: napoleon: attributes are displayed like class attributes for google
style docstrings when :confval:`napoleon_use_ivar` is enabled
* #10122: sphinx-build: make.bat does not check the installation of sphinx-build
Expand Down
1 change: 1 addition & 0 deletions sphinx/writers/latex.py
Expand Up @@ -571,6 +571,7 @@ def depart_document(self, node: Element) -> None:

def visit_start_of_file(self, node: Element) -> None:
self.curfilestack.append(node['docname'])
self.body.append(CR + r'\sphinxstepscope' + CR)

def depart_start_of_file(self, node: Element) -> None:
self.curfilestack.pop()
Expand Down
2 changes: 2 additions & 0 deletions tests/test_build_latex.py
Expand Up @@ -1197,6 +1197,7 @@ def test_latex_table_tabulars(app, status, warning):
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
content = re.sub(r'\\sphinxstepscope', '', content) # filter a separator
tables[sectname] = content.strip()

def get_expected(name):
Expand Down Expand Up @@ -1266,6 +1267,7 @@ def test_latex_table_longtable(app, status, warning):
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
content = re.sub(r'\\sphinxstepscope', '', content) # filter a separator
tables[sectname] = content.strip()

def get_expected(name):
Expand Down

0 comments on commit 01d06f9

Please sign in to comment.