diff options
author | Martin Liska <mliska@suse.cz> | 2021-08-25 12:11:39 +0300 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-11-12 16:00:48 +0300 |
commit | 9ec829fb503cb0a42427de711135bae123086abf (patch) | |
tree | c8e5c23fade51500e3bea680742eacffb99b219b /sphinx/writers/texinfo.py | |
parent | cee86909b9f4ca338bc41168e91226de520369c6 (diff) |
texinfo: simplify reference emission.
The commit adds a new config value 'texinfo_emit_document_references'
that blocks the emission of inline references and make it better readable
with legacy stand-alone reader ``info``.
Before the change we emit:
Default option value for @ref{e,,-Wshift-overflow3}.
while with texinfo_emit_document_references == True:
Default option value for -Wshift-overflow3.
It addresses limitations mentioned in Sphinx' FAQ:
https://www.sphinx-doc.org/en/master/faq.html#texinfo-info
Diffstat (limited to 'sphinx/writers/texinfo.py')
-rw-r--r-- | sphinx/writers/texinfo.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 6df558323..70d007f68 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -545,9 +545,12 @@ class TexinfoTranslator(SphinxTranslator): def add_xref(self, id: str, name: str, node: Node) -> None: name = self.escape_menu(name) sid = self.get_short_id(id) - self.body.append('@ref{%s,,%s}' % (sid, name)) - self.referenced_ids.add(sid) - self.referenced_ids.add(self.escape_id(id)) + if self.config.texinfo_cross_references: + self.body.append('@ref{%s,,%s}' % (sid, name)) + self.referenced_ids.add(sid) + self.referenced_ids.add(self.escape_id(id)) + else: + self.body.append(name) # -- Visiting |