sphinxter.Sphinxter¶
- class sphinxter.Sphinxter(modules: 'module or list[module]', titles: dict = None, toctree: dict = None, base: str = 'docs/source', indent: str = ' ')¶
Class for reading documentation and writing into documents
- Parameters:
modules (module or list[module]) – module or modules to read
titles (dict) – document titles to use
toctree (dict) – list of document names to use for the main toctree
base (str) – base directory to store generated documents
indent (str) – string to use for indenting
- base¶
base directory to write documents
- documents¶
hash of documents, keyed by name
- indent¶
string to use for indenting
- modules¶
list of modules to read
- titles¶
hash of titles, keyed by document name
- toctree¶
- document(module: str, kind: str, parsed: dict, current: str = 'index')¶
Adds a resource’s documentation to its document
- Parameters:
module (str) – resource’s parent module’s name
kind (str) – resource’s kind, module, function, or class
parsed (dict) – resource’s parsed documentation
current (str) – the last document named
Usage
You can specify a resource’s document and order in that document with a document directive in the YAML:
def func(): """ document: path: different order: 10 """ # { # "path": "different", # "order": 10 # }
This would place the func function in the different.rst document with all the other resources at the 10 posiiton.
If you only specify document as a str, it assume you meant path and that order is 0:
def func(): """ document: different """ # { # "path": "different", # "order": 0 # }
If you only specify document as an int, it assume you meant order and that the path hasn’t changed:
def func(): """ document: 10 """ # { # "path": "index", # "order": 10 # }
- process()¶
Reads module(s) and writes document(s) end to end
- read()¶
Reads all the documentation into their document(s)
- write()¶
Writes all document(s)