summaryrefslogtreecommitdiffstats
path: root/render_md.py
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-11-29 10:44:17 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-11-29 12:27:06 +0100
commit4765f35eb0463b08cfdd2b58c9ecf821d358a18a (patch)
tree6c479a580079b32ea38782e616f44f40dfdf74be /render_md.py
parentbuild: add markdown-ised version of new guidelines (diff)
downloadfrr-4765f35eb0463b08cfdd2b58c9ecf821d358a18a.tar.xz
frr-4765f35eb0463b08cfdd2b58c9ecf821d358a18a.zip
build: improve COMMUNITY.md formatting
Add a render_md.py helper to convert it to HTML (needs python "markdown" module installed). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'render_md.py')
-rw-r--r--render_md.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/render_md.py b/render_md.py
new file mode 100644
index 000000000..a819c784e
--- /dev/null
+++ b/render_md.py
@@ -0,0 +1,24 @@
+#!/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 { margin-top: 3em; text-decoration: underline; }
+h3 { margin-top: 2em; font-weight: normal; font-style: italic; }
+h4 { font-weight: normal; font-style: italic; }
+</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'))