Skip to content

Commit

Permalink
Merge pull request #11331 from dbaston/doc-gdal-calc
Browse files Browse the repository at this point in the history
Doc: Fix example xrefs in singlehtml build
  • Loading branch information
rouault authored Nov 22, 2024
2 parents 33e4a3c + aeea78e commit 4ab9ce5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions doc/source/_extensions/cli_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,10 @@ def run(self):
reftype="example",
refdomain="std",
reftarget=self.text,
refdoc=self.env.docname,
)
], []

def run_bad(self):
# ref_node = pending_xref(reftarget=self.text)

if hasattr(self.env, "gdal_examples"):
examples = self.env.gdal_examples.get(self.env.docname, {})
else:
examples = {}

ref_node = nodes.reference("", "", refid=self.text)
ref_node.append(nodes.Text(f"Example {examples.get(self.text)}"))

return [ref_node], []


class ExampleDirective(SphinxDirective):

Expand Down Expand Up @@ -83,7 +71,7 @@ def link_example_refs(app, env, node, contnode):
example_name = node["reftarget"]

if hasattr(env, "gdal_examples"):
examples = env.gdal_examples.get(env.docname, {})
examples = env.gdal_examples.get(node["refdoc"], {})
else:
examples = {}

Expand Down

0 comments on commit 4ab9ce5

Please sign in to comment.