Cleanup

I've cleaned up various things in the package, such as:
- Added a `bin/test-fast` script, excluding the book PDF export tests which take a huge amount of time and make testing layer order more efficient
- Refactored some doctests into normal tests
- Fix invalid markup in TOC tree template
- pep8, dependencies and minor things

@maethu can you take a short look?