dnmgmt/bin/markdown-to-html

23 lines
681 B
Plaintext
Raw Normal View History

2017-04-07 14:44:34 +02:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
2018-01-19 13:28:01 +01:00
# This file is part of dnmgmt, a number resource management system
# Licensed under GNU General Public License v3 or later
# Written by Sebastian Lohff (seba@someserver.de)
2017-04-07 14:44:34 +02:00
import markdown
from markdown.extensions.toc import TocExtension
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
files = [
("templates/help/faq.md", "templates/help/faq.html"),
]
for srcFile, dstFile in files:
srcFile = os.path.join(BASE_DIR, srcFile)
dstFile = os.path.join(BASE_DIR, dstFile)
markdown.markdownFromFile(open(srcFile, "rb"), open(dstFile, "wb"), extensions=[TocExtension(baselevel=1, permalink=True)])