sphinx_c_autodoc.napoleon package#
Module contents#
Extend napoleon to provide a Members section for C structs and unions similar to the Attributes section in python objects.
- class sphinx_c_autodoc.napoleon.CAutoDocString(docstring: str | List[str], config: Config | None = None, app: Sphinx | None = None, what: str = '', name: str = '', obj: Any | None = None, options: Options | None = None)[source]#
Bases:
GoogleDocstring
A docstring that can handle documenting some extra c sections, in particular, members sections of structs and unions and enumerators sections of enums.
- get_default_sections() Dict[str, Callable] [source]#
Creates the dictionary that should be used in
_sections
for this instance. If one wants to extend this class simply do:class MyDocString(CAutoDocString): def get_default_sections(self) -> Dict[str, Callable]: sections = super().get_default_sections() sections["my_custom_section"] = self._some_method
- Returns:
The dictionary of sections to methods that should be used
_sections
.- Return type:
Dict[str, Callable]
- sphinx_c_autodoc.napoleon.process_autodoc_docstring(app: Any, what: str, name: str, obj: Any, options: Options | None, lines: List[str]) None [source]#
Call back for autodoc’s
autodoc-process-docstring
event.- Parameters:
app (
Sphinx
) – The Sphinx application objectwhat (str) – The type of the object which the comment belongs to. One of “cmodule”, “cmember”, “ctype”, “cfunction”, “cstruct”.
name (str) – The fully qualified name of the object. For C files this may be a little polluted as it will be
my_file.c.some_item.some_items_member
.obj (any) – The object itself
options (dict) – The options given to the directive.
lines (List[str]) – The lines of the comment. This is modified in place.