From caa89efc32d0ebaa34eb9eb8dc110e9af8d6d051 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 16 Aug 2013 20:57:34 -0700 Subject: Added scripts/deflists.py to filter examples. --- pandoc.cabal | 1 + scripts/deflists.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 scripts/deflists.py diff --git a/pandoc.cabal b/pandoc.cabal index 352da4988..a3d0dfa83 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -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 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) -- cgit v1.2.3