hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 1 | #!/usr/bin/python2.7 |
| 2 | |
| 3 | import os |
| 4 | |
| 5 | html_dir = "../doc/html_generated/" |
| 6 | md_dir = "../doc/markdown/" |
| 7 | |
| 8 | filelist = [f for f in os.listdir(html_dir) if f.endswith(".html")] |
| 9 | for f in filelist: |
| 10 | os.remove(html_dir + f) |
| 11 | |
| 12 | for filename in os.listdir(md_dir): |
| 13 | if filename[-2:] == "md": |
| 14 | md = open(md_dir + filename, "r") |
| 15 | md_contents = md.read() |
| 16 | md.close() |
| 17 | html = open(html_dir + filename[:-3] + ".html", "w") |
| 18 | html.write('<!DOCTYPE html>\n') |
| 19 | html.write('<html>\n') |
| 20 | html.write('<title>' + filename[:-3] + '</title>\n') |
| 21 | html.write('<xmp theme="united" style="display:none;">\n\n') |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 22 | md_contents = md_contents.replace(".md", ".html") |
| 23 | md_contents = md_contents.replace("```c++", "```") |
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 24 | html.write(md_contents) |
| 25 | html.write('\n\n</xmp>\n') |
| 26 | html.write('<script src="strapdown.js/strapdown.js"></script>\n') |
| 27 | html.write('</html>\n') |
| 28 | html.close() |