summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/builders/_epub_base.py5
-rw-r--r--sphinx/builders/changes.py8
-rw-r--r--sphinx/builders/epub3.py2
-rw-r--r--sphinx/builders/gettext.py2
-rw-r--r--sphinx/builders/latex/__init__.py4
-rw-r--r--sphinx/cmd/quickstart.py18
-rw-r--r--sphinx/deprecation.py28
-rw-r--r--sphinx/ext/apidoc.py7
-rw-r--r--sphinx/ext/imgmath.py19
-rw-r--r--sphinx/templates/apidoc/module.rst_t (renamed from sphinx/templates/apidoc/module.rst.jinja)0
-rw-r--r--sphinx/templates/apidoc/package.rst_t (renamed from sphinx/templates/apidoc/package.rst.jinja)0
-rw-r--r--sphinx/templates/apidoc/toc.rst_t (renamed from sphinx/templates/apidoc/toc.rst.jinja)0
-rw-r--r--sphinx/templates/epub3/content.opf_t (renamed from sphinx/templates/epub3/content.opf.jinja)0
-rw-r--r--sphinx/templates/epub3/nav.xhtml_t (renamed from sphinx/templates/epub3/nav.xhtml.jinja)0
-rw-r--r--sphinx/templates/epub3/toc.ncx_t (renamed from sphinx/templates/epub3/toc.ncx.jinja)0
-rw-r--r--sphinx/templates/gettext/message.pot_t (renamed from sphinx/templates/gettext/message.pot.jinja)0
-rw-r--r--sphinx/templates/imgmath/preview.tex_t (renamed from sphinx/templates/imgmath/preview.tex.jinja)0
-rw-r--r--sphinx/templates/imgmath/template.tex_t (renamed from sphinx/templates/imgmath/template.tex.jinja)0
-rw-r--r--sphinx/templates/latex/latex.tex_t (renamed from sphinx/templates/latex/latex.tex.jinja)0
-rw-r--r--sphinx/templates/latex/longtable.tex_t (renamed from sphinx/templates/latex/longtable.tex.jinja)0
-rw-r--r--sphinx/templates/latex/sphinxmessages.sty_t (renamed from sphinx/templates/latex/sphinxmessages.sty.jinja)0
-rw-r--r--sphinx/templates/latex/tabular.tex_t (renamed from sphinx/templates/latex/tabular.tex.jinja)0
-rw-r--r--sphinx/templates/latex/tabulary.tex_t (renamed from sphinx/templates/latex/tabulary.tex.jinja)0
-rw-r--r--sphinx/templates/quickstart/Makefile.new_t (renamed from sphinx/templates/quickstart/Makefile.new.jinja)0
-rw-r--r--sphinx/templates/quickstart/Makefile_t (renamed from sphinx/templates/quickstart/Makefile.jinja)0
-rw-r--r--sphinx/templates/quickstart/conf.py_t (renamed from sphinx/templates/quickstart/conf.py.jinja)0
-rw-r--r--sphinx/templates/quickstart/make.bat.new_t (renamed from sphinx/templates/quickstart/make.bat.new.jinja)0
-rw-r--r--sphinx/templates/quickstart/make.bat_t (renamed from sphinx/templates/quickstart/make.bat.jinja)0
-rw-r--r--sphinx/templates/quickstart/root_doc.rst_t (renamed from sphinx/templates/quickstart/root_doc.rst.jinja)0
-rw-r--r--sphinx/texinputs/Makefile_t (renamed from sphinx/texinputs/Makefile.jinja)0
-rw-r--r--sphinx/texinputs/latexmkjarc_t (renamed from sphinx/texinputs/latexmkjarc.jinja)0
-rw-r--r--sphinx/texinputs/latexmkrc_t (renamed from sphinx/texinputs/latexmkrc.jinja)0
-rw-r--r--sphinx/texinputs/make.bat_t (renamed from sphinx/texinputs/make.bat.jinja)0
-rw-r--r--sphinx/texinputs_win/Makefile_t (renamed from sphinx/texinputs_win/Makefile.jinja)0
-rw-r--r--sphinx/themes/agogo/static/agogo.css_t (renamed from sphinx/themes/agogo/static/agogo.css.jinja)0
-rw-r--r--sphinx/themes/basic/static/basic.css_t (renamed from sphinx/themes/basic/static/basic.css.jinja)0
-rw-r--r--sphinx/themes/basic/static/documentation_options.js_t (renamed from sphinx/themes/basic/static/documentation_options.js.jinja)0
-rw-r--r--sphinx/themes/basic/static/language_data.js_t (renamed from sphinx/themes/basic/static/language_data.js.jinja)0
-rw-r--r--sphinx/themes/bizstyle/static/bizstyle.css_t (renamed from sphinx/themes/bizstyle/static/bizstyle.css.jinja)0
-rw-r--r--sphinx/themes/bizstyle/static/bizstyle.js_t (renamed from sphinx/themes/bizstyle/static/bizstyle.js.jinja)0
-rw-r--r--sphinx/themes/classic/static/classic.css_t (renamed from sphinx/themes/classic/static/classic.css.jinja)0
-rw-r--r--sphinx/themes/classic/static/sidebar.js_t (renamed from sphinx/themes/classic/static/sidebar.js.jinja)0
-rw-r--r--sphinx/themes/epub/static/epub.css_t (renamed from sphinx/themes/epub/static/epub.css.jinja)0
-rw-r--r--sphinx/themes/haiku/static/haiku.css_t (renamed from sphinx/themes/haiku/static/haiku.css.jinja)0
-rw-r--r--sphinx/themes/nature/static/nature.css_t (renamed from sphinx/themes/nature/static/nature.css.jinja)0
-rw-r--r--sphinx/themes/nonav/static/nonav.css_t (renamed from sphinx/themes/nonav/static/nonav.css.jinja)0
-rw-r--r--sphinx/themes/pyramid/static/epub.css_t (renamed from sphinx/themes/pyramid/static/epub.css.jinja)0
-rw-r--r--sphinx/themes/pyramid/static/pyramid.css_t (renamed from sphinx/themes/pyramid/static/pyramid.css.jinja)0
-rw-r--r--sphinx/themes/scrolls/static/scrolls.css_t (renamed from sphinx/themes/scrolls/static/scrolls.css.jinja)0
-rw-r--r--sphinx/themes/sphinxdoc/static/sphinxdoc.css_t (renamed from sphinx/themes/sphinxdoc/static/sphinxdoc.css.jinja)0
-rw-r--r--sphinx/themes/traditional/static/traditional.css_t (renamed from sphinx/themes/traditional/static/traditional.css.jinja)0
-rw-r--r--sphinx/util/fileutil.py19
-rw-r--r--sphinx/writers/latex.py28
53 files changed, 42 insertions, 98 deletions
diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py
index f06ff520b..dfe4877ec 100644
--- a/sphinx/builders/_epub_base.py
+++ b/sphinx/builders/_epub_base.py
@@ -603,8 +603,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
html.escape(self.refnodes[0]['refuri'])))
# write the project file
- content_t = path.join(self.template_dir, 'content.opf.jinja')
- copy_asset_file(content_t, self.outdir, metadata)
+ copy_asset_file(path.join(self.template_dir, 'content.opf_t'), self.outdir, metadata)
def new_navpoint(self, node: dict[str, Any], level: int, incr: bool = True) -> NavPoint:
"""Create a new entry in the toc from the node at given level."""
@@ -687,7 +686,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
navpoints = self.build_navpoints(refnodes)
level = max(item['level'] for item in self.refnodes)
level = min(level, self.config.epub_tocdepth)
- copy_asset_file(path.join(self.template_dir, 'toc.ncx.jinja'), self.outdir,
+ copy_asset_file(path.join(self.template_dir, 'toc.ncx_t'), self.outdir,
self.toc_metadata(level, navpoints))
def build_epub(self) -> None:
diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py
index f6b9152f9..5c118bef9 100644
--- a/sphinx/builders/changes.py
+++ b/sphinx/builders/changes.py
@@ -133,10 +133,10 @@ class ChangesBuilder(Builder):
f.write(self.templates.render('changes/rstsource.html', ctx))
themectx = {'theme_' + key: val for (key, val) in
self.theme.get_options({}).items()}
- default_t = path.join(package_dir, 'themes', 'default', 'static', 'default.css.jinja')
- copy_asset_file(default_t, self.outdir, context=themectx, renderer=self.templates)
- basic = path.join(package_dir, 'themes', 'basic', 'static', 'basic.css')
- copy_asset_file(basic, self.outdir)
+ copy_asset_file(path.join(package_dir, 'themes', 'default', 'static', 'default.css_t'),
+ self.outdir, context=themectx, renderer=self.templates)
+ copy_asset_file(path.join(package_dir, 'themes', 'basic', 'static', 'basic.css'),
+ self.outdir)
def hl(self, text: str, version: str) -> str:
text = html.escape(text)
diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py
index aaae0bcee..03f4684d1 100644
--- a/sphinx/builders/epub3.py
+++ b/sphinx/builders/epub3.py
@@ -184,7 +184,7 @@ class Epub3Builder(_epub_base.EpubBuilder):
# 'includehidden'
refnodes = self.refnodes
navlist = self.build_navlist(refnodes)
- copy_asset_file(path.join(self.template_dir, 'nav.xhtml.jinja'), self.outdir,
+ copy_asset_file(path.join(self.template_dir, 'nav.xhtml_t'), self.outdir,
self.navigation_doc_metadata(navlist))
# Add nav.xhtml to epub file
diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py
index 414ed50bd..4d460109b 100644
--- a/sphinx/builders/gettext.py
+++ b/sphinx/builders/gettext.py
@@ -283,7 +283,7 @@ class MessageCatalogBuilder(I18nBuilder):
ensuredir(path.join(self.outdir, path.dirname(textdomain)))
context['messages'] = list(catalog)
- content = GettextRenderer(outdir=self.outdir).render('message.pot.jinja', context)
+ content = GettextRenderer(outdir=self.outdir).render('message.pot_t', context)
pofn = path.join(self.outdir, textdomain + '.pot')
if should_write(pofn, content):
diff --git a/sphinx/builders/latex/__init__.py b/sphinx/builders/latex/__init__.py
index 8efa3ad1c..335518f23 100644
--- a/sphinx/builders/latex/__init__.py
+++ b/sphinx/builders/latex/__init__.py
@@ -402,7 +402,7 @@ class LaTeXBuilder(Builder):
# use pre-1.6.x Makefile for make latexpdf on Windows
if os.name == 'nt':
staticdirname = path.join(package_dir, 'texinputs_win')
- copy_asset_file(path.join(staticdirname, 'Makefile.jinja'),
+ copy_asset_file(path.join(staticdirname, 'Makefile_t'),
self.outdir, context=context)
@progress_message(__('copying additional files'))
@@ -441,7 +441,7 @@ class LaTeXBuilder(Builder):
if self.context['babel'] or self.context['polyglossia']:
context['addtocaptions'] = r'\addto\captions%s' % self.babel.get_language()
- filename = path.join(package_dir, 'templates', 'latex', 'sphinxmessages.sty.jinja')
+ filename = path.join(package_dir, 'templates', 'latex', 'sphinxmessages.sty_t')
copy_asset_file(filename, self.outdir, context=context, renderer=LaTeXRenderer())
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py
index 580fa7d6d..6122ddd98 100644
--- a/sphinx/cmd/quickstart.py
+++ b/sphinx/cmd/quickstart.py
@@ -370,29 +370,29 @@ def generate(
if 'quiet' not in d:
print(__('File %s already exists, skipping.') % fpath)
- conf_path = os.path.join(templatedir, 'conf.py.jinja') if templatedir else None
+ conf_path = os.path.join(templatedir, 'conf.py_t') if templatedir else None
if not conf_path or not path.isfile(conf_path):
- conf_path = os.path.join(package_dir, 'templates', 'quickstart', 'conf.py.jinja')
+ conf_path = os.path.join(package_dir, 'templates', 'quickstart', 'conf.py_t')
with open(conf_path, encoding="utf-8") as f:
conf_text = f.read()
write_file(path.join(srcdir, 'conf.py'), template.render_string(conf_text, d))
masterfile = path.join(srcdir, d['master'] + d['suffix'])
- if template._has_custom_template('quickstart/master_doc.rst.jinja'):
+ if template._has_custom_template('quickstart/master_doc.rst_t'):
msg = ('A custom template `master_doc.rst_t` found. It has been renamed to '
'`root_doc.rst_t`. Please rename it on your project too.')
print(colorize('red', msg))
- write_file(masterfile, template.render('quickstart/master_doc.rst.jinja', d))
+ write_file(masterfile, template.render('quickstart/master_doc.rst_t', d))
else:
- write_file(masterfile, template.render('quickstart/root_doc.rst.jinja', d))
+ write_file(masterfile, template.render('quickstart/root_doc.rst_t', d))
if d.get('make_mode') is True:
- makefile_template = 'quickstart/Makefile.new.jinja'
- batchfile_template = 'quickstart/make.bat.new.jinja'
+ makefile_template = 'quickstart/Makefile.new_t'
+ batchfile_template = 'quickstart/make.bat.new_t'
else:
- makefile_template = 'quickstart/Makefile.jinja'
- batchfile_template = 'quickstart/make.bat.jinja'
+ makefile_template = 'quickstart/Makefile_t'
+ batchfile_template = 'quickstart/make.bat_t'
if d['makefile'] is True:
d['rsrcdir'] = 'source' if d['sep'] else '.'
diff --git a/sphinx/deprecation.py b/sphinx/deprecation.py
index 7d5a2d2ab..fbd5463cc 100644
--- a/sphinx/deprecation.py
+++ b/sphinx/deprecation.py
@@ -62,31 +62,3 @@ def _deprecation_warning(
warnings.warn(message + " Check CHANGES for Sphinx API modifications.",
warning_class, stacklevel=3)
-
-
-class OldJinjaSuffixWarning(PendingDeprecationWarning):
- """Warning class for ``_old_jinja_template_suffix_warning``.
-
- This class exists only so that extensions and themes can silence the legacy
- filename warning via Python's `warning control`_ mechanisms. See
- :ref:`theming-static-templates` for an example.
-
- This warning class will be removed, and the warning class changed to the
- appropriate RemovedInSphinx_0Warning no earlier than 31 December 2024, at
- which point the standard deprecation process for ``_t`` template suffixes
- will start.
-
- .. _warning control: https://docs.python.org/3/library/warnings.html#the-warnings-filter
- """
-
-
-def _old_jinja_template_suffix_warning(filename: str) -> None:
- if filename.endswith('_t'):
- warnings.warn(
- f"{filename!r}: the '_t' suffix for Jinja templates is deprecated. "
- "If the file is a template, use the suffix '.jinja' instead. "
- 'For more information, see '
- 'https://www.sphinx-doc.org/en/master/development/theming.html#static-templates',
- OldJinjaSuffixWarning,
- stacklevel=3,
- )
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py
index 9c9336075..108515d73 100644
--- a/sphinx/ext/apidoc.py
+++ b/sphinx/ext/apidoc.py
@@ -102,7 +102,7 @@ def create_module_file(package: str, basename: str, opts: Any,
'qualname': qualname,
'automodule_options': options,
}
- text = ReSTRenderer([user_template_dir, template_dir]).render('module.rst.jinja', context)
+ text = ReSTRenderer([user_template_dir, template_dir]).render('module.rst_t', context)
write_file(qualname, text, opts)
@@ -138,8 +138,7 @@ def create_package_file(root: str, master_package: str, subroot: str, py_files:
'show_headings': not opts.noheadings,
'maxdepth': opts.maxdepth,
}
- engine = ReSTRenderer([user_template_dir, template_dir])
- text = engine.render('package.rst.jinja', context)
+ text = ReSTRenderer([user_template_dir, template_dir]).render('package.rst_t', context)
write_file(pkgname, text, opts)
if submodules and opts.separatemodules:
@@ -164,7 +163,7 @@ def create_modules_toc_file(modules: list[str], opts: Any, name: str = 'modules'
'maxdepth': opts.maxdepth,
'docnames': modules,
}
- text = ReSTRenderer([user_template_dir, template_dir]).render('toc.rst.jinja', context)
+ text = ReSTRenderer([user_template_dir, template_dir]).render('toc.rst_t', context)
write_file(name, text, opts)
diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py
index 975cbcca5..34d716686 100644
--- a/sphinx/ext/imgmath.py
+++ b/sphinx/ext/imgmath.py
@@ -19,7 +19,6 @@ from sphinx import package_dir
from sphinx.application import Sphinx
from sphinx.builders import Builder
from sphinx.config import Config
-from sphinx.deprecation import _old_jinja_template_suffix_warning
from sphinx.errors import SphinxError
from sphinx.locale import _, __
from sphinx.util import logging, sha1
@@ -96,20 +95,16 @@ def generate_latex_macro(image_format: str,
}
if config.imgmath_use_preview:
- template_name = 'preview.tex'
+ template_name = 'preview.tex_t'
else:
- template_name = 'template.tex'
+ template_name = 'template.tex_t'
for template_dir in config.templates_path:
- # TODO: deprecate '_t' template suffix support after 2024-12-31
- for template_suffix in ('_t', '.jinja'):
- template = path.join(confdir, template_dir, template_name + template_suffix)
- if path.exists(template):
- _old_jinja_template_suffix_warning(template)
- return LaTeXRenderer().render(template, variables)
-
- # Default: fallback to a pathless in-library jinja template
- return LaTeXRenderer(templates_path).render(f"{template_name}.jinja", variables)
+ template = path.join(confdir, template_dir, template_name)
+ if path.exists(template):
+ return LaTeXRenderer().render(template, variables)
+
+ return LaTeXRenderer(templates_path).render(template_name, variables)
def ensure_tempdir(builder: Builder) -> str:
diff --git a/sphinx/templates/apidoc/module.rst.jinja b/sphinx/templates/apidoc/module.rst_t
index 249027855..249027855 100644
--- a/sphinx/templates/apidoc/module.rst.jinja
+++ b/sphinx/templates/apidoc/module.rst_t
diff --git a/sphinx/templates/apidoc/package.rst.jinja b/sphinx/templates/apidoc/package.rst_t
index 2229c311b..2229c311b 100644
--- a/sphinx/templates/apidoc/package.rst.jinja
+++ b/sphinx/templates/apidoc/package.rst_t
diff --git a/sphinx/templates/apidoc/toc.rst.jinja b/sphinx/templates/apidoc/toc.rst_t
index f0877eeb2..f0877eeb2 100644
--- a/sphinx/templates/apidoc/toc.rst.jinja
+++ b/sphinx/templates/apidoc/toc.rst_t
diff --git a/sphinx/templates/epub3/content.opf.jinja b/sphinx/templates/epub3/content.opf_t
index 417888c7e..417888c7e 100644
--- a/sphinx/templates/epub3/content.opf.jinja
+++ b/sphinx/templates/epub3/content.opf_t
diff --git a/sphinx/templates/epub3/nav.xhtml.jinja b/sphinx/templates/epub3/nav.xhtml_t
index 2a32c2039..2a32c2039 100644
--- a/sphinx/templates/epub3/nav.xhtml.jinja
+++ b/sphinx/templates/epub3/nav.xhtml_t
diff --git a/sphinx/templates/epub3/toc.ncx.jinja b/sphinx/templates/epub3/toc.ncx_t
index 0ea7ca366..0ea7ca366 100644
--- a/sphinx/templates/epub3/toc.ncx.jinja
+++ b/sphinx/templates/epub3/toc.ncx_t
diff --git a/sphinx/templates/gettext/message.pot.jinja b/sphinx/templates/gettext/message.pot_t
index 6138f54c9..6138f54c9 100644
--- a/sphinx/templates/gettext/message.pot.jinja
+++ b/sphinx/templates/gettext/message.pot_t
diff --git a/sphinx/templates/imgmath/preview.tex.jinja b/sphinx/templates/imgmath/preview.tex_t
index f3fdcda07..f3fdcda07 100644
--- a/sphinx/templates/imgmath/preview.tex.jinja
+++ b/sphinx/templates/imgmath/preview.tex_t
diff --git a/sphinx/templates/imgmath/template.tex.jinja b/sphinx/templates/imgmath/template.tex_t
index 92fa8b021..92fa8b021 100644
--- a/sphinx/templates/imgmath/template.tex.jinja
+++ b/sphinx/templates/imgmath/template.tex_t
diff --git a/sphinx/templates/latex/latex.tex.jinja b/sphinx/templates/latex/latex.tex_t
index deb030504..deb030504 100644
--- a/sphinx/templates/latex/latex.tex.jinja
+++ b/sphinx/templates/latex/latex.tex_t
diff --git a/sphinx/templates/latex/longtable.tex.jinja b/sphinx/templates/latex/longtable.tex_t
index 83790f4b2..83790f4b2 100644
--- a/sphinx/templates/latex/longtable.tex.jinja
+++ b/sphinx/templates/latex/longtable.tex_t
diff --git a/sphinx/templates/latex/sphinxmessages.sty.jinja b/sphinx/templates/latex/sphinxmessages.sty_t
index ef2750f6a..ef2750f6a 100644
--- a/sphinx/templates/latex/sphinxmessages.sty.jinja
+++ b/sphinx/templates/latex/sphinxmessages.sty_t
diff --git a/sphinx/templates/latex/tabular.tex.jinja b/sphinx/templates/latex/tabular.tex_t
index 0a9310a5e..0a9310a5e 100644
--- a/sphinx/templates/latex/tabular.tex.jinja
+++ b/sphinx/templates/latex/tabular.tex_t
diff --git a/sphinx/templates/latex/tabulary.tex.jinja b/sphinx/templates/latex/tabulary.tex_t
index 6ebcec6d2..6ebcec6d2 100644
--- a/sphinx/templates/latex/tabulary.tex.jinja
+++ b/sphinx/templates/latex/tabulary.tex_t
diff --git a/sphinx/templates/quickstart/Makefile.new.jinja b/sphinx/templates/quickstart/Makefile.new_t
index 1a527578b..1a527578b 100644
--- a/sphinx/templates/quickstart/Makefile.new.jinja
+++ b/sphinx/templates/quickstart/Makefile.new_t
diff --git a/sphinx/templates/quickstart/Makefile.jinja b/sphinx/templates/quickstart/Makefile_t
index 14b2dc594..14b2dc594 100644
--- a/sphinx/templates/quickstart/Makefile.jinja
+++ b/sphinx/templates/quickstart/Makefile_t
diff --git a/sphinx/templates/quickstart/conf.py.jinja b/sphinx/templates/quickstart/conf.py_t
index 383648675..383648675 100644
--- a/sphinx/templates/quickstart/conf.py.jinja
+++ b/sphinx/templates/quickstart/conf.py_t
diff --git a/sphinx/templates/quickstart/make.bat.new.jinja b/sphinx/templates/quickstart/make.bat.new_t
index c89237ba2..c89237ba2 100644
--- a/sphinx/templates/quickstart/make.bat.new.jinja
+++ b/sphinx/templates/quickstart/make.bat.new_t
diff --git a/sphinx/templates/quickstart/make.bat.jinja b/sphinx/templates/quickstart/make.bat_t
index dfc619ae3..dfc619ae3 100644
--- a/sphinx/templates/quickstart/make.bat.jinja
+++ b/sphinx/templates/quickstart/make.bat_t
diff --git a/sphinx/templates/quickstart/root_doc.rst.jinja b/sphinx/templates/quickstart/root_doc.rst_t
index 3aa98af08..3aa98af08 100644
--- a/sphinx/templates/quickstart/root_doc.rst.jinja
+++ b/sphinx/templates/quickstart/root_doc.rst_t
diff --git a/sphinx/texinputs/Makefile.jinja b/sphinx/texinputs/Makefile_t
index 96bb0fed1..96bb0fed1 100644
--- a/sphinx/texinputs/Makefile.jinja
+++ b/sphinx/texinputs/Makefile_t
diff --git a/sphinx/texinputs/latexmkjarc.jinja b/sphinx/texinputs/latexmkjarc_t
index c7403a90b..c7403a90b 100644
--- a/sphinx/texinputs/latexmkjarc.jinja
+++ b/sphinx/texinputs/latexmkjarc_t
diff --git a/sphinx/texinputs/latexmkrc.jinja b/sphinx/texinputs/latexmkrc_t
index a33b54148..a33b54148 100644
--- a/sphinx/texinputs/latexmkrc.jinja
+++ b/sphinx/texinputs/latexmkrc_t
diff --git a/sphinx/texinputs/make.bat.jinja b/sphinx/texinputs/make.bat_t
index da2805afd..da2805afd 100644
--- a/sphinx/texinputs/make.bat.jinja
+++ b/sphinx/texinputs/make.bat_t
diff --git a/sphinx/texinputs_win/Makefile.jinja b/sphinx/texinputs_win/Makefile_t
index 4131762a8..4131762a8 100644
--- a/sphinx/texinputs_win/Makefile.jinja
+++ b/sphinx/texinputs_win/Makefile_t
diff --git a/sphinx/themes/agogo/static/agogo.css.jinja b/sphinx/themes/agogo/static/agogo.css_t
index a23869425..a23869425 100644
--- a/sphinx/themes/agogo/static/agogo.css.jinja
+++ b/sphinx/themes/agogo/static/agogo.css_t
diff --git a/sphinx/themes/basic/static/basic.css.jinja b/sphinx/themes/basic/static/basic.css_t
index 9d5e4419d..9d5e4419d 100644
--- a/sphinx/themes/basic/static/basic.css.jinja
+++ b/sphinx/themes/basic/static/basic.css_t
diff --git a/sphinx/themes/basic/static/documentation_options.js.jinja b/sphinx/themes/basic/static/documentation_options.js_t
index fd6943fb3..fd6943fb3 100644
--- a/sphinx/themes/basic/static/documentation_options.js.jinja
+++ b/sphinx/themes/basic/static/documentation_options.js_t
diff --git a/sphinx/themes/basic/static/language_data.js.jinja b/sphinx/themes/basic/static/language_data.js_t
index 80f2a4f53..80f2a4f53 100644
--- a/sphinx/themes/basic/static/language_data.js.jinja
+++ b/sphinx/themes/basic/static/language_data.js_t
diff --git a/sphinx/themes/bizstyle/static/bizstyle.css.jinja b/sphinx/themes/bizstyle/static/bizstyle.css_t
index 1f012c4c2..1f012c4c2 100644
--- a/sphinx/themes/bizstyle/static/bizstyle.css.jinja
+++ b/sphinx/themes/bizstyle/static/bizstyle.css_t
diff --git a/sphinx/themes/bizstyle/static/bizstyle.js.jinja b/sphinx/themes/bizstyle/static/bizstyle.js_t
index fd0865e5d..fd0865e5d 100644
--- a/sphinx/themes/bizstyle/static/bizstyle.js.jinja
+++ b/sphinx/themes/bizstyle/static/bizstyle.js_t
diff --git a/sphinx/themes/classic/static/classic.css.jinja b/sphinx/themes/classic/static/classic.css_t
index 8a903e822..8a903e822 100644
--- a/sphinx/themes/classic/static/classic.css.jinja
+++ b/sphinx/themes/classic/static/classic.css_t
diff --git a/sphinx/themes/classic/static/sidebar.js.jinja b/sphinx/themes/classic/static/sidebar.js_t
index 32ae506aa..32ae506aa 100644
--- a/sphinx/themes/classic/static/sidebar.js.jinja
+++ b/sphinx/themes/classic/static/sidebar.js_t
diff --git a/sphinx/themes/epub/static/epub.css.jinja b/sphinx/themes/epub/static/epub.css_t
index 767d558be..767d558be 100644
--- a/sphinx/themes/epub/static/epub.css.jinja
+++ b/sphinx/themes/epub/static/epub.css_t
diff --git a/sphinx/themes/haiku/static/haiku.css.jinja b/sphinx/themes/haiku/static/haiku.css_t
index bccc3ea06..bccc3ea06 100644
--- a/sphinx/themes/haiku/static/haiku.css.jinja
+++ b/sphinx/themes/haiku/static/haiku.css_t
diff --git a/sphinx/themes/nature/static/nature.css.jinja b/sphinx/themes/nature/static/nature.css_t
index a2f3710e1..a2f3710e1 100644
--- a/sphinx/themes/nature/static/nature.css.jinja
+++ b/sphinx/themes/nature/static/nature.css_t
diff --git a/sphinx/themes/nonav/static/nonav.css.jinja b/sphinx/themes/nonav/static/nonav.css_t
index 71e3ffc08..71e3ffc08 100644
--- a/sphinx/themes/nonav/static/nonav.css.jinja
+++ b/sphinx/themes/nonav/static/nonav.css_t
diff --git a/sphinx/themes/pyramid/static/epub.css.jinja b/sphinx/themes/pyramid/static/epub.css_t
index 798054bdf..798054bdf 100644
--- a/sphinx/themes/pyramid/static/epub.css.jinja
+++ b/sphinx/themes/pyramid/static/epub.css_t
diff --git a/sphinx/themes/pyramid/static/pyramid.css.jinja b/sphinx/themes/pyramid/static/pyramid.css_t
index 4de532798..4de532798 100644
--- a/sphinx/themes/pyramid/static/pyramid.css.jinja
+++ b/sphinx/themes/pyramid/static/pyramid.css_t
diff --git a/sphinx/themes/scrolls/static/scrolls.css.jinja b/sphinx/themes/scrolls/static/scrolls.css_t
index c8b947d40..c8b947d40 100644
--- a/sphinx/themes/scrolls/static/scrolls.css.jinja
+++ b/sphinx/themes/scrolls/static/scrolls.css_t
diff --git a/sphinx/themes/sphinxdoc/static/sphinxdoc.css.jinja b/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t
index 36d05907e..36d05907e 100644
--- a/sphinx/themes/sphinxdoc/static/sphinxdoc.css.jinja
+++ b/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t
diff --git a/sphinx/themes/traditional/static/traditional.css.jinja b/sphinx/themes/traditional/static/traditional.css_t
index 085c98a8c..085c98a8c 100644
--- a/sphinx/themes/traditional/static/traditional.css.jinja
+++ b/sphinx/themes/traditional/static/traditional.css_t
diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py
index 4185fb246..03928710e 100644
--- a/sphinx/util/fileutil.py
+++ b/sphinx/util/fileutil.py
@@ -8,7 +8,6 @@ from typing import TYPE_CHECKING, Callable
from docutils.utils import relative_path
-from sphinx.deprecation import _old_jinja_template_suffix_warning
from sphinx.util.osutil import copyfile, ensuredir
from sphinx.util.typing import PathMatcher
@@ -16,19 +15,6 @@ if TYPE_CHECKING:
from sphinx.util.template import BaseRenderer
-def _template_basename(filename: str) -> str | None:
- """Given an input filename:
- If the input looks like a template, then return the filename output should
- be written to. Otherwise, return no result (None)."""
- # TODO: deprecate '_t' template suffix support after 2024-12-31
- if filename.lower().endswith('_t'):
- _old_jinja_template_suffix_warning(filename)
- return filename[:-2]
- elif filename.lower().endswith(".jinja"):
- return filename[:-6]
- return None
-
-
def copy_asset_file(source: str, destination: str,
context: dict | None = None,
renderer: BaseRenderer | None = None) -> None:
@@ -49,13 +35,14 @@ def copy_asset_file(source: str, destination: str,
# Use source filename if destination points a directory
destination = os.path.join(destination, os.path.basename(source))
- if _template_basename(source) and context is not None:
+ if source.lower().endswith('_t') and context is not None:
if renderer is None:
from sphinx.util.template import SphinxRenderer
renderer = SphinxRenderer()
with open(source, encoding='utf-8') as fsrc:
- destination = _template_basename(destination) or destination
+ if destination.lower().endswith('_t'):
+ destination = destination[:-2]
with open(destination, 'w', encoding='utf-8') as fdst:
fdst.write(renderer.render_string(fsrc.read(), context))
else:
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index efb847353..5116c2181 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -16,7 +16,7 @@ from docutils import nodes, writers
from docutils.nodes import Element, Node, Text
from sphinx import addnodes, highlighting
-from sphinx.deprecation import RemovedInSphinx70Warning, _old_jinja_template_suffix_warning
+from sphinx.deprecation import RemovedInSphinx70Warning
from sphinx.domains import IndexEntry
from sphinx.domains.std import StandardDomain
from sphinx.errors import SphinxError
@@ -435,8 +435,7 @@ class LaTeXTranslator(SphinxTranslator):
'body': ''.join(self.body),
'indices': self.generate_indices(),
})
- template = self._find_template('latex.tex')
- return self.render(template, self.elements)
+ return self.render('latex.tex_t', self.elements)
def hypertarget(self, id: str, withdoc: bool = True, anchor: bool = True) -> str:
if withdoc:
@@ -513,21 +512,14 @@ class LaTeXTranslator(SphinxTranslator):
return ''.join(ret)
- def _find_template(self, template_name: str) -> str:
- for template_dir in self.config.templates_path:
- # TODO: deprecate '_t' template suffix support after 2024-12-31
- for template_suffix in ('_t', '.jinja'):
- template = path.join(self.builder.confdir, template_dir,
- template_name + template_suffix)
- if path.exists(template):
- _old_jinja_template_suffix_warning(template)
- return template
-
- # Default: fallback to a pathless in-library jinja template
- return f"{template_name}.jinja"
-
def render(self, template_name: str, variables: dict[str, Any]) -> str:
renderer = LaTeXRenderer(latex_engine=self.config.latex_engine)
+ for template_dir in self.config.templates_path:
+ template = path.join(self.builder.confdir, template_dir,
+ template_name)
+ if path.exists(template):
+ return renderer.render(template, variables)
+
return renderer.render(template_name, variables)
@property
@@ -910,8 +902,8 @@ class LaTeXTranslator(SphinxTranslator):
def depart_table(self, node: Element) -> None:
labels = self.hypertarget_to(node)
table_type = self.table.get_table_type()
- template = self._find_template(f"{table_type}.tex")
- table = self.render(template, {'table': self.table, 'labels': labels})
+ table = self.render(table_type + '.tex_t',
+ {'table': self.table, 'labels': labels})
self.body.append(BLANKLINE)
self.body.append(table)
self.body.append(CR)