aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-08-14 23:24:27 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-08-14 23:24:27 -0700
commit2a6e6324a6db7151a4bb103227893af47d61f84d (patch)
tree47be3b4bcf62545cbd5eacaf56fbb0e66b6ca426
parentf5426b4905d14a8fea3ae7258ee3c19fc22d7391 (diff)
downloadpandoc-2a6e6324a6db7151a4bb103227893af47d61f84d.tar.gz
pandoc.py: Fixed bug for {}, removed rawInline, rawBlock.
-rwxr-xr-xscripts/pandoc.py31
1 files changed, 12 insertions, 19 deletions
diff --git a/scripts/pandoc.py b/scripts/pandoc.py
index 6d7f84b24..f21e9cc83 100755
--- a/scripts/pandoc.py
+++ b/scripts/pandoc.py
@@ -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.