Skip to main content

Module ids

Module ids 

Source
Expand description

docutils-exact id/name normalization and the document id registry.

Algorithms ported from docutils 0.22.4 nodes.py (make_id, fully_normalize_name, whitespace_normalize_name, document.set_id, set_name_id_map/set_duplicate_name_id), with the Sphinx settings id_prefix='', auto_id_prefix='id' baked in (sphinx/environment overrides docutils’ '%' default — auto ids are id1, id2, …).

Structs§

DupnameFixup
A deferred “first node loses its name too” fixup: on a duplicate name, docutils dupnames BOTH nodes, but the first one is already deep in the tree — the parser applies these after parsing via apply_dupname_fixups.
IdRegistry

Functions§

apply_dupname_fixups
Post-parse pass: move name from names to dupnames on the node carrying node_id (the FIRST occurrence keeps its id, loses its name).
fully_normalize_name
docutils fully_normalize_name: lowercase + collapse whitespace.
make_id
docutils nodes.make_id. Result grammar: [a-z](-?[a-z0-9]+)* or empty.
whitespace_normalize_name
docutils whitespace_normalize_name: collapse whitespace, keep case.