diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-16 20:57:34 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-16 20:57:34 -0700 |
commit | caa89efc32d0ebaa34eb9eb8dc110e9af8d6d051 (patch) | |
tree | b2c6415fb575ebbd69c8db89041c0a50e2b61d33 /scripts/deflists.py | |
parent | 89a7703260703599a033be16e1581a0494326c2b (diff) | |
download | pandoc-caa89efc32d0ebaa34eb9eb8dc110e9af8d6d051.tar.gz |
Added scripts/deflists.py to filter examples.
Diffstat (limited to 'scripts/deflists.py')
-rwxr-xr-x | scripts/deflists.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/deflists.py b/scripts/deflists.py new file mode 100755 index 000000000..502963419 --- /dev/null +++ b/scripts/deflists.py @@ -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) |