localecmddoc.autodoc¶
Functions for creating automatic documentation of localecmd.Modules.
Module Contents¶
Functions¶
Write the files with the Modules documentation to disk. |
|
Write txt to file if the file does not contain this text already. |
|
Create a string of all docstrings within the module in markdown format. |
|
Set up directive with given properties |
|
Get docstring from Topic and translate it to markdown |
|
Get docstring from Function and translate it to markdown. |
|
Translate parameters and types in the parameters section of a doctring |
|
Remove any parameters for arguments that will be injected. |
|
Remove any markdown python code blocks. |
API¶
- write_module_docs(modules: Iterable[localecmd.Module], output_folder: pathlib.Path, file_extension: str = '.md', *, remove_pycode: bool = True)¶
Write the files with the Modules documentation to disk.
Attention
Use a dedicated output folder. The files within the output folder that do not belong to the docs will be deleted.
- Parameters:
modules (Iterable[Module]) – Modules to write the docs for.
output_folder (pathlib.Path) – Into which folder to write the files. If not existing, this folder will be created.
file_extension (str, optional) – File extension of output files. Default is ‘.md’
remove_pycode (bool) – If Python code blocks should be removed from the output.
- write_file(file: pathlib.Path, txt: str)¶
Write txt to file if the file does not contain this text already.
- create_module_doc_output(module: localecmd.Module, *, remove_pycode: bool) str¶
Create a string of all docstrings within the module in markdown format.
- Parameters:
module (Module) – The module to create the documentation for
remove_pycode (bool) – If Python code blocks should be removed from the output.
- fill_md_directive(directive: str, content: str, arg: str) str¶
Set up directive with given properties
- getdoc_topic(topic: localecmd.topic.Topic, directive: str) str¶
Get docstring from Topic and translate it to markdown
- getdoc_cmd(cmd: localecmd.Function, directive: str, *, remove_pycode: bool) str¶
Get docstring from Function and translate it to markdown.
- translate_parameters(s: str, fullname: str = '')¶
Translate parameters and types in the parameters section of a doctring
Docstring must be sphinx-style