mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-26 17:35:49 +00:00
Added scripts/deflists.py to filter examples.
This commit is contained in:
@@ -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
|
||||
|
||||
Executable
+20
@@ -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)
|
||||
Reference in New Issue
Block a user