dnmgmt/bin/markdown-to-html

23 lines
693 B
Plaintext
Raw Permalink 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 = [
2019-05-30 22:10:55 +02:00
("templates/help/faq.md", "templates/help/faq.html"),
2017-04-07 14:44:34 +02:00
]
for srcFile, dstFile in files:
2019-05-30 22:10:55 +02:00
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)])
2017-04-07 14:44:34 +02:00