From 569b794d4b067a1d5fffc569b873dcaa5c0244fb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 26 Oct 2021 19:03:12 +0200 Subject: [PATCH] doc: extensions: vcs_link: only run for HTML builder The vcs_link should only run for the HTML builder, since it is the only target of this extension. The other builders do not have the templates instance, making them fail. Signed-off-by: Gerard Marull-Paretas --- doc/_extensions/zephyr/vcs_link.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/_extensions/zephyr/vcs_link.py b/doc/_extensions/zephyr/vcs_link.py index b9769c86ca9..23aedb5ef33 100644 --- a/doc/_extensions/zephyr/vcs_link.py +++ b/doc/_extensions/zephyr/vcs_link.py @@ -67,6 +67,9 @@ def vcs_link_get_url(app: Sphinx, pagename: str) -> Optional[str]: def add_jinja_filter(app: Sphinx): + if app.builder.name != "html": + return + app.builder.templates.environment.filters["vcs_link_get_url"] = partial( vcs_link_get_url, app )