use of org.geometerplus.fbreader.bookmodel.BookModel in project FBReaderJ by geometer.
the class TestFB2Reader method writeTextModelDumpToFile.
private void writeTextModelDumpToFile(String inputFile, String outputFile) {
BookModel bookModel = new BookModel(inputFile);
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getBookTextModel();
writeDumpToFile(model, outputFile);
}
use of org.geometerplus.fbreader.bookmodel.BookModel in project FBReaderJ by geometer.
the class TestFB2Reader method testEndOfSectionParagraph.
public void testEndOfSectionParagraph() {
BookModel bookModel = new BookModel(myDirectory + "section.fb2");
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getBookTextModel();
assertEquals(model.getParagraph(1).getKind(), ZLTextParagraph.Kind.END_OF_SECTION_PARAGRAPH);
}
use of org.geometerplus.fbreader.bookmodel.BookModel in project FBReaderJ by geometer.
the class TestFB2Reader method testStanzaParagraphKinds.
public void testStanzaParagraphKinds() {
BookModel bookModel = new BookModel(myDirectory + "stanza.fb2");
new FB2Reader(bookModel).read();
ZLTextModel model = bookModel.getBookTextModel();
assertEquals(model.getParagraph(0).getKind(), ZLTextParagraph.Kind.BEFORE_SKIP_PARAGRAPH);
assertEquals(model.getParagraph(2).getKind(), ZLTextParagraph.Kind.AFTER_SKIP_PARAGRAPH);
assertEquals(model.getParagraph(1).getKind(), ZLTextParagraph.Kind.TEXT_PARAGRAPH);
}
use of org.geometerplus.fbreader.bookmodel.BookModel in project FBReaderJ by geometer.
the class TestFB2Reader method testTreeParagraphRef.
public void testTreeParagraphRef() {
BookModel bookModel = new BookModel(myDirectory + "tree1.fb2");
new FB2Reader(bookModel).read();
ContentsModel model = bookModel.getContentsModel();
assertTrue(model.getReference((ZLTextTreeParagraph) model.getParagraph(0)) == 0);
}
use of org.geometerplus.fbreader.bookmodel.BookModel in project FBReaderJ by geometer.
the class OEBNativePlugin method readModel.
@Override
public void readModel(BookModel model) throws BookReadingException {
final ZLFile file = BookUtil.fileByBook(model.Book);
file.setCached(true);
try {
super.readModel(model);
model.setLabelResolver(new BookModel.LabelResolver() {
public List<String> getCandidates(String id) {
final int index = id.indexOf("#");
return index > 0 ? Collections.<String>singletonList(id.substring(0, index)) : Collections.<String>emptyList();
}
});
} finally {
file.setCached(false);
}
}
Aggregations