mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix broken LateX customization via templates (closes: #4795)
This commit is contained in:
parent
bf911b9f40
commit
38dc048bce
@ -927,8 +927,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
def render(self, template_name, variables):
|
def render(self, template_name, variables):
|
||||||
# type: (unicode, Dict) -> unicode
|
# type: (unicode, Dict) -> unicode
|
||||||
for template_path in self.builder.config.templates_path:
|
for template_dir in self.builder.config.templates_path:
|
||||||
template = path.join(template_path, template_name)
|
template = path.join(self.builder.srcdir, template_dir,
|
||||||
|
template_name)
|
||||||
if path.exists(template):
|
if path.exists(template):
|
||||||
return LaTeXRenderer().render(template, variables)
|
return LaTeXRenderer().render(template, variables)
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
SALUT LES COPAINS
|
@ -1098,6 +1098,30 @@ def test_latex_table_complex_tables(app, status, warning):
|
|||||||
assert actual == expected
|
assert actual == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('latex', testroot='latex-table',
|
||||||
|
confoverrides={'templates_path': ['_mytemplates/latex']})
|
||||||
|
def test_latex_table_custom_template_caseA(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
|
assert 'SALUT LES COPAINS' in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('latex', testroot='latex-table',
|
||||||
|
confoverrides={'templates_path': ['_mytemplates']})
|
||||||
|
def test_latex_table_custom_template_caseB(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
|
assert 'SALUT LES COPAINS' not in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('latex', testroot='latex-table')
|
||||||
|
@pytest.mark.test_params(shared_result='latex-table')
|
||||||
|
def test_latex_table_custom_template_caseC(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
result = (app.outdir / 'test.tex').text(encoding='utf8')
|
||||||
|
assert 'SALUT LES COPAINS' not in result
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('latex', testroot='directives-raw')
|
@pytest.mark.sphinx('latex', testroot='directives-raw')
|
||||||
def test_latex_raw_directive(app, status, warning):
|
def test_latex_raw_directive(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
Loading…
Reference in New Issue
Block a user