Table Of Contents

Previous topic

mmf.sphinx.ext.matplotlibext.plot_directive

Next topic

mmf.utils

This Page

mmf.sphinx.ext.mmfext

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:

LaTeX Math

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..

Member Filtering

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.

mmf.sphinx.ext.mmfext.setup(app)[source]

The guts of the extension.

mmf.sphinx.ext.mmfext.autodoc_process_signature(app, what, name, obj, options, signature, return_annotation)[source]

Process signature of mmf.objects.StateVars subclasses which have a generic signature by default.

mmf.sphinx.ext.mmfext.preprocess(app, docname, source)[source]

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$'
mmf.sphinx.ext.mmfext.autodoc_skip_member(app, what, name, obj, skip, options)[source]

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 : :

the Sphinx application object

what : “module”, “class”, “exception”, “function”, “method”, “attribute”

The type of the object which the docstring belongs to.

name : :

The fully qualified name of the object

obj : :

The object itself

skip : bool

A boolean indicating if autodoc will skip this member if the user handler does not override the decision.

options : :

The options given to the directive: an object with attributes inherited_members, undoc_members, show_inheritance and noindex that are True if the flag option of same name was given to the auto directive.

mmf.sphinx.ext.mmfext.autodoc_preprocess_docstring(app, what, name, obj, options, lines)[source]

This will be called once autodoc has generated the docstring for an object.