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

The following are 19 code examples of docutils.parsers.rst.directives._directives(). 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: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def test_setup(self):
        directives.setup()
        options = directives.directive_options

        self.assertIn('nwdiag', docutils._directives)
        self.assertEqual(directives.NwdiagDirective,
                         docutils._directives['nwdiag'])
        self.assertEqual('PNG', options['format'])
        self.assertEqual(False, options['antialias'])
        self.assertEqual(None, options['fontpath'])
        self.assertEqual(False, options['nodoctype'])
        self.assertEqual(False, options['noviewbox'])
        self.assertEqual(False, options['inline_svg']) 
Example #2
Source File: test_rst_directives.py    From seqdiag with Apache License 2.0 5 votes vote down vote up
def test_setup_with_args(self):
        directives.setup(format='SVG', antialias=True, fontpath='/dev/null',
                         nodoctype=True, noviewbox=True, inline_svg=True)
        options = directives.directive_options

        self.assertIn('seqdiag', docutils._directives)
        self.assertEqual(directives.SeqdiagDirective,
                         docutils._directives['seqdiag'])
        self.assertEqual('SVG', options['format'])
        self.assertEqual(True, options['antialias'])
        self.assertEqual('/dev/null', options['fontpath'])
        self.assertEqual(True, options['nodoctype'])
        self.assertEqual(True, options['noviewbox'])
        self.assertEqual(True, options['inline_svg']) 
Example #3
Source File: test_rst_directives.py    From seqdiag with Apache License 2.0 5 votes vote down vote up
def test_setup(self):
        directives.setup()
        options = directives.directive_options

        self.assertIn('seqdiag', docutils._directives)
        self.assertEqual(directives.SeqdiagDirective,
                         docutils._directives['seqdiag'])
        self.assertEqual('PNG', options['format'])
        self.assertEqual(False, options['antialias'])
        self.assertEqual(None, options['fontpath'])
        self.assertEqual(False, options['nodoctype'])
        self.assertEqual(False, options['noviewbox'])
        self.assertEqual(False, options['inline_svg']) 
Example #4
Source File: test_rst_directives.py    From seqdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'seqdiag' in docutils._directives:
            del docutils._directives['seqdiag']

        self._tmpdir.clean() 
Example #5
Source File: test_base_directives.py    From blockdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'blockdiag' in docutils._directives:
            del docutils._directives['blockdiag']

        self._tmpdir.clean() 
Example #6
Source File: test_blockdiag_directives.py    From blockdiag with Apache License 2.0 5 votes vote down vote up
def test_setup_with_args(self):
        directives.setup(format='SVG', antialias=True, fontpath='/dev/null',
                         nodoctype=True, noviewbox=True, inline_svg=True)
        options = directives.directive_options

        self.assertIn('blockdiag', docutils._directives)
        self.assertEqual(directives.BlockdiagDirective,
                         docutils._directives['blockdiag'])
        self.assertEqual('SVG', options['format'])
        self.assertEqual(True, options['antialias'])
        self.assertEqual('/dev/null', options['fontpath'])
        self.assertEqual(True, options['nodoctype'])
        self.assertEqual(True, options['noviewbox'])
        self.assertEqual(True, options['inline_svg']) 
Example #7
Source File: test_blockdiag_directives.py    From blockdiag with Apache License 2.0 5 votes vote down vote up
def test_setup(self):
        directives.setup()
        options = directives.directive_options

        self.assertIn('blockdiag', docutils._directives)
        self.assertEqual(directives.BlockdiagDirective,
                         docutils._directives['blockdiag'])
        self.assertEqual('PNG', options['format'])
        self.assertEqual(False, options['antialias'])
        self.assertEqual(None, options['fontpath'])
        self.assertEqual(False, options['nodoctype'])
        self.assertEqual(False, options['noviewbox'])
        self.assertEqual(False, options['inline_svg']) 
Example #8
Source File: test_blockdiag_directives.py    From blockdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'blockdiag' in docutils._directives:
            del docutils._directives['blockdiag']

        self._tmpdir.clean() 
Example #9
Source File: directives.py    From azure-cli-dev-tools with MIT License 5 votes vote down vote up
def _add_directive(app, name, cls):
    # check based on similar check in Sphinx().add_directive
    if name not in directives._directives:  # pylint: disable=protected-access
        app.add_directive(name, cls) 
Example #10
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def test_setup_with_args(self):
        directives.setup(format='SVG', antialias=True, fontpath='/dev/null',
                         nodoctype=True, noviewbox=True, inline_svg=True)
        options = directives.directive_options

        self.assertIn('nwdiag', docutils._directives)
        self.assertEqual(directives.NwdiagDirective,
                         docutils._directives['nwdiag'])
        self.assertEqual('SVG', options['format'])
        self.assertEqual(True, options['antialias'])
        self.assertEqual('/dev/null', options['fontpath'])
        self.assertEqual(True, options['nodoctype'])
        self.assertEqual(True, options['noviewbox'])
        self.assertEqual(True, options['inline_svg']) 
Example #11
Source File: sphinx_doc.py    From olympe with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run(self):
        automodule = directives._directives["automodule"]
        options = dict.fromkeys(('inherited-members', 'members', 'undoc-members'))
        message_module = "olympe.messages." + self.arguments[0]
        enum_module = "olympe.enums." + self.arguments[0]
        result = automodule("automodule", [message_module], options, *self.directive_args).run()
        result += automodule("automodule", [enum_module], options, *self.directive_args).run()
        return result 
Example #12
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'nwdiag' in docutils._directives:
            del docutils._directives['nwdiag']

        self._tmpdir.clean() 
Example #13
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def test_setup(self):
        directives.setup()
        options = directives.directive_options

        self.assertIn('packetdiag', docutils._directives)
        self.assertEqual(directives.PacketdiagDirective,
                         docutils._directives['packetdiag'])
        self.assertEqual('PNG', options['format'])
        self.assertEqual(False, options['antialias'])
        self.assertEqual(None, options['fontpath'])
        self.assertEqual(False, options['nodoctype'])
        self.assertEqual(False, options['noviewbox'])
        self.assertEqual(False, options['inline_svg']) 
Example #14
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'packetdiag' in docutils._directives:
            del docutils._directives['packetdiag']

        self._tmpdir.clean() 
Example #15
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def test_setup_with_args(self):
        directives.setup(format='SVG', antialias=True, fontpath='/dev/null',
                         nodoctype=True, noviewbox=True, inline_svg=True)
        options = directives.directive_options

        self.assertIn('rackdiag', docutils._directives)
        self.assertEqual(directives.RackdiagDirective,
                         docutils._directives['rackdiag'])
        self.assertEqual('SVG', options['format'])
        self.assertEqual(True, options['antialias'])
        self.assertEqual('/dev/null', options['fontpath'])
        self.assertEqual(True, options['nodoctype'])
        self.assertEqual(True, options['noviewbox'])
        self.assertEqual(True, options['inline_svg']) 
Example #16
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def test_setup(self):
        directives.setup()
        options = directives.directive_options

        self.assertIn('rackdiag', docutils._directives)
        self.assertEqual(directives.RackdiagDirective,
                         docutils._directives['rackdiag'])
        self.assertEqual('PNG', options['format'])
        self.assertEqual(False, options['antialias'])
        self.assertEqual(None, options['fontpath'])
        self.assertEqual(False, options['nodoctype'])
        self.assertEqual(False, options['noviewbox'])
        self.assertEqual(False, options['inline_svg']) 
Example #17
Source File: test_rst_directives.py    From nwdiag with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        if 'rackdiag' in docutils._directives:
            del docutils._directives['rackdiag']

        self._tmpdir.clean() 
Example #18
Source File: __init__.py    From sphinxcontrib-programoutput with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def tearDown(self):
        directives._directives = self.directives
        roles._roles = self.roles 
Example #19
Source File: __init__.py    From sphinxcontrib-programoutput with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setUp(self):
        # Avoid "WARNING: while setting up extension
        # sphinxcontrib.programoutput: directive u'program-output' is
        # already registered, it will be overridden".
        # This may only be needed for Sphinx 1.
        self.directives = directives._directives.copy()
        # Likewise for 'eq'
        self.roles = roles._roles.copy()

        # Avoid "node class 'toctree' is already registered, its visitors will be overridden"
        # By default this class has *no* `visit_` methods
        for node in self.duplicate_nodes_to_remove:
            if hasattr(nodes.GenericNodeVisitor, 'visit_' + node):
                delattr(nodes.GenericNodeVisitor, 'visit_' + node)