Skip to main content

assign_section_numbers

Function assign_section_numbers 

Source
pub fn assign_section_numbers<'d>(
    env: &mut BuildEnvironment,
    load_doctree: &DoctreeLoader<'d>,
) -> SectionNumbering
Expand description

Assign a section number to every heading under a :numbered: toctree.

Exact port of assign_section_numbers (collectors/toctree.py:197-283). env.toc_secnumbers is rebuilt from scratch (the old table is only kept to diff against), every reachable document is numbered exactly once, and a document a second numbered toctree tries to claim produces warning #20 instead.

The walk mutates env.tocs in place: each entry’s reference node gets the secnumber attribute Sphinx stamps there, which is what makes the rendered toc show 1.2. Title.