Skip to content

Commit 5668abb

Browse files
committed
fix: Actually make use of custom .html.jinja templates
1 parent f7705ce commit 5668abb

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/mkdocstrings_handlers/python/rendering.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -474,25 +474,25 @@ def do_get_template(env: Environment, obj: str | Object) -> str | Template:
474474
template = env.get_template(f"{name}.html")
475475
except TemplateNotFound:
476476
return f"{name}.html.jinja"
477-
else:
478-
# TODO: Remove once support for Python 3.8 is dropped.
479-
if sys.version_info < (3, 9):
480-
try:
481-
Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type]
482-
except ValueError:
483-
our_template = False
484-
else:
485-
our_template = True
477+
# TODO: Remove once support for Python 3.8 is dropped.
478+
if sys.version_info < (3, 9):
479+
try:
480+
Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type]
481+
except ValueError:
482+
our_template = False
486483
else:
487-
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
488-
if not our_template:
489-
# TODO: Switch to a warning log after some time.
490-
logger.info(
491-
f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. "
492-
"After some time, this message will be logged as a warning, causing strict builds to fail.",
493-
once=True,
494-
)
495-
return f"{name}.html"
484+
our_template = True
485+
else:
486+
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
487+
if our_template:
488+
return f"{name}.html.jinja"
489+
# TODO: Switch to a warning log after some time.
490+
logger.info(
491+
f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. "
492+
"After some time, this message will be logged as a warning, causing strict builds to fail.",
493+
once=True,
494+
)
495+
return f"{name}.html"
496496

497497

498498
@pass_context

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy