- java.lang.Object
-
- com.samskivert.mustache.Template.Segment
-
- Direct Known Subclasses:
Mustache.FauxSegment
,Mustache.NamedSegment
,Mustache.StringSegment
- Enclosing class:
- Template
protected abstract static class Template.Segment extends java.lang.Object
A template is broken into segments.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Segment()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract void
decompile(Mustache.Delims delims, java.lang.StringBuilder into)
(package private) abstract void
execute(Template tmpl, Template.Context ctx, java.io.Writer out)
(package private) abstract Template.Segment
indent(java.lang.String indent, boolean first, boolean last)
Recursively indent by the parameter indent.(package private) abstract boolean
isStandalone()
Whether or not the segment is standalone.(package private) abstract void
visit(Mustache.Visitor visitor)
protected static void
write(java.io.Writer out, java.lang.CharSequence data)
-
-
-
Method Detail
-
execute
abstract void execute(Template tmpl, Template.Context ctx, java.io.Writer out)
-
decompile
abstract void decompile(Mustache.Delims delims, java.lang.StringBuilder into)
-
visit
abstract void visit(Mustache.Visitor visitor)
-
indent
abstract Template.Segment indent(java.lang.String indent, boolean first, boolean last)
Recursively indent by the parameter indent.- 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
abstract boolean isStandalone()
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.- Returns:
- true if the tag is standalone.
-
write
protected static void write(java.io.Writer out, java.lang.CharSequence data)
-
-