public class SpincastPebbleTemplatingEngine extends Object implements ITemplatingEngine
| Constructor and Description |
|---|
SpincastPebbleTemplatingEngine(ISpincastConfig spincastConfig) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder) |
String |
createPlaceholder(String variable)
Creates a placeholder using the current templating engine
implementation.
|
String |
evaluate(String content,
IJsonObject jsonObject)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
IJsonObject jsonObject,
Locale locale)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
Map<String,Object> params)
Evaluates the content, using the given parameters.
|
String |
evaluate(String content,
Map<String,Object> params,
Locale locale)
Evaluates the content, using the given parameters.
|
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
IJsonObject jsonObject)
Evaluates a template using the parameters specified
as a
IJsonObject. |
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
IJsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a
IJsonObject. |
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
IJsonObject jsonObject)
Evaluates a template using the parameters specified
as a
IJsonObject. |
String |
fromTemplate(String templatePath,
IJsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a
IJsonObject. |
String |
fromTemplate(String templatePath,
Map<String,Object> params)
Evaluates a template using the given parameters.
|
String |
fromTemplate(String templatePath,
Map<String,Object> params,
Locale locale)
Evaluates a template using the given parameters.
|
protected com.mitchellbosecke.pebble.loader.Loader<String> |
getClasspathTemplateLoader() |
protected com.mitchellbosecke.pebble.loader.Loader<String> |
getFileSystemTemplateLoader() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineString() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineTemplateClasspath() |
protected com.mitchellbosecke.pebble.PebbleEngine |
getPebbleEngineTemplateFileSystem() |
protected ISpincastConfig |
getSpincastConfig() |
protected String |
parse(String htmlOrPath,
Map<String,Object> params,
boolean isTemplate,
boolean isClasspathPath,
Locale locale) |
@Inject public SpincastPebbleTemplatingEngine(ISpincastConfig spincastConfig)
protected ISpincastConfig getSpincastConfig()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineString()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateClasspath()
protected com.mitchellbosecke.pebble.PebbleEngine getPebbleEngineTemplateFileSystem()
protected void addCommonLoaderFeatures(com.mitchellbosecke.pebble.PebbleEngine.Builder builder)
protected com.mitchellbosecke.pebble.loader.Loader<String> getClasspathTemplateLoader()
protected com.mitchellbosecke.pebble.loader.Loader<String> getFileSystemTemplateLoader()
public String evaluate(String content, Map<String,Object> params)
ITemplatingEngineevaluate in interface ITemplatingEnginepublic String evaluate(String content, Map<String,Object> params, Locale locale)
ITemplatingEngineevaluate in interface ITemplatingEnginepublic String evaluate(String content, IJsonObject jsonObject)
ITemplatingEngineIJsonObject.
Uses the default Locale.evaluate in interface ITemplatingEnginepublic String evaluate(String content, IJsonObject jsonObject, Locale locale)
ITemplatingEngineIJsonObject.
Uses the specified Locale.evaluate in interface ITemplatingEnginepublic String fromTemplate(String templatePath, Map<String,Object> params)
ITemplatingEnginefromTemplate in interface ITemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, IJsonObject jsonObject)
ITemplatingEngineIJsonObject.
Uses the default Locale.fromTemplate in interface ITemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, IJsonObject jsonObject, Locale locale)
ITemplatingEngineIJsonObject.
Uses the specified Locale.fromTemplate in interface ITemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, Map<String,Object> params, Locale locale)
ITemplatingEnginefromTemplate in interface ITemplatingEnginetemplatePath - must be a classpath's relative path.public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params)
ITemplatingEnginefromTemplate in interface ITemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params, Locale locale)
ITemplatingEnginefromTemplate in interface ITemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, boolean isClasspathPath, IJsonObject jsonObject)
ITemplatingEngineIJsonObject.
Uses the default Locale.fromTemplate in interface ITemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.public String fromTemplate(String templatePath, boolean isClasspathPath, IJsonObject jsonObject, Locale locale)
ITemplatingEngineIJsonObject.
Uses the specified Locale.fromTemplate in interface ITemplatingEngineisClasspathPath - if true, the 'templatePath' is considered as
a classpath's relative path. If false, it is considered as an absolute file
system path.protected String parse(String htmlOrPath, Map<String,Object> params, boolean isTemplate, boolean isClasspathPath, Locale locale)
public String createPlaceholder(String variable)
ITemplatingEngineThis 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).
createPlaceholder in interface ITemplatingEngineCopyright © 2016. All rights reserved.