Pull out theme-related logic into a Theme class.

The code that knows where the theme's files are is currently scattered across a few files. This change puts it all in its own class, which is (creatively) named Theme.

This change is a precursor to supporting multiple themes. Also, the simplified Templater code means it will be easier to support other templating languages, as hamlc isn't very suitable for generating JSON :)