Class TemplateEngines


  • public class TemplateEngines
    extends java.lang.Object

    A singleton class giving access to rendering engines. Rendering engines are loaded based on classpath. New rendering may be registered either at runtime (not recommanded) or by putting a descriptor file on classpath (recommanded).

    The descriptor file must be found in META-INF directory and named org.jbake.parser.TemplateEngines.properties. The format of the file is easy:

    org.jbake.parser.FreeMarkerRenderer=ftl
    org.jbake.parser.GroovyRenderer=groovy,gsp

    where the key is the class of the engine (must extend AbstractTemplateEngine and have a 4-arg constructor and the value is a comma-separated list of file extensions that this engine is capable of proceeding.

    Rendering engines are singletons, so are typically used to initialize the underlying template engines.

    This class loads the engines only if they are found on classpath. If not, the engine is not registered. This allows JBake to support multiple rendering engines without the explicit need to have them on classpath. This is a better fit for embedding.

    • Method Detail

      • getRecognizedExtensions

        public java.util.Set<java.lang.String> getRecognizedExtensions()