Package org.spincast.plugins.pebble
Class SpincastPebbleTemplatingEngine
java.lang.Object
org.spincast.plugins.pebble.SpincastPebbleTemplatingEngine
- All Implemented Interfaces:
TemplatingEngine
Pebble Html template engine
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpincastPebbleTemplatingEngine(SpincastConfig spincastConfig, SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig, Set<com.mitchellbosecke.pebble.extension.Extension> extensions, JsonManager jsonManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder) createPlaceholder(String variable) Creates a placeholder using the current templating engine implementation.Evaluates the content, without parameters.Evaluates the content, using the given parameters.Evaluates the content, using the given parameters.evaluate(String content, JsonObject jsonObject) Evaluates the content, using the given parameters.evaluate(String content, JsonObject jsonObject, Locale locale) Evaluates the content, using the given parameters.fromTemplate(String templatePath, boolean isClasspathPath, Map<String, Object> params) Evaluates a template using the given parameters.fromTemplate(String templatePath, boolean isClasspathPath, Map<String, Object> params, Locale locale) Evaluates a template using the given parameters.fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject) Evaluates a template using the parameters specified as aJsonObject.fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale) Evaluates a template using the parameters specified as aJsonObject.fromTemplate(String templatePath, Map<String, Object> params) Evaluates a template using the given parameters.Evaluates a template using the given parameters.fromTemplate(String templatePath, JsonObject jsonObject) Evaluates a template using the parameters specified as aJsonObject.fromTemplate(String templatePath, JsonObject jsonObject, Locale locale) Evaluates a template using the parameters specified as aJsonObject.protected com.mitchellbosecke.pebble.loader.Loader<String>protected Set<com.mitchellbosecke.pebble.extension.Extension>protected com.mitchellbosecke.pebble.loader.Loader<String>protected JsonManagerprotected com.mitchellbosecke.pebble.PebbleEngineprotected com.mitchellbosecke.pebble.PebbleEngineprotected com.mitchellbosecke.pebble.PebbleEngineprotected SpincastConfigprotected SpincastPebbleTemplatingEngineConfigprotected Stringparse(String htmlOrPath, JsonObject paramsAsJsonObject, Map<String, Object> params, boolean isTemplate, boolean isClasspathPath, Locale locale)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
PEBBLE_PARAMS_AS_JSONOBJECT
-
-
Constructor Details
-
SpincastPebbleTemplatingEngine
@Inject public SpincastPebbleTemplatingEngine(SpincastConfig spincastConfig, SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig, Set<com.mitchellbosecke.pebble.extension.Extension> extensions, JsonManager jsonManager)
-
-
Method Details
-
getSpincastConfig
-
getSpincastPebbleTemplatingEngineConfig
-
getExtensions
-
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
-
getFileSystemTemplateLoader
-
evaluate
Description copied from interface:TemplatingEngineEvaluates the content, without parameters.Uses the default Locale.
- Specified by:
evaluatein interfaceTemplatingEngine
-
evaluate
Description copied from interface:TemplatingEngineEvaluates the content, using the given parameters. specified as aJsonObject. Uses the default Locale.- Specified by:
evaluatein interfaceTemplatingEngine
-
evaluate
Description copied from interface:TemplatingEngineEvaluates the content, using the given parameters. specified as aJsonObject. Uses the specified Locale.- Specified by:
evaluatein interfaceTemplatingEngine
-
evaluate
Description copied from interface:TemplatingEngineEvaluates the content, using the given parameters. Uses the default Locale.- Specified by:
evaluatein interfaceTemplatingEngine
-
evaluate
Description copied from interface:TemplatingEngineEvaluates the content, using the given parameters. Uses the specified Locale.- Specified by:
evaluatein interfaceTemplatingEngine
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the parameters specified as aJsonObject. Uses the default Locale.- Specified by:
fromTemplatein interfaceTemplatingEngine- Parameters:
templatePath- must be a classpath's relative path.
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the parameters specified as aJsonObject. Uses the specified Locale.- Specified by:
fromTemplatein interfaceTemplatingEngine- Parameters:
templatePath- must be a classpath's relative path.
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the parameters specified as aJsonObject. Uses the default Locale.- Specified by:
fromTemplatein interfaceTemplatingEngineisClasspathPath- iftrue, the 'templatePath' is considered as a classpath's relative path. Iffalse, 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:TemplatingEngineEvaluates a template using the parameters specified as aJsonObject. Uses the specified Locale.- Specified by:
fromTemplatein interfaceTemplatingEngineisClasspathPath- iftrue, the 'templatePath' is considered as a classpath's relative path. Iffalse, it is considered as an absolute file system path.
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the given parameters. Uses the default Locale.- Specified by:
fromTemplatein interfaceTemplatingEngine- Parameters:
templatePath- must be a classpath's relative path.
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the given parameters. Uses the specified Locale.- Specified by:
fromTemplatein interfaceTemplatingEngine- Parameters:
templatePath- must be a classpath's relative path.
-
fromTemplate
Description copied from interface:TemplatingEngineEvaluates a template using the given parameters. Uses the default Locale.- Specified by:
fromTemplatein interfaceTemplatingEngineisClasspathPath- iftrue, the 'templatePath' is considered as a classpath's relative path. Iffalse, 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:TemplatingEngineEvaluates a template using the given parameters. Uses the specified Locale.- Specified by:
fromTemplatein interfaceTemplatingEngineisClasspathPath- iftrue, the 'templatePath' is considered as a classpath's relative path. Iffalse, it is considered as an absolute file system path.
-
parse
-
createPlaceholder
Description copied from interface:TemplatingEngineCreates 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:
createPlaceholderin interfaceTemplatingEngine
-