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
This commit is contained in:
Martin Liska
2021-08-25 11:11:39 +02:00
parent cee86909b9
commit 9ec829fb50
6 changed files with 36 additions and 3 deletions

View File

@@ -112,3 +112,17 @@ def test_texinfo_escape_id(app, status, warning):
assert translator.escape_id('Hello(world)') == 'Hello world'
assert translator.escape_id('Hello world.') == 'Hello world'
assert translator.escape_id('.') == '.'
@pytest.mark.sphinx('texinfo')
def test_texinfo_xrefs(app, status, warning):
app.builder.build_all()
output = (app.outdir / 'sphinxtests.texi').read_text()
assert re.search(r'@ref{\w+,,--plugin\.option}', output)
# Now rebuild it without xrefs
app.config.texinfo_cross_references = False
app.builder.build_all()
output = (app.outdir / 'sphinxtests.texi').read_text()
assert not re.search(r'@ref{\w+,,--plugin\.option}', output)
assert 'Link to perl +p, --ObjC++, --plugin.option, create-auth-token, arg and -j' in output