]> git.proxmox.com Git - mirror_frr.git/blame_incremental - render_md.py
debian: add pkg-config to build-depends
[mirror_frr.git] / render_md.py
... / ...
CommitLineData
1#!/usr/bin/env python
2# written 2016 by David Lamparter, placed in Public Domain.
3import sys, markdown
4
5template = '''<html><head><meta charset="UTF-8"><style type="text/css">
6body { max-width: 45em; margin: auto; margin-top: 2em; margin-bottom: 2em;
7 font-family:Fira Sans,sans-serif; text-align: justify;
8 counter-reset: ch2; }
9pre, code { font-family:Fira Mono,monospace; }
10pre > code { display: block; padding:0.5em; border:1px solid black;
11 background-color:#eee; color:#000; }
12h2:before { content: counter(ch2) ". "; counter-increment: ch2; }
13h2 { clear: both; margin-top: 3em; text-decoration: underline; counter-reset: ch3; }
14h3:before { content: counter(ch2) "." counter(ch3) ". "; counter-increment: ch3; }
15h3 { clear: both; margin-top: 2em; font-weight: normal; font-style: italic; }
16h4 { font-weight: normal; font-style: italic; }
17img[alt~="float-right"] { float:right; margin-left:2em; margin-bottom:2em; }
18</style></head><body>
19%s
20</body></html>
21'''
22
23md = markdown.Markdown(extensions=['extra', 'toc'])
24
25for fn in sys.argv[1:]:
26 with open(fn, 'r') as ifd:
27 with open('%s.html' % (fn), 'w') as ofd:
28 ofd.write((template % (md.convert(ifd.read().decode('UTF-8')))).encode('UTF-8'))