Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

texinfo: fix emission of @footnote directives. #9390

Merged
merged 3 commits into from Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
marxin marked this conversation as resolved.
Show resolved Hide resolved
else:
self.body.append('@w{(')
tk0miya marked this conversation as resolved.
Show resolved Hide resolved

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