Skip to content

Commit 63c98ed

Browse files
authored
Doc: Fix PDF build (NoUri). (GH-15739)
1 parent bba9207 commit 63c98ed

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
from sphinx import addnodes
2424
from sphinx.builders import Builder
25+
try:
26+
from sphinx.errors import NoUri
27+
except ImportError:
28+
from sphinx.environment import NoUri
2529
from sphinx.locale import translators
2630
from sphinx.util import status_iterator, logging
2731
from sphinx.util.nodes import split_explicit_title
@@ -569,10 +573,13 @@ def process_audit_events(app, doctree, fromdocname):
569573
for i, (doc, label) in backlinks:
570574
if isinstance(label, str):
571575
ref = nodes.reference("", nodes.Text("[{}]".format(i)), internal=True)
572-
ref['refuri'] = "{}#{}".format(
573-
app.builder.get_relative_uri(fromdocname, doc),
574-
label,
575-
)
576+
try:
577+
ref['refuri'] = "{}#{}".format(
578+
app.builder.get_relative_uri(fromdocname, doc),
579+
label,
580+
)
581+
except NoUri:
582+
continue
576583
node += ref
577584
row += nodes.entry('', node)
578585

0 commit comments

Comments
 (0)