in src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java [86:143]
public void loadFiles( BookContext context, List<File> files )
{
// ----------------------------------------------------------------------
// Find all the files, map the file names to ids
// ----------------------------------------------------------------------
Collection<SiteModule> siteModules = siteModuleManager.getSiteModules();
for ( SiteModule siteModule : siteModules )
{
String extension = siteModule.getExtension();
String sourceDirectory = File.separator + siteModule.getSourceDirectory() + File.separator;
String parserId = siteModule.getParserId();
for ( File file : files )
{
String name = file.getName();
String path = file.getAbsolutePath();
// first check if the file path contains one of the recognized source dir identifiers
// (there's trouble if a pathname contains 2 identifiers), then match file extensions (not unique).
if ( path.indexOf( sourceDirectory ) != -1 )
{
name = name.substring( 0, name.length() - extension.length() - 1 );
context.getFiles().put( name, new BookContext.BookFile( file, parserId ) );
}
else if ( name.endsWith( extension ) )
{
name = name.substring( 0, name.length() - extension.length() - 1 );
// don't overwrite if it's there already
if ( !context.getFiles().containsKey( name ) )
{
context.getFiles().put( name, new BookContext.BookFile( file, parserId ) );
}
}
}
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Dumping document <-> id mapping:" );
Map<String, BookContext.BookFile> map = new TreeMap<String, BookContext.BookFile>( context.getFiles() );
for ( Map.Entry<String, BookContext.BookFile> entry : map.entrySet() )
{
BookContext.BookFile file = entry.getValue();
getLogger().debug( " " + entry.getKey() + "=" + file.getFile() + ", parser: " + file.getParserId() );
}
}
}