public class Template extends Object
parse(...) to get a hold of a reference.
Also see: https://github.com/Shopify/liquid| Modifier and Type | Method and Description |
|---|---|
org.antlr.runtime.tree.CommonTree |
getAST()
Returns the root of the AST of the parsed input.
|
static Template |
parse(File file)
Returns a new Template instance from a given input file.
|
static Template |
parse(File file,
Flavor flavor) |
static Template |
parse(String input)
Returns a new Template instance from a given input string.
|
static Template |
parse(String input,
Flavor flavor) |
String |
render() |
String |
render(Map<String,Object> variables)
Renders the template.
|
String |
render(Object key,
Object value,
Object... keyValues)
Renders the template.
|
String |
render(String jsonMap)
Renders the template.
|
String |
toStringAST()
Returns a string representation of the AST of the parsed
input source.
|
Template |
with(Filter filter) |
Template |
with(Tag tag) |
Template |
withProtectionSettings(ProtectionSettings protectionSettings) |
public org.antlr.runtime.tree.CommonTree getAST()
public static Template parse(String input)
input - the input string holding the Liquid source.public static Template parse(File file) throws IOException
file - the input file holding the Liquid source.IOExceptionpublic static Template parse(File file, Flavor flavor) throws IOException
IOExceptionpublic static Template parse(String input, Flavor flavor) throws IOException
IOExceptionpublic Template withProtectionSettings(ProtectionSettings protectionSettings)
public String render(String jsonMap)
jsonMap - a JSON-map denoting the (possibly nested)
variables that can be used in this Template.public String render()
public String render(Object key, Object value, Object... keyValues)
key - a keyvalue - the value belonging to the keykeyValues - an array denoting key-value pairs where the
uneven numbers (even indexes) should be Strings.
If the length of this array is uneven, the last
key (without the value) gets `null` attached to
it. Note that a call to this method with a single
String as parameter, will be handled by
`render(String jsonMap)` instead.public String render(Map<String,Object> variables)
variables - a Map denoting the (possibly nested)
variables that can be used in this
Template.public String toStringAST()
Copyright © 2012–2016. All rights reserved.