made initialisation/cleaning up modules in main a bit clearer
small readability fixes
moved prep work (perparing images, pagination) into separate exported method

... and made it callable in main.js

this is to make things slightly DRY-er and for testability
simplified test calling in makefile
initial work on writing tests for book module

- wrote tests for compilePdf and compileWebpage
- wrote pending tests for the compilePages method