Expand description
The index domain and the general index it feeds: Sphinx’s
IndexDomain (domains/index.py) collection half, and
IndexEntries.create_index (environment/adapters/indexentries.py:54-197)
— the assembly half that turns the collected 5-tuples into the grouped,
sorted structure genindex.html renders.
See docs/superpowers/plans/2026-08-31-m2-wave4-research-spec-sphinx-env-toctree-domains.md
§6 for the attribute-by-attribute mapping this port is drawn from.
What feeds it. Everything here reads index nodes out of a finished
doctree, so its fidelity is bounded by the parse layer’s. Two gaps are
known and belong to that layer, not this one (neither is exercised by
the environment-oracle corpus):
- The
:index:role (IndexRole,domains/index.py:97-117) is not implemented, so:index:text`` parses asproblematicand indexes nothing. .. index::with a:name:should anchor its entries on the id docutils’note_explicit_targetgives the named target (domains/index.py:78-83), and consume noindex-Nserial. This crate’s:name:-optioned targets carry a name but no id throughout the parse layer, so those entries anchor onindex-Ninstead — and because the serial is consumed, every laterindex-Nin the same document is shifted up by one as well, so the divergence is not confined to the named directive’s own entries.
Unicode caveat. The sort and grouping keys normalize to NFD and lowercase exactly where Sphinx does, but two primitives are Rust’s rather than Python’s:
str::to_lowercase/char::to_uppercaseare full Unicode case mappings, like Python’sstr.lower()/str.upper()(both expandU+0130toi+ combining dot, both special-case final sigma). No divergence is known for the corpus, and none is expected outside locale-sensitive mappings (Turkish dotless i), which neither applies.- [
py_isalpha] approximates Python’sstr.isalpha()(general categoryL*) with Rust’schar::is_alphabetic(theAlphabeticderived property). The two differ forNl(Ⅷ,ↀ) and forOther_Alphabeticcombining marks — which NFD produces — so an entry starting with a Devanagari vowel sign, or a Roman-numeral character, would be grouped under itself here and underSymbolsby Sphinx. Closing that needs a general-category table this crate does not carry.
Structs§
- Index
Entry - One top-level index entry with its targets and sub-entries.
- Index
Group - One letter (or category-key) heading of the general index.
- Index
Message - A diagnostic
create_indexraises, located at a whole document (location=docname, which renders as the source path with no line). - Index
SubItem
Functions§
- create_
index IndexEntries.create_index(builder, group_entries=True)(environment/adapters/indexentries.py:54-197).- process_
doc IndexDomain.process_doc(domains/index.py:48-61).- snapshot
- The finished index as JSON, in the oracle fixture’s
genindexshape. Infallible: every field of these structs is a plain string, option or vector.
Type Aliases§
- Index
Target - One
(main, uri)target:mainis Sphinx’s literal"main"/"".