MCPcopy Index your code
hub / github.com/python/cpython / process_glossary_nodes

Function process_glossary_nodes

Doc/tools/extensions/glossary_search.py:20–42  ·  view source on GitHub ↗
(
    app: Sphinx,
    doctree: nodes.document,
    _docname: str,
)

Source from the content-addressed store, hash-verified

18
19
20def process_glossary_nodes(
21 app: Sphinx,
22 doctree: nodes.document,
23 _docname: str,
24) -> None:
25 if app.builder.format != 'html' or app.builder.embedded:
26 return
27
28 if hasattr(app.env, 'glossary_terms'):
29 terms = app.env.glossary_terms
30 else:
31 terms = app.env.glossary_terms = {}
32
33 for node in doctree.findall(glossary):
34 for glossary_item in node.findall(nodes.definition_list_item):
35 term = glossary_item[0].astext()
36 definition = glossary_item[-1]
37
38 rendered = app.builder.render_partial(definition)
39 terms[term.lower()] = {
40 'title': term,
41 'body': rendered['fragment'],
42 }
43
44
45def write_glossary_json(app: Sphinx, _exc: Exception) -> None:

Callers

nothing calls this directly

Calls 2

findallMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…