diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-12-01 17:24:03 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2016-12-01 17:24:03 +0100 |
| commit | 0577b824e137f143c899a567b1bbeb109841c796 (patch) | |
| tree | 7f65fa702d5598452fe8a5f7a48fb8d80a14f875 /render_md.py | |
| parent | 0d4aa1b1864dc8f7cc8a210c15b0302f14f0dcb9 (diff) | |
| parent | db2d8df649d1e8ed26f28eb04bbd6fe3768a17cc (diff) | |
Merge branch 'stable/2.0'
Diffstat (limited to 'render_md.py')
| -rw-r--r-- | render_md.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/render_md.py b/render_md.py new file mode 100644 index 0000000000..d2d1fb4805 --- /dev/null +++ b/render_md.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# written 2016 by David Lamparter, placed in Public Domain. +import sys, markdown + +template = '''<html><head><meta charset="UTF-8"><style type="text/css"> +body { max-width: 45em; margin: auto; margin-top: 2em; margin-bottom: 2em; + font-family:Fira Sans,sans-serif; text-align: justify; } +pre, code { font-family:Fira Mono,monospace; } +pre > code { display: block; padding:0.5em; border:1px solid black; + background-color:#eee; color:#000; } +h2 { clear: both; margin-top: 3em; text-decoration: underline; } +h3 { clear: both; margin-top: 2em; font-weight: normal; font-style: italic; } +h4 { font-weight: normal; font-style: italic; } +img[alt~="float-right"] { float:right; margin-left:2em; margin-bottom:2em; } +</style></head><body> +%s +</body></html> +''' + +md = markdown.Markdown(extensions=['extra', 'toc']) + +for fn in sys.argv[1:]: + with open(fn, 'r') as ifd: + with open('%s.html' % (fn), 'w') as ofd: + ofd.write((template % (md.convert(ifd.read().decode('UTF-8')))).encode('UTF-8')) |
