Skip to content

Commit

Permalink
Merge pull request #9390 from marxin/fix-footnote-in-info
Browse files Browse the repository at this point in the history
texinfo: fix emission of @footnote directives.
  • Loading branch information
tk0miya committed Dec 11, 2021
2 parents f886fc2 + 8e23b03 commit d743f21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sphinx/writers/texinfo.py
Expand Up @@ -1235,7 +1235,11 @@ def depart_sidebar(self, node: Element) -> None:
self.depart_topic(node)

def visit_label(self, node: Element) -> None:
self.body.append('@w{(')
# label numbering is automatically generated by Texinfo
if self.in_footnote:
raise nodes.SkipNode
else:
self.body.append('@w{(')

def depart_label(self, node: Element) -> None:
self.body.append(')} ')
Expand Down
8 changes: 8 additions & 0 deletions tests/test_build_texinfo.py
Expand Up @@ -114,6 +114,14 @@ def test_texinfo_escape_id(app, status, warning):
assert translator.escape_id('.') == '.'


@pytest.mark.sphinx('texinfo', testroot='footnotes')
def test_texinfo_footnote(app, status, warning):
app.builder.build_all()

output = (app.outdir / 'python.texi').read_text()
assert 'First footnote: @footnote{\nFirst\n}' in output


@pytest.mark.sphinx('texinfo')
def test_texinfo_xrefs(app, status, warning):
app.builder.build_all()
Expand Down

0 comments on commit d743f21

Please sign in to comment.