diff --git a/Doc/Manual/pandoc_filter.py b/Doc/Manual/pandoc_filter.py new file mode 100755 index 000000000..81b259936 --- /dev/null +++ b/Doc/Manual/pandoc_filter.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +""" +Pandoc filter that changes pandoc default HTML output for codeblocks +to match SWIG's format: + +
...+
\n' + contents + '')] + + if contents.startswith("$"): + classes.append("shell") + + if len(classes) == 0: + classes.append("code") + + return Div([id, classes, kvs], newcontents) + if key == 'Header': + if value[0] == 1: + global the_title + the_title = stringify(value) + value[1][0] = "" + +def set_title(unMeta): + global the_title + unMeta["title"] = {"t": "MetaInlines", "c": [Str(the_title)]} + +def __toJSONFilter(action): + doc = json.loads(sys.stdin.read()) + if len(sys.argv) > 1: + format = sys.argv[1] + else: + format = "" + altered = walk(doc, action, format, doc[0]['unMeta']) + set_title(altered[0]['unMeta']) + json.dump(altered, sys.stdout) + +if __name__ == "__main__": + __toJSONFilter(codeblocks) diff --git a/Doc/Manual/pandoc_template.html b/Doc/Manual/pandoc_template.html index 390bfc51c..d8cbc12ad 100644 --- a/Doc/Manual/pandoc_template.html +++ b/Doc/Manual/pandoc_template.html @@ -1,56 +1,10 @@ - - + + - - - -$for(author-meta)$ - -$endfor$ -$if(date-meta)$ - -$endif$ -