diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-14 23:24:27 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-14 23:24:27 -0700 |
commit | 2a6e6324a6db7151a4bb103227893af47d61f84d (patch) | |
tree | 47be3b4bcf62545cbd5eacaf56fbb0e66b6ca426 /scripts/pandoc.py | |
parent | f5426b4905d14a8fea3ae7258ee3c19fc22d7391 (diff) | |
download | pandoc-2a6e6324a6db7151a4bb103227893af47d61f84d.tar.gz |
pandoc.py: Fixed bug for {}, removed rawInline, rawBlock.
Diffstat (limited to 'scripts/pandoc.py')
-rwxr-xr-x | scripts/pandoc.py | 31 |
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. |