#!/usr/bin/env python3 """A simple blog generator with Pandoc as backend.""" # TODO: auto retouch: prompt for git commit amend after touching # (display commit message to avoid amending the wrong commit) # pylint: disable=too-many-lines import argparse from contextlib import contextmanager import copy import curses import datetime import email.utils import fileinput import io import http.client import http.server import multiprocessing import os import re import shutil import signal import string import subprocess import sys import tempfile import time import urllib.parse import blessed import bs4 import colorama import dateutil.parser import dateutil.tz import lxml.etree as ET from bs4 import UnicodeDammit from pprint import pprint import requests import toml from rss import * from utils import utils from config.config import * from generators import generators def generate_index(feed): """Generate index.html from index.md and a TOC.""" sys.stderr.write("generating index.html\n") # generate TOC tocbuff = io.StringIO() tocbuff.write('
# | [Blah blah](/blog/2015-05-04-blah-blah.html) | #
' ' | [%s](%s) |