mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
latex: Do not display Release label if :confval:release
is not set
This commit is contained in:
parent
161f269202
commit
33fd1f446a
1
CHANGES
1
CHANGES
@ -113,6 +113,7 @@ Bugs fixed
|
|||||||
* #4198: autosummary emits multiple 'autodoc-process-docstring' event. Thanks
|
* #4198: autosummary emits multiple 'autodoc-process-docstring' event. Thanks
|
||||||
to Joel Nothman.
|
to Joel Nothman.
|
||||||
* #4081: Warnings and errors colored the same when building
|
* #4081: Warnings and errors colored the same when building
|
||||||
|
* latex: Do not display 'Release' label if :confval:`release` is not set
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -549,7 +549,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
'author': document.settings.author, # treat as a raw LaTeX code
|
'author': document.settings.author, # treat as a raw LaTeX code
|
||||||
'indexname': _('Index'),
|
'indexname': _('Index'),
|
||||||
})
|
})
|
||||||
if not self.elements['releasename']:
|
if not self.elements['releasename'] and self.elements['release']:
|
||||||
self.elements.update({
|
self.elements.update({
|
||||||
'releasename': _('Release'),
|
'releasename': _('Release'),
|
||||||
})
|
})
|
||||||
|
@ -165,13 +165,15 @@ def test_latex_warnings(app, status, warning):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('latex', testroot='basic')
|
@pytest.mark.sphinx('latex', testroot='basic')
|
||||||
def test_latex_title(app, status, warning):
|
def test_latex_basic(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
print(result)
|
print(result)
|
||||||
print(status.getvalue())
|
print(status.getvalue())
|
||||||
print(warning.getvalue())
|
print(warning.getvalue())
|
||||||
assert '\\title{The basic Sphinx documentation for testing}' in result
|
assert r'\title{The basic Sphinx documentation for testing}' in result
|
||||||
|
assert r'\release{}' in result
|
||||||
|
assert r'\renewcommand{\releasename}{}' in result
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('latex', testroot='latex-title')
|
@pytest.mark.sphinx('latex', testroot='latex-title')
|
||||||
@ -184,6 +186,18 @@ def test_latex_title_after_admonitions(app, status, warning):
|
|||||||
assert '\\title{test-latex-title}' in result
|
assert '\\title{test-latex-title}' in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('latex', testroot='basic',
|
||||||
|
confoverrides={'release': '1.0'})
|
||||||
|
def test_latex_release(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
|
print(result)
|
||||||
|
print(status.getvalue())
|
||||||
|
print(warning.getvalue())
|
||||||
|
assert r'\release{1.0}' in result
|
||||||
|
assert r'\renewcommand{\releasename}{Release}' in result
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('latex', testroot='numfig',
|
@pytest.mark.sphinx('latex', testroot='numfig',
|
||||||
confoverrides={'numfig': True})
|
confoverrides={'numfig': True})
|
||||||
def test_numref(app, status, warning):
|
def test_numref(app, status, warning):
|
||||||
|
Loading…
Reference in New Issue
Block a user