Add missing API docs and specs. Some formatting cleanup. Groundwork for {% block %} and {% extends %} which remain very much incomplete.