git.iko.soy/typeable/pandoc
on master help sign in
Added scripts/deflists.py to filter examples.
commitcaa89efc32d0ebaa34eb9eb8dc110e9af8d6d051 authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 16 Aug 2013, 20:57 (13 years ago) parent89a7703
2 files changed+21
pandoc.cabal+1 scripts/deflists.py+20
pandoc.cabal+1
@@ -121,6 +121,7 @@ Extra-Source-Files:
121121 scripts/deemph.py,
122122 scripts/myemph.py,
123123 scripts/tikz.py,
124+ scripts/deflists.py,
124125 -- tests
125126 tests/bodybg.gif,
126127 tests/docbook-reader.docbook
scripts/deflists.pynew file+20
@@ -0,0 +1,20 @@
1+#!/usr/bin/env python
2+
3+"""
4+Pandoc filter to convert definition lists to bullet
5+lists with the defined terms in strong emphasis (for
6+compatibility with standard markdown).
7+"""
8+
9+from pandoc import toJSONFilter
10+
11+def deflists(key, value, format):
12+ if key == 'DefinitionList':
13+ return {'BulletList': [tobullet(t,d) for [t,d] in value]}
14+
15+def tobullet(term, defs):
16+ return [{'Para': [{'Strong': term}]}] + [b for d in defs for b in d]
17+
18+
19+if __name__ == "__main__":
20+ toJSONFilter(deflists)