public TubainaBuilder(ParseType type) {
this.parseType = type;
}
public void build() throws IOException {
TubainaModule module = parseType.getModule(data);
SectionsManager sectionsManager = module.getSectionsManager();
List<AfcFile> introductionAfcFiles = new ArrayList<AfcFile>();
ResourceLocator.initialize(inputDir);
List<AfcFile> afcFiles = getAfcsFrom(inputDir);
File introductionChapterDirs = new File(inputDir, "introduction");
if (introductionChapterDirs.exists()) {
introductionAfcFiles = getAfcsFrom(introductionChapterDirs);
}
BookBuilder builder = new BookBuilder(bookName, sectionsManager);
builder.addAllReaders(afcFiles, introductionAfcFiles);
Book b = null;
try {
b = builder.build();
} catch (TubainaException e) {
if (dontCare) {
LOG.warn(e);
} else {
throw e;
}
}
module.inject(b);
File file = new File(outputDir, parseType.getType());
FileUtils.forceMkdir(file);
File bibliographyFile = new File(inputDir, "bib.xml");
if (bibliographyFile.exists()) {