Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit 4569657

Browse files
committed
Ignore non-HTML builders when resolving references
It does not make sense to override the domain classes when using other non-HTML builders because there is nothing to add. Although, due to a initialization race condition, we are not able to "not override the Domains if the builder is non-HTML" so we need to skip our custom resolution during build time.
1 parent 0655561 commit 4569657

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

hoverxref/domains.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ def _get_docpath(self, builder, docname):
5252
return docpath
5353

5454
def _is_ignored_ref(self, env, target):
55+
# HACK: skip all references if the builder is non-html. We shouldn't
56+
# have overridden the Domain in first instance at ``setup_domains``
57+
# function, but at that time ``app.builder`` is not yet initialized. If
58+
# we suscribe ourselves to ``builder-initied`` it's too late and our
59+
# override does not take effect. Other builders (e.g. LatexBuilder) may
60+
# fail with internal functions we use (e.g. builder.get_outfilename).
61+
# So, we are skipping it here :(
62+
if env.app.builder.format != 'html':
63+
return True
64+
5565
if target in env.config.hoverxref_ignore_refs:
5666
logger.info(
5767
'Ignoring reference in hoverxref_ignore_refs. target=%s',

0 commit comments

Comments
 (0)