Class SpincastPebbleTemplatingEngine

java.lang.Object
org.spincast.plugins.pebble.SpincastPebbleTemplatingEngine
All Implemented Interfaces:
TemplatingEngine

public class SpincastPebbleTemplatingEngine extends Object implements TemplatingEngine
Pebble Html template engine
  • Field Details

    • logger

      protected static final org.slf4j.Logger logger
    • PEBBLE_PARAMS_AS_JSONOBJECT

      public static final String PEBBLE_PARAMS_AS_JSONOBJECT
  • Constructor Details

  • Method Details

    • getSpincastConfig

      protected SpincastConfig getSpincastConfig()
    • getSpincastPebbleTemplatingEngineConfig

      protected SpincastPebbleTemplatingEngineConfig getSpincastPebbleTemplatingEngineConfig()
    • getExtensions

      protected Set<com.mitchellbosecke.pebble.extension.Extension> getExtensions()
    • getJsonManager

      protected JsonManager getJsonManager()
    • getPebbleEngineString

      protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineString()
    • getPebbleEngineTemplateClasspath

      protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateClasspath()
    • getPebbleEngineTemplateFileSystem

      protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateFileSystem()
    • addCommonLoaderFeatures

      protected void addCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder)
    • getClasspathTemplateLoader

      protected com.mitchellbosecke.pebble.loader.Loader<String> getClasspathTemplateLoader()
    • getFileSystemTemplateLoader

      protected com.mitchellbosecke.pebble.loader.Loader<String> getFileSystemTemplateLoader()
    • evaluate

      public String evaluate(String content)
      Description copied from interface: TemplatingEngine
      Evaluates the content, without parameters.

      Uses the default Locale.

      Specified by:
      evaluate in interface TemplatingEngine
    • evaluate

      public String evaluate(String content, JsonObject jsonObject)
      Description copied from interface: TemplatingEngine
      Evaluates the content, using the given parameters. specified as a JsonObject. Uses the default Locale.
      Specified by:
      evaluate in interface TemplatingEngine
    • evaluate

      public String evaluate(String content, JsonObject jsonObject, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates the content, using the given parameters. specified as a JsonObject. Uses the specified Locale.
      Specified by:
      evaluate in interface TemplatingEngine
    • evaluate

      public String evaluate(String content, Map<String,Object> params)
      Description copied from interface: TemplatingEngine
      Evaluates the content, using the given parameters. Uses the default Locale.
      Specified by:
      evaluate in interface TemplatingEngine
    • evaluate

      public String evaluate(String content, Map<String,Object> params, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates the content, using the given parameters. Uses the specified Locale.
      Specified by:
      evaluate in interface TemplatingEngine
    • fromTemplate

      public String fromTemplate(String templatePath, JsonObject jsonObject)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the parameters specified as a JsonObject. Uses the default Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      public String fromTemplate(String templatePath, JsonObject jsonObject, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the parameters specified as a JsonObject. Uses the specified Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      public String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the parameters specified as a JsonObject. Uses the default Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      public String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the parameters specified as a JsonObject. Uses the specified Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      public String fromTemplate(String templatePath, Map<String,Object> params)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the given parameters. Uses the default Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      public String fromTemplate(String templatePath, Map<String,Object> params, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the given parameters. Uses the specified Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the given parameters. Uses the default Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params, Locale locale)
      Description copied from interface: TemplatingEngine
      Evaluates a template using the given parameters. Uses the specified Locale.
      Specified by:
      fromTemplate in interface TemplatingEngine
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • parse

      protected String parse(String htmlOrPath, JsonObject paramsAsJsonObject, Map<String,Object> params, boolean isTemplate, boolean isClasspathPath, Locale locale)
    • createPlaceholder

      public String createPlaceholder(String variable)
      Description copied from interface: TemplatingEngine
      Creates a placeholder using the current templating engine implementation.

      This is mainly useful for the tests, which don't know in advance which templating engine will be used, so which syntax to use for the placeholders.

      For example, using Pebble, a call to createPlaceholder("name") will result in "{{name}}" (without the quotes).

      Specified by:
      createPlaceholder in interface TemplatingEngine