Class ScmAttributesContextCustomizer

java.lang.Object
org.apache.maven.doxia.scm.siterenderer.ScmAttributesContextCustomizer
All Implemented Interfaces:
ContextCustomizer

@Singleton @Named("scmAttributes") public class ScmAttributesContextCustomizer extends Object implements ContextCustomizer
A ContextCustomizer that adds SCM attributes to the Velocity context for use in templates. It looks for an SCM repository in the directory of the site being rendered, and if found, retrieves SCM info for the file being rendered and adds it to the Velocity context. The SCM repository is lazily retrieved and cached in the SiteRenderingContext attributes for subsequent retrievals, so that it is only looked up once per site rendering. The SCM info is retrieved for each document being rendered, but only if an SCM repository was found for the site. The following attributes are added to the Velocity context:
  • "scmModifiedDate": the last modification date of the file being rendered according to SCM, as a Date (if available)
  • "scmModifiedAuthor": the author of the last modification of the file being rendered according to SCM, as a String (if available)
Since:
2.1.0
  • Method Details

    • customizeContext

      public void customizeContext(org.apache.velocity.context.Context context, DocumentRenderingContext docRenderingContext, SiteRenderingContext siteRenderingContext)
      Description copied from interface: ContextCustomizer
      Customize the Velocity context before rendering a document.
      Specified by:
      customizeContext in interface ContextCustomizer
      Parameters:
      context - the Velocity context to customize.
      docRenderingContext - the document rendering context for the document being rendered.
      siteRenderingContext - the site rendering context for the site being rendered.