Add template building

First pass of code to generate the html files. It's split into two sections - one to generate the html that will be inserted into the html template, and another that does the insertion and saving of the files.