From 2a6e6324a6db7151a4bb103227893af47d61f84d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 14 Aug 2013 23:24:27 -0700 Subject: pandoc.py: Fixed bug for {}, removed rawInline, rawBlock. --- scripts/pandoc.py | 31 ++++++++++++------------------- 1 file 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. -- cgit v1.2.3