Mostly done with the HTML writer.

writeDocument and writeFootnote to go.