this repo has no description
1def setup(app):
2 app.add_directive('defblock', DefBlockDirective)
3
4 return {'version': '0.1'} # identifies the version of our extension
5
6from docutils import nodes
7
8from docutils.parsers.rst.directives.admonitions import BaseAdmonition
9
10from sphinx.locale import _
11
12class DefBlockDirective(BaseAdmonition):
13
14 # title of the defblock
15 required_arguments = 1
16 optional_arguments = 100
17 # this enables content in the directive
18 has_content = True
19 node_class = nodes.admonition
20
21 def run(self):
22 env = self.state.document.settings.env
23
24 self.arguments = [' '.join(self.arguments)]
25
26 targetid = "defblock-%d" % env.new_serialno('defblock')
27 targetnode = nodes.target('', '', ids=[targetid], title="bla")
28
29 ad = super(DefBlockDirective, self).run()
30
31 return [targetnode] + ad