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 <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-10-26 19:03:12 +02:00 committed by Christopher Friedt
commit 569b794d4b

View file

@ -67,6 +67,9 @@ def vcs_link_get_url(app: Sphinx, pagename: str) -> Optional[str]:
def add_jinja_filter(app: Sphinx): def add_jinja_filter(app: Sphinx):
if app.builder.name != "html":
return
app.builder.templates.environment.filters["vcs_link_get_url"] = partial( app.builder.templates.environment.filters["vcs_link_get_url"] = partial(
vcs_link_get_url, app vcs_link_get_url, app
) )