dnmgmt/bin/markdown-to-html

23 lines
693 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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)
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)])