- java.lang.Object
-
- com.samskivert.mustache.Mustache
-
public class Mustache extends java.lang.ObjectProvides Mustache templating services.Basic usage:
String source = "Hello {{arg}}!"; Template tmpl = Mustache.compiler().compile(source); Map<String, Object> context = new HashMap<String, Object>(); context.put("arg", "world"); tmpl.execute(context); // returns "Hello world!"
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMustache.Accumulatorprotected static classMustache.BlockSegmentA helper class for block segments.static interfaceMustache.CollectorHandles interpreting objects as collections.static classMustache.CompilerCompiles templates into executable form.static interfaceMustache.CustomContextProvides a means to implement custom logic for variable lookup.protected static classMustache.Delimsstatic interfaceMustache.EscaperHandles escaping characters in substituted text.protected static classMustache.FauxSegmentstatic interfaceMustache.FormatterHandles converting objects to strings when rendering templates.protected static classMustache.IncludedTemplateSegmentA segment that loads and executes a sub-template.protected static classMustache.InvertedSegmentA segment that represents an inverted section.static interfaceMustache.InvertibleLambdaHandles lambdas that are also invoked for inverse sections..static interfaceMustache.LambdaHandles lambdas.protected static classMustache.NamedSegmentA helper class for named segments.protected static classMustache.Parserprotected static classMustache.SectionSegmentA segment that represents a section.protected static classMustache.StringSegmentA simple segment that reproduces a string.static interfaceMustache.TemplateLoaderHandles loading partial templates.static interfaceMustache.VariableFetcherReads variables from context objects.protected static classMustache.VariableSegmentA segment that substitutes the contents of a variable.static interfaceMustache.VisitorUsed to visit the tags in a template without executing it.
-
Field Summary
Fields Modifier and Type Field Description protected static Mustache.FormatterDEFAULT_FORMATTERprotected static Mustache.TemplateLoaderFAILING_LOADERprotected static intMATCHING_ENDprotected static intMATCHING_STARTprotected static charNO_CHARUsed when we have only a single character delimiter.protected static intTAGprotected static intTEXT
-
Constructor Summary
Constructors Modifier Constructor Description privateMustache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static booleanallowsWhitespace(char typeChar)protected static Templatecompile(java.io.Reader source, Mustache.Compiler compiler)Compiles the supplied template into a repeatedly executable intermediate form.static Mustache.Compilercompiler()Returns a compiler that escapes HTML by default and does not use standards mode.protected static voidrestoreStartTag(java.lang.StringBuilder text, Mustache.Delims starts)protected static Template.Segment[]trim(Template.Segment[] segs, boolean top)
-
-
-
Field Detail
-
TEXT
protected static final int TEXT
- See Also:
- Constant Field Values
-
MATCHING_START
protected static final int MATCHING_START
- See Also:
- Constant Field Values
-
MATCHING_END
protected static final int MATCHING_END
- See Also:
- Constant Field Values
-
TAG
protected static final int TAG
- See Also:
- Constant Field Values
-
NO_CHAR
protected static final char NO_CHAR
Used when we have only a single character delimiter.- See Also:
- Constant Field Values
-
FAILING_LOADER
protected static final Mustache.TemplateLoader FAILING_LOADER
-
DEFAULT_FORMATTER
protected static final Mustache.Formatter DEFAULT_FORMATTER
-
-
Method Detail
-
compiler
public static Mustache.Compiler compiler()
Returns a compiler that escapes HTML by default and does not use standards mode.
-
compile
protected static Template compile(java.io.Reader source, Mustache.Compiler compiler)
Compiles the supplied template into a repeatedly executable intermediate form.
-
trim
protected static Template.Segment[] trim(Template.Segment[] segs, boolean top)
-
restoreStartTag
protected static void restoreStartTag(java.lang.StringBuilder text, Mustache.Delims starts)
-
allowsWhitespace
protected static boolean allowsWhitespace(char typeChar)
-
-