in src/main/java/org/apache/maven/doxia/book/services/indexer/DefaultBookIndexer.java [105:145]
private void indexSection( BookContext bookContext, IndexEntry chapterEntry, Section section )
throws BookDoxiaException
{
BookContext.BookFile bookFile = (BookContext.BookFile) bookContext.getFiles().get( section.getId() );
if ( bookFile == null )
{
throw new BookDoxiaException( "No document that matches section with id="
+ section.getId() + "." );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
IndexEntry sectionEntry = new IndexEntry( chapterEntry, section.getId() );
IndexingSink sink = new IndexingSink( sectionEntry );
try
{
doxia.parse( new FileReader( bookFile.getFile() ), 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 );
}
sectionEntry.setTitle( sink.getTitle() );
}