java.lang.Object
com.samskivert.mustache.Template.Segment
com.samskivert.mustache.Mustache.NamedSegment
com.samskivert.mustache.Mustache.VariableSegment
- Enclosing class:
Mustache
A segment that substitutes the contents of a variable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Mustache.Escaper
protected final Mustache.Formatter
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
Constructor Summary
ConstructorsConstructorDescriptionVariableSegment
(String name, int line, Mustache.Formatter formatter, Mustache.Escaper escaper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
decompile
(Mustache.Delims delims, StringBuilder into) void
execute
(Template tmpl, Template.Context ctx, Writer out) (package private) Mustache.VariableSegment
Recursively indent by the parameter indent.(package private) boolean
Whether or not the segment is standalone.toString()
void
visit
(Mustache.Visitor visitor) Methods inherited from class com.samskivert.mustache.Template.Segment
write
-
Field Details
-
_formatter
-
_escaper
-
-
Constructor Details
-
VariableSegment
public VariableSegment(String name, int line, Mustache.Formatter formatter, Mustache.Escaper escaper)
-
-
Method Details
-
execute
- Specified by:
execute
in classTemplate.Segment
-
decompile
- Specified by:
decompile
in classTemplate.Segment
-
visit
- Specified by:
visit
in classTemplate.Segment
-
indent
Description copied from class:Template.Segment
Recursively indent by the parameter indent.- Specified by:
indent
in classTemplate.Segment
- Parameters:
indent
- should be space characters that are not\n
.first
- append indent to the first line (regardless if it has a\n
or not).last
- append indent on the last\n
that has no text after it.- Returns:
- a newly created segment or the same segment if nothing changed.
-
isStandalone
boolean isStandalone()Description copied from class:Template.Segment
Whether or not the segment is standalone. The definition of standalone is defined by the mustache spec. String and variable tags are never standalone. For blocks this is based on the closing tag. Oncetrim
is called, standalone tags are determined so that proper (re)indentation will work without reparsing the template.- Specified by:
isStandalone
in classTemplate.Segment
- Returns:
- true if the tag is standalone.
-
toString
-