pandoc.py: Fixed bug for {}, removed rawInline, rawBlock.

This commit is contained in:
John MacFarlane 2013-08-14 23:24:27 -07:00
parent f5426b4905
commit 2a6e6324a6

View file

@ -18,15 +18,18 @@ def walk(x, action, format = ""):
array = []
for item in x:
if isinstance(item, dict):
for k in item:
res = action(k, item[k], format)
if res is None:
array.append(walk(item, action, format))
elif isinstance(res, list):
for z in res:
array.append(walk(z, action, format))
else:
array.append(walk(res, action, format))
if item == {}:
array.append(walk(item, action, format))
else:
for k in item:
res = action(k, item[k], format)
if res is None:
array.append(walk(item, action, format))
elif isinstance(res, list):
for z in res:
array.append(walk(z, action, format))
else:
array.append(walk(res, action, format))
else:
array.append(walk(item, action, format))
return array
@ -61,16 +64,6 @@ def toJSONFilter(action):
altered = walk(doc, action, format)
json.dump(altered, sys.stdout)
def rawInline(format, s):
"""Returns a 'RawInline' inline object.
"""
return {"RawInline": [{"unFormat": format}, s]}
def rawBlock(format, s):
"""Returns a 'RawBlock' inline object.
"""
return {"RawBlock": [{"unFormat": format}, s]}
def attributes(attrs):
"""Returns an attribute list, constructed from the
dictionary attrs.