Initial commit: port buildhtml to Jinja, and a bit more