aboutsummaryrefslogtreecommitdiff
path: root/scripts/myemph.py
blob: e527a0b2eb700a44b638401be1fef7f4c7fae751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python
from pandoc import toJSONFilter, rawInline

"""
Pandoc filter that causes emphasis to be rendered using
the custom macro '\myemph{...}' rather than '\emph{...}'
in latex.  Other output formats are unaffected.
"""

def myemph(k, v, f):
  if k == 'Emph' and f == 'latex':
    return [rawInline("latex", "\\myemph{")] + v + [rawInline("latex","}")]

if __name__ == "__main__":
  toJSONFilter(myemph)