No images in this repository’s iceberg at this time
Download raw (1.3 KB)
#! /usr/bin/env python2 # Copyright (C) 2015 Alexandre Leray # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Converts Markdown files to HTML # # Usage: # # ./generate.py infile.md outfile.html import jinja2 import os def doit(): """docstring for main""" templateLoader = jinja2.FileSystemLoader( searchpath="." ) templateEnv = jinja2.Environment( loader=templateLoader ) template = templateEnv.get_template( "toc.html") return template.render({}) if __name__ == '__main__': import argparse import sys parser = argparse.ArgumentParser() parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), default=sys.stdout) args = parser.parse_args() html = doit() args.outfile.write(html.encode("utf-8"))