]>
Commit | Line | Data |
---|---|---|
4765f35e | 1 | #!/usr/bin/env python |
47a3a827 | 2 | # SPDX-License-Identifier: NONE |
4765f35e DL |
3 | # written 2016 by David Lamparter, placed in Public Domain. |
4 | import sys, markdown | |
5 | ||
701a0192 | 6 | template = """<html><head><meta charset="UTF-8"><style type="text/css"> |
4765f35e | 7 | body { max-width: 45em; margin: auto; margin-top: 2em; margin-bottom: 2em; |
8793176b DL |
8 | font-family:Fira Sans,sans-serif; text-align: justify; |
9 | counter-reset: ch2; } | |
4765f35e DL |
10 | pre, code { font-family:Fira Mono,monospace; } |
11 | pre > code { display: block; padding:0.5em; border:1px solid black; | |
12 | background-color:#eee; color:#000; } | |
8793176b DL |
13 | h2:before { content: counter(ch2) ". "; counter-increment: ch2; } |
14 | h2 { clear: both; margin-top: 3em; text-decoration: underline; counter-reset: ch3; } | |
15 | h3:before { content: counter(ch2) "." counter(ch3) ". "; counter-increment: ch3; } | |
9b7939d9 | 16 | h3 { clear: both; margin-top: 2em; font-weight: normal; font-style: italic; } |
4765f35e | 17 | h4 { font-weight: normal; font-style: italic; } |
9b7939d9 | 18 | img[alt~="float-right"] { float:right; margin-left:2em; margin-bottom:2em; } |
4765f35e DL |
19 | </style></head><body> |
20 | %s | |
21 | </body></html> | |
701a0192 | 22 | """ |
4765f35e | 23 | |
701a0192 | 24 | md = markdown.Markdown(extensions=["extra", "toc"]) |
4765f35e DL |
25 | |
26 | for fn in sys.argv[1:]: | |
701a0192 | 27 | with open(fn, "r") as ifd: |
28 | with open("%s.html" % (fn), "w") as ofd: | |
29 | ofd.write( | |
30 | (template % (md.convert(ifd.read().decode("UTF-8")))).encode("UTF-8") | |
31 | ) |