Module com.samskivert.jmustache
Package com.samskivert.mustache
Class Mustache.AbstractSectionSegment
java.lang.Object
com.samskivert.mustache.Template.Segment
com.samskivert.mustache.Mustache.NamedSegment
com.samskivert.mustache.Mustache.AbstractSectionSegment
- All Implemented Interfaces:
Mustache.BlockReplaceable
,Mustache.StandaloneSection
- Direct Known Subclasses:
Mustache.BlockSegment
,Mustache.InvertedSegment
,Mustache.SectionSegment
- Enclosing class:
Mustache
protected abstract static class Mustache.AbstractSectionSegment
extends Mustache.NamedSegment
implements Mustache.StandaloneSection
A helper class for section-like segments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Mustache.Compiler
protected final Template.Segment[]
protected boolean
protected boolean
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractSectionSegment
(Mustache.AbstractSectionSegment original, Template.Segment[] segs) protected
AbstractSectionSegment
(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line) -
Method Summary
Modifier and TypeMethodDescription_segs()
protected void
executeSegs
(Template tmpl, Template.Context ctx, Writer out) protected abstract Mustache.AbstractSectionSegment
Recursively indent by the parameter indent.boolean
Whether or not the segment is standalone.boolean
boolean
void
standaloneEnd
(boolean standaloneEnd) void
standaloneStart
(boolean standaloneStart) Methods inherited from class com.samskivert.mustache.Template.Segment
decompile, execute, visit, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.samskivert.mustache.Mustache.BlockReplaceable
replaceBlocks
Methods inherited from interface com.samskivert.mustache.Mustache.StandaloneSection
firstLeadsBlank, lastTrailsBlank, trimFirstBlank, trimLastBlank
-
Field Details
-
_comp
-
_segs
-
_standaloneStart
protected boolean _standaloneStart -
_standaloneEnd
protected boolean _standaloneEnd
-
-
Constructor Details
-
AbstractSectionSegment
protected AbstractSectionSegment(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line) -
AbstractSectionSegment
-
-
Method Details
-
executeSegs
-
indent
protected abstract Mustache.AbstractSectionSegment indent(String indent, boolean first, boolean last) 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
public 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.
-
isStandaloneStart
public boolean isStandaloneStart()- Specified by:
isStandaloneStart
in interfaceMustache.StandaloneSection
-
isStandaloneEnd
public boolean isStandaloneEnd()- Specified by:
isStandaloneEnd
in interfaceMustache.StandaloneSection
-
standaloneStart
public void standaloneStart(boolean standaloneStart) - Specified by:
standaloneStart
in interfaceMustache.StandaloneSection
-
standaloneEnd
public void standaloneEnd(boolean standaloneEnd) - Specified by:
standaloneEnd
in interfaceMustache.StandaloneSection
-
_segs
- Specified by:
_segs
in interfaceMustache.StandaloneSection
-