Fix pandoc filter.

And add a script that helps to run pandoc with appropriate
command line flags.
This commit is contained in:
Oliver Buchtala 2014-03-04 22:51:19 +01:00
commit 924f373a2f
2 changed files with 18 additions and 9 deletions

9
Doc/Manual/markdown_to_html.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
if [ "$1" == "" ]; then
echo "Usage: markdown_to_html <Language>"
echo "-- Example: markdown_to_html Javascript"
else
pandoc -f markdown -t json $1.md | ./pandoc_filter.py | pandoc -f json -t html -s --template pandoc_template.html -o $1.html
fi

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
""" """
Pandoc filter that changes pandoc default HTML output for codeblocks Pandoc filter that changes pandoc default HTML output for codeblocks
@ -24,7 +24,7 @@ the_title = ""
def codeblocks(key, value, format, meta): def codeblocks(key, value, format, meta):
if key == 'CodeBlock': if key == 'CodeBlock':
[[id, classes, kvs], contents] = value [[id, classes, kvs], contents] = value
if format == "html" or format == "html5":
newcontents = [html('<pre>\n' + contents + '</pre>')] newcontents = [html('<pre>\n' + contents + '</pre>')]
if len(classes) == 0: if len(classes) == 0: