autoaliasattr_directive¶
A directive for documenting type aliases and other module-level attributes.
Classes
Directive which replaces Sphinx's Autosummary for module-level attributes: instead, it manually crafts a new "Type Aliases" section, where all the module-level attributes which are explicitly annotated as |
Functions
- smart_replace(base, alias, substitution)[source]¶
Auxiliary function for substituting type aliases into a base string, when there are overlaps between the aliases themselves.
Parameters¶
- base
The string in which the type aliases will be located and replaced.
- alias
The substring to be substituted.
- substitution
The string which will replace every occurrence of
alias.
Returns¶
- str
The new string after the alias substitution.
- Parameters:
base (str)
alias (str)
substitution (str)
- Return type:
str
- class AliasAttrDocumenter(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
Bases:
DirectiveDirective which replaces Sphinx’s Autosummary for module-level attributes: instead, it manually crafts a new “Type Aliases” section, where all the module-level attributes which are explicitly annotated as
TypeAliasare considered as such, for their use all around the Manim docs.These type aliases are separated from the “regular” module-level attributes, which get their traditional “Module Attributes” section autogenerated with Sphinx’s Autosummary under “Type Aliases”.
See
docs/source/_templates/autosummary/module.rstto watch this directive in action.See
parse_module_attributes()for more information on how the modules are parsed to obtain theTypeAliasinformation and separate it from the other attributes.- has_content = True¶
May the directive have content?
- objtype = 'autoaliasattr'¶
- required_arguments = 1¶
Number of required directive arguments.