Skip to main content

generate_modindex

Function generate_modindex 

Source
pub fn generate_modindex(
    data: &PyDomainData,
    common_prefix: &[String],
) -> PyModindex
Expand description

PythonModuleIndex.generate (__init__.py:628-717), verbatim: modindex_common_prefix sorted longest-first (stable, so equal lengths keep config order); modules sorted by lower() (stable over registration order); the FIRST matching prefix is stripped (and restored when it swallowed the whole name, clearing stripped); letter buckets key on the first character of the stripped name, lowercased; a submodule (package != modname on the stripped name) gets subtype 2, promoting the bucket’s previous entry to a group head when it IS the parent, or inserting an all-empty dummy parent when no prev_modname.startswith(package) entry preceded it; display names keep the stripped prefix (stripped + modname); collapse iff submodules outnumber top-levels; groups come out letter-sorted.