Major rework of the sphinx template.
I'm committing this as a separate directory because I changed way too much of the original code and I want to make sure others can have a look before removing the old code.