Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f03c623

Browse files
committed
Update math_symbol_table directive to new Sphinx extension API
svn path=/trunk/matplotlib/; revision=7710
1 parent 5030f23 commit f03c623

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

doc/sphinxext/math_symbol_table.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
symbols = [
1+
nsymbols = [
22
["Lower-case Greek",
33
5,
44
r"""\alpha \beta \gamma \chi \delta \epsilon \eta \iota \kappa
@@ -128,27 +128,17 @@ def get_n(n, l):
128128
state_machine.insert_input(lines, "Symbol table")
129129
return []
130130

131-
try:
132-
from docutils.parsers.rst import Directive
133-
except ImportError:
134-
from docutils.parsers.rst.directives import _directives
131+
def setup(app):
135132
def math_symbol_table_directive(name, arguments, options, content, lineno,
136133
content_offset, block_text, state, state_machine):
137134
return run(state_machine)
138135
math_symbol_table_directive.arguments = None
139136
math_symbol_table_directive.options = {}
140137
math_symbol_table_directive.content = False
141-
_directives['math_symbol_table'] = math_symbol_table_directive
142-
else:
143-
class math_symbol_table_directive(Directive):
144-
has_content = False
145-
def run(self):
146-
return run(self.state_machine)
147-
from docutils.parsers.rst import directives
148-
directives.register_directive('math_symbol_table',
149-
math_symbol_table_directive)
138+
app.add_directive('math_symbol_table',
139+
math_symbol_table_directive)
150140

151-
if __name__ == "__main__":
141+
if __name__ == '__main__':
152142
# Do some verification of the tables
153143
from matplotlib import _mathtext_data
154144

0 commit comments

Comments
 (0)