Closed
Description
Describe the bug
Most likely since #11165 (at least since 7.4.0, not before that) my apidoc template files are not found anymore. They are called module.rst_t
and package.rst_t
. Renaming them to module.rst.jinja
and package.rst.jinja
fixes the issue, but this breaks compatibility with earlier sphinx versions. Moreover, .rst_t
files will only be marked as deprecated starting 31 December 2024.
How to Reproduce
conf.py
:
extensions = [
'sphinxcontrib.apidoc',
]
templates_path = ['templates']
exclude_patterns = ['_build']
apidoc_module_dir = 'mod'
apidoc_output_dir = 'reference'
apidoc_separate_modules = True
templates/module.rst_t
:
{%- if show_headings %}
{{- basename | e | heading }}
The template was found!
-----------------------
{% endif -%}
.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
:{{ option }}:
{%- endfor %}
index.rst
Hello World
===========
.. toctree::
:maxdepth: 2
:caption: API documentation
reference/mod
mod/mod.py
:
class Test:
'''This is a test class'''
pass
Using this configuration, you don't see the line "The template was found!" on the index page or anywhere else. Renaming templates/module.rst_t
to templates/module.rst.jinja
fixes the issue, but breaks compatibility with other sphinx versions.
Environment Information
Platform: linux; (Linux-6.8.0-40-generic-x86_64-with-glibc2.35)
Python version: 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0])
Python implementation: CPython
Sphinx version: 8.0.2
Docutils version: 0.20.1
Jinja2 version: 3.1.4
Pygments version: 2.18.0
Sphinx extensions
`['sphinxcontrib.apidoc']`
Additional context
No response