Remove pandoc toolchain.
This commit is contained in:
parent
40c4242d30
commit
a40425ab08
3 changed files with 0 additions and 75 deletions
|
|
@ -1,9 +0,0 @@
|
|||
#!/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
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
"""
|
||||
Pandoc filter that changes pandoc default HTML output for codeblocks
|
||||
to match SWIG's format:
|
||||
|
||||
<div class="...">
|
||||
<pre>...</pre>
|
||||
</div>
|
||||
|
||||
"""
|
||||
|
||||
from pandocfilters import toJSONFilter, stringify, walk, RawBlock, Div, Str
|
||||
import sys
|
||||
import json
|
||||
import re
|
||||
|
||||
def html(x):
|
||||
return RawBlock('html', x)
|
||||
|
||||
SHELL = re.compile(r"\s*[$]")
|
||||
the_title = ""
|
||||
|
||||
def codeblocks(key, value, format, meta):
|
||||
if key == 'CodeBlock':
|
||||
[[id, classes, kvs], contents] = value
|
||||
|
||||
newcontents = [html('<pre>\n' + contents + '</pre>')]
|
||||
|
||||
if len(classes) == 0:
|
||||
if contents.startswith("$"):
|
||||
classes.append("shell")
|
||||
else:
|
||||
classes.append("code")
|
||||
|
||||
return Div([id, classes, kvs], newcontents)
|
||||
if key == 'Header':
|
||||
if value[0] == 1:
|
||||
the_title = stringify(value)
|
||||
value[1][0] = ""
|
||||
|
||||
def set_title(unMeta):
|
||||
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)
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="./style.css">
|
||||
<title>$pagetitle$</title>
|
||||
</head>
|
||||
<body>
|
||||
$body$
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue