public.javadoc.org.spincast.plugins.pebble.SpincastPebbleTemplatingEngine.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastPebbleTemplatingEngine (org.spincast:spincast-framework 1.13.0 API)
org.spincast.plugins.pebble
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 Summary
Fields
Modifier and Type
Field and Description
protected static org.slf4j.Logger
logger
static String
PEBBLE_PARAMS_AS_JSONOBJECT
-
Constructor Summary
Constructors
Constructor and Description
SpincastPebbleTemplatingEngine(SpincastConfig spincastConfig,
SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig,
Set<com.mitchellbosecke.pebble.extension.Extension> extensions,
JsonManager jsonManager)
-
Method Summary
All Methods Instance Methods Concrete Methods
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)
Evaluates the content, without parameters.
String
evaluate(String content,
JsonObject jsonObject)
Evaluates the content, using the given parameters.
String
evaluate(String content,
JsonObject 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,
JsonObject jsonObject)
Evaluates a template using the parameters specified
as a JsonObject
.
String
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a JsonObject
.
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,
JsonObject jsonObject)
Evaluates a template using the parameters specified
as a JsonObject
.
String
fromTemplate(String templatePath,
JsonObject jsonObject,
Locale locale)
Evaluates a template using the parameters specified
as a JsonObject
.
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 Set<com.mitchellbosecke.pebble.extension.Extension>
getExtensions()
protected com.mitchellbosecke.pebble.loader.Loader<String>
getFileSystemTemplateLoader()
protected JsonManager
getJsonManager()
protected com.mitchellbosecke.pebble.PebbleEngine
getPebbleEngineString()
protected com.mitchellbosecke.pebble.PebbleEngine
getPebbleEngineTemplateClasspath()
protected com.mitchellbosecke.pebble.PebbleEngine
getPebbleEngineTemplateFileSystem()
protected SpincastConfig
getSpincastConfig()
protected SpincastPebbleTemplatingEngineConfig
getSpincastPebbleTemplatingEngineConfig()
protected String
parse(String htmlOrPath,
JsonObject paramsAsJsonObject,
Map<String,Object> params,
boolean isTemplate,
boolean isClasspathPath,
Locale locale)
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
PEBBLE_PARAMS_AS_JSONOBJECT
public static final String PEBBLE_PARAMS_AS_JSONOBJECT
-
Constructor Detail
-
SpincastPebbleTemplatingEngine
@Inject
public SpincastPebbleTemplatingEngine(SpincastConfig spincastConfig,
SpincastPebbleTemplatingEngineConfig spincastPebbleTemplatingEngineConfig,
Set<com.mitchellbosecke.pebble.extension.Extension> extensions,
JsonManager jsonManager)
-
Method Detail
-
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
Copyright © 2019. All rights reserved.