summaryrefslogtreecommitdiff
path: root/sandbox/cben/rolehack/mathhack.py
blob: 0a02f231c9eb75b3213669b584010906c91ee35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
"""
.. epigraph::

    Using ``raw`` is almost always evidence of a hack in progress.  It's not a
    clean solution.

    -- David Goodger.

Convert the default and ``texmath`` role to raw latex inline math and the
``texmath`` directive to display math.
"""

from rolehack import *

texmath = template('''\
raw:: latex

    $''', '$\n')

texdisplay = template('''\
raw:: latex

    \[ ''', ' \]\n')

main({'texmath': texmath}, texmath,
     {'texmath': texdisplay})