setup(app) | The guts of the extension. |
autodoc_process_signature(app, what, name, ...) | Process signature of mmf.objects.StateVars subclasses |
preprocess(app, docname, source) | This will be called when the source is read, allowing preprocessing. |
autodoc_skip_member(app, what, name, obj, ...) | Emitted when autodoc has to decide whether a member should be included in the documentation. |
autodoc_preprocess_docstring(app, what, ...) | This will be called once autodoc has generated the |
Sphinx extension that allows me to perform some preprocessing. The following features are added:
Documentation included by sphinx.ext.autodoc is parsed and dollar signs are replaced: $...$ -> ``:math:\`...\`. This allows me to use more LaTeX syntax for example, so my documentation can be kept closer to the LaTeX source. To allow dollar signs to be used in matplotlib, we do not touch dollar signs directly preceded or followed by a quotation: '$, $', "$, or $".
Todo
Provide some mechanism for detecting dollar signs in matplotlib labels where they should not be replaced. For example, in .. plot:: directives and in code examples..
Additional member filtering options are provided. This allows one to include private members in the documentation for example. In particular, if a member is included in __all__ or __documented_members__, then it will always be included in the documentation.
Process signature of mmf.objects.StateVars subclasses which have a generic signature by default.
This will be called when the source is read, allowing preprocessing.
Examples
>>> def replace(s):
... src = [s]
... preprocess(None, None, src)
... return src[0]
>>> replace('$x=3$') # Standard replacement
':math:`x=3`'
>>> replace('$x=3:math:` `y=4$') # Replaces all equations
':math:`x=3` :math:`y=4`'
>>> replace('"$x$"') # Does not touch quoted equations
'"$x$"'
>>> replace("'$x$'")
"'$x$'"
>>> replace('$x$') # Converts $ -> :math:`
'`x$'
Emitted when autodoc has to decide whether a member should be included in the documentation. The member is excluded if a handler returns True. It is included if the handler returns False.
Parameters : | app : :
what : “module”, “class”, “exception”, “function”, “method”, “attribute”
name : :
obj : :
skip : bool
options : :
|
---|