diff --git a/CHANGELOG.md b/CHANGELOG.md index e1116c85..863b1c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.10.2](https://github.com/mkdocstrings/python/releases/tag/1.10.2) - 2024-05-16 + +[Compare with 1.10.1](https://github.com/mkdocstrings/python/compare/1.10.1...1.10.2) + +### Bug Fixes + +- Actually make use of custom .html.jinja templates ([5668abb](https://github.com/mkdocstrings/python/commit/5668abba15b13b86fe67f70f6b4004b7b1feeb4f) by Timothée Mazzucotelli). + ## [1.10.1](https://github.com/mkdocstrings/python/releases/tag/1.10.1) - 2024-05-14 [Compare with 1.10.0](https://github.com/mkdocstrings/python/compare/1.10.0...1.10.1) diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py index 479597c2..face49fe 100644 --- a/src/mkdocstrings_handlers/python/rendering.py +++ b/src/mkdocstrings_handlers/python/rendering.py @@ -474,25 +474,25 @@ def do_get_template(env: Environment, obj: str | Object) -> str | Template: template = env.get_template(f"{name}.html") except TemplateNotFound: return f"{name}.html.jinja" - else: - # TODO: Remove once support for Python 3.8 is dropped. - if sys.version_info < (3, 9): - try: - Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type] - except ValueError: - our_template = False - else: - our_template = True + # TODO: Remove once support for Python 3.8 is dropped. + if sys.version_info < (3, 9): + try: + Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type] + except ValueError: + our_template = False else: - our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type] - if not our_template: - # TODO: Switch to a warning log after some time. - logger.info( - f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. " - "After some time, this message will be logged as a warning, causing strict builds to fail.", - once=True, - ) - return f"{name}.html" + our_template = True + else: + our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type] + if our_template: + return f"{name}.html.jinja" + # TODO: Switch to a warning log after some time. + logger.info( + f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. " + "After some time, this message will be logged as a warning, causing strict builds to fail.", + once=True, + ) + return f"{name}.html" @pass_context