{
String include = (String)params.get( PARAM_INCLUDE );
String exclude = (String)params.get( PARAM_EXCLUDE );
List<String> pages;
div masterDiv = new div();
masterDiv.setClass( "index" );
div indexDiv = new div();
masterDiv.addElement( indexDiv );
indexDiv.setClass( "header" );
try
{
pages = listPages( context, include, exclude );
context.getEngine().getPageSorter().sort( pages );
char initialChar = ' ';
div currentDiv = new div();
for( String name : pages )
{
if( name.charAt( 0 ) != initialChar )
{
if( initialChar != ' ' ) indexDiv.addElement( " - " );
initialChar = name.charAt( 0 );
masterDiv.addElement( makeHeader(initialChar) );
currentDiv = new div();
currentDiv.setClass("body");
masterDiv.addElement( currentDiv );
indexDiv.addElement( "<a href='#"+initialChar+"'>"+initialChar+"</a>" );
}
else
{
currentDiv.addElement( ", " );
}
String link = "<a href='"+
context.getURL( WikiContext.VIEW, name )+
"'>"+name+"</a>";
currentDiv.addElement( link );
}
}
catch( ProviderException e )
{
log.warn("Could not load page index",e);