ResourceManipulatorFactory htmlResourceManipulatorFactory = new HtmlResourceManipulatorFactory();
TubainaHtmlDir bookRoot = new TubainaHtmlIO(templateDir, htmlResourceManipulatorFactory)
.createTubainaDir(directory, book);
List<String> dirTree = createDirTree(book, directory);
StringBuffer toc = new BookToTOC().generateTOC(book, cfg, dirTree, parser);
bookRoot.writeIndex(fixPaths(toc));
int chapterIndex = 1;
int currentDir = 1;
for (Chapter chapter : book.getChapters()) {
int curdir = currentDir++;