Python docutils.parsers.rst.directives.register_directive() Examples

The following are 8 code examples of docutils.parsers.rst.directives.register_directive(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module docutils.parsers.rst.directives , or try the search function .
Example #1
Source File: briandoc.py    From brian2genn with GNU General Public License v2.0 6 votes vote down vote up
def setup(app, get_doc_object_=get_doc_object):
    global get_doc_object
    get_doc_object = get_doc_object_

    app.connect('autodoc-process-docstring', mangle_docstrings)
    app.connect('autodoc-process-signature', mangle_signature)

    # Extra mangling domains
    app.add_domain(NumpyPythonDomain)
    app.add_domain(NumpyCDomain)

    directives.register_directive('document_brian_prefs', BrianPrefsDirective)

    # provide the brianobj role with a link to the Python domain
    app.add_role('brianobj', brianobj_role)

#------------------------------------------------------------------------------
# Docstring-mangling domains
#------------------------------------------------------------------------------ 
Example #2
Source File: embed.py    From waliki with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def register_directive():
    directives.register_directive('embed', Embed) 
Example #3
Source File: exampleinclude.py    From airflow with Apache License 2.0 5 votes vote down vote up
def setup(app):
    """
    Sets the plugin up and returns configuration of the plugin.

    :param app: application.
    :return json description of the configuration that is needed by the plugin.
    """
    directives.register_directive("exampleinclude", ExampleInclude)
    app.connect("doctree-read", doctree_read)
    app.add_config_value("exampleinclude_sourceroot", None, "env")
    if not airflow_theme_is_available:
        # Sphinx airflow theme has its own styles.
        app.add_css_file('exampleinclude.css')
    return {"version": "builtin", "parallel_read_safe": False, "parallel_write_safe": False} 
Example #4
Source File: _simple.py    From flocker with Apache License 2.0 5 votes vote down vote up
def setup(app):
    """
    Entry point for sphinx extension.
    """
    directives.register_directive('empty-div', EmptyDiv)
    intro_text_setup(app)
    noscript_content_setup(app)
    tutorial_step_condensed_setup(app)
    tutorial_step_setup(app)
    mobile_label_setup(app)
    parallel_setup(app)
    logo_setup(app) 
Example #5
Source File: md_include.py    From galgebra with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setup(app):
    directives.register_directive('mdinclude', MdInclude) 
Example #6
Source File: directives.py    From tick with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setup(app):
    directives.register_directive('include', Include) 
Example #7
Source File: directive.py    From plantweb with Apache License 2.0 5 votes vote down vote up
def setup(app):
    """
    Setup function that makes this module a Sphinx extension.

    See http://www.sphinx-doc.org/en/stable/extdev/appapi.html#sphinx.application.Sphinx.add_config_value
    """  # noqa
    # Wee want to override the directives:
    # - 'graph' from sphinx.ext.graphviz extension.
    # - 'uml' from sphinxcontrib.plantuml
    # But Sphinx warns of the override, causing failure if warnings are set
    # to fail documentation build. So, we go down and use docutils registering
    # directly instead.

    # app.add_directive('uml', UmlDirective)
    # app.add_directive('graph', GraphDirective)
    # app.add_directive('diagram', DiagramDirective)

    from docutils.parsers.rst import directives
    directives.register_directive('uml', UmlDirective)
    directives.register_directive('graph', GraphDirective)
    directives.register_directive('diagram', DiagramDirective)

    # Register the config value to allow to set plantweb defaults in conf.py
    app.add_config_value('plantweb_defaults', {}, 'env')

    # Register Plantweb defaults setter
    # Note: The str() is because:
    #       - In Python 2.7, Sphinx expects a str, not unicode.
    #       - In Python 3.4, Sphinx expects a str, not bytes.
    app.connect(str('builder-inited'), builder_inited_handler) 
Example #8
Source File: test_base_directives.py    From blockdiag with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        docutils.register_directive('blockdiag',
                                    directives.BlockdiagDirectiveBase)
        self._tmpdir = TemporaryDirectory()