Added scripts/deflists.py to filter examples.

This commit is contained in:
John MacFarlane 2013-08-16 20:57:34 -07:00
parent 89a7703260
commit caa89efc32
2 changed files with 21 additions and 0 deletions

View file

@ -121,6 +121,7 @@ Extra-Source-Files:
scripts/deemph.py,
scripts/myemph.py,
scripts/tikz.py,
scripts/deflists.py,
-- tests
tests/bodybg.gif,
tests/docbook-reader.docbook

20
scripts/deflists.py Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env python
"""
Pandoc filter to convert definition lists to bullet
lists with the defined terms in strong emphasis (for
compatibility with standard markdown).
"""
from pandoc import toJSONFilter
def deflists(key, value, format):
if key == 'DefinitionList':
return {'BulletList': [tobullet(t,d) for [t,d] in value]}
def tobullet(term, defs):
return [{'Para': [{'Strong': term}]}] + [b for d in defs for b in d]
if __name__ == "__main__":
toJSONFilter(deflists)