Skip to content

Commit f2be104

Browse files
committed
Revert "change-isolation: undo modifications to LaTeX, imgmath writer template detection and rendering"
This reverts commit 2a5a9a0. Conflicts: sphinx/ext/imgmath.py sphinx/writers/latex.py
1 parent 7ce2e34 commit f2be104

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

sphinx/ext/imgmath.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,15 @@ def generate_latex_macro(image_format: str,
103103
}
104104

105105
if config.imgmath_use_preview:
106-
template_name = 'preview.tex_t'
106+
template_name = 'preview.tex'
107107
else:
108-
template_name = 'template.tex_t'
108+
template_name = 'template.tex'
109109

110110
for template_dir in config.templates_path:
111-
template = path.join(confdir, template_dir, template_name)
112-
if path.exists(template):
113-
return LaTeXRenderer().render(template, variables)
111+
for template_suffix in ('_t', '.jinja'):
112+
template = path.join(confdir, template_dir, template_name + template_suffix)
113+
if path.exists(template):
114+
return LaTeXRenderer().render(template, variables)
114115

115116
return LaTeXRenderer(templates_path).render(template_name + '.jinja', variables)
116117

sphinx/writers/latex.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def astext(self) -> str:
437437
'body': ''.join(self.body),
438438
'indices': self.generate_indices(),
439439
})
440-
return self.render('latex.tex_t', self.elements)
440+
return self.render('latex.tex', self.elements)
441441

442442
def hypertarget(self, id: str, withdoc: bool = True, anchor: bool = True) -> str:
443443
if withdoc:
@@ -517,10 +517,11 @@ def generate(content: list[tuple[str, list[IndexEntry]]], collapsed: bool) -> No
517517
def render(self, template_name: str, variables: dict[str, Any]) -> str:
518518
renderer = LaTeXRenderer(latex_engine=self.config.latex_engine)
519519
for template_dir in self.config.templates_path:
520-
template = path.join(self.builder.confdir, template_dir,
521-
template_name)
522-
if path.exists(template):
523-
return renderer.render(template, variables)
520+
for template_suffix in ('_t', '.jinja'):
521+
template = path.join(self.builder.confdir, template_dir,
522+
template_name + template_suffix)
523+
if path.exists(template):
524+
return renderer.render(template, variables)
524525

525526
return renderer.render(template_name + '.jinja', variables)
526527

@@ -1033,7 +1034,7 @@ def depart_table(self, node: Element) -> None:
10331034
assert self.table is not None
10341035
labels = self.hypertarget_to(node)
10351036
table_type = self.table.get_table_type()
1036-
table = self.render(table_type + '.tex_t',
1037+
table = self.render(table_type + '.tex',
10371038
{'table': self.table, 'labels': labels})
10381039
self.body.append(BLANKLINE)
10391040
self.body.append(table)

0 commit comments

Comments
 (0)