// ----------------------------------------------------------------------
// Data objects
// ----------------------------------------------------------------------
RenderingContext renderingContext = sink.getRenderingContext();
context.put( "relativePath", renderingContext.getRelativePath() );
// Add infos from document
context.put( "authors", sink.getAuthors() );
context.put( "shortTitle", sink.getTitle() );
// DOXIASITETOOLS-70: Prepend the project name to the title, if any
String title = "";
if ( siteRenderingContext.getDecoration() != null
&& siteRenderingContext.getDecoration().getName() != null )
{
title = siteRenderingContext.getDecoration().getName();
}
else if ( siteRenderingContext.getDefaultWindowTitle() != null )
{
title = siteRenderingContext.getDefaultWindowTitle();
}
if ( title.length() > 0 )
{
title += " - ";
}
title += sink.getTitle();
context.put( "title", title );
context.put( "headContent", sink.getHead() );
context.put( "bodyContent", sink.getBody() );
context.put( "decoration", siteRenderingContext.getDecoration() );
SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd" );
if ( StringUtils.isNotEmpty( sink.getDate() ) )
{
try
{
// we support only ISO-8601 date
context.put( "dateCreation",
sdf.format( new SimpleDateFormat( "yyyy-MM-dd" ).parse( sink.getDate() ) ) );
}
catch ( java.text.ParseException e )
{
getLogger().debug( "Could not parse date: " + sink.getDate() + ", ignoring!", e );
}
}
context.put( "dateRevision", sdf.format( new Date() ) );
context.put( "currentDate", new Date() );
context.put( "publishDate", siteRenderingContext.getPublishDate() );
Locale locale = siteRenderingContext.getLocale();
DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.DEFAULT, locale );
if ( siteRenderingContext.getDecoration().getPublishDate() != null )
{
if ( StringUtils.isNotBlank( siteRenderingContext.getDecoration().getPublishDate().getFormat() ) )
{
dateFormat =
new SimpleDateFormat( siteRenderingContext.getDecoration().getPublishDate().getFormat(), locale );
}
}
context.put( "dateFormat", dateFormat );
String currentFileName = renderingContext.getOutputName().replace( '\\', '/' );
context.put( "currentFileName", currentFileName );
context.put( "alignedFileName", PathTool.calculateLink( currentFileName, renderingContext.getRelativePath() ) );
context.put( "locale", locale );
context.put( "supportedLocales", Collections.unmodifiableList( siteRenderingContext.getSiteLocales() ) );
InputStream inputStream = null;