summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-ext-math-compat/conf.py
blob: 85e3950a5d044fb57d395a23691625b1ee8414d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from docutils import nodes
from docutils.parsers.rst import Directive

extensions = ['sphinx.ext.mathjax']


def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
    text = 'E = mc^2'
    return [nodes.math(text, text)], []


class MyMathDirective(Directive):
    def run(self):
        text = 'E = mc^2'
        return [nodes.math_block(text, text)]


def setup(app):
    app.add_role('my_math', my_math_role)
    app.add_directive('my-math', MyMathDirective)