in src/main/java/org/apache/maven/doxia/book/services/renderer/AbstractITextBookRenderer.java [229:278]
private void renderSection( Sink sink, PrettyPrintXMLWriter writer, Section section, BookContext context )
throws BookDoxiaException
{
// writer.startElement( "section" );
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
BookContext.BookFile bookFile = (BookContext.BookFile) context.getFiles().get( section.getId() );
if ( bookFile == null )
{
throw new BookDoxiaException( "No document that matches section with id=" + section.getId() + "." );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
Reader reader = null;
try
{
reader = ReaderFactory.newReader( bookFile.getFile(), context.getInputEncoding() );
doxia.parse( reader, bookFile.getParserId(), sink );
}
catch ( ParserNotFoundException e )
{
throw new BookDoxiaException( "Parser not found: " + bookFile.getParserId() + ".", e );
}
catch ( ParseException e )
{
throw new BookDoxiaException(
"Error while parsing document: " + bookFile.getFile().getAbsolutePath() + ".",
e );
}
catch ( FileNotFoundException e )
{
throw new BookDoxiaException( "Could not find document: " + bookFile.getFile().getAbsolutePath() + ".", e );
}
catch ( IOException e )
{
throw new BookDoxiaException( "Error while rendering book: "
+ bookFile.getFile().getAbsolutePath() + ".", e );
}
finally
{
IOUtil.close( reader );
}
}