Refactoring and tests for spine and guide generation for EPUB.