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
Fields Modifier and Type Field Description protected Mustache.Compiler_compprotected Template.Segment[]_segsprotected boolean_standaloneEndprotected boolean_standaloneStart-
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSectionSegment(Mustache.AbstractSectionSegment original, Template.Segment[] segs)protectedAbstractSectionSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Template.Segment[]_segs()protected voidexecuteSegs(Template tmpl, Template.Context ctx, java.io.Writer out)protected abstract Mustache.AbstractSectionSegmentindent(java.lang.String indent, boolean first, boolean last)Recursively indent by the parameter indent.booleanisStandalone()Whether or not the segment is standalone.booleanisStandaloneEnd()booleanisStandaloneStart()voidstandaloneEnd(boolean standaloneEnd)voidstandaloneStart(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 Detail
-
_comp
protected final Mustache.Compiler _comp
-
_segs
protected final Template.Segment[] _segs
-
_standaloneStart
protected boolean _standaloneStart
-
_standaloneEnd
protected boolean _standaloneEnd
-
-
Constructor Detail
-
AbstractSectionSegment
protected AbstractSectionSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line)
-
AbstractSectionSegment
protected AbstractSectionSegment(Mustache.AbstractSectionSegment original, Template.Segment[] segs)
-
-
Method Detail
-
executeSegs
protected void executeSegs(Template tmpl, Template.Context ctx, java.io.Writer out)
-
indent
protected abstract Mustache.AbstractSectionSegment indent(java.lang.String indent, boolean first, boolean last)
Description copied from class:Template.SegmentRecursively indent by the parameter indent.- Specified by:
indentin classTemplate.Segment- Parameters:
indent- should be space characters that are not\n.first- append indent to the first line (regardless if it has a\nor not).last- append indent on the last\nthat 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.SegmentWhether 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. Oncetrimis called, standalone tags are determined so that proper (re)indentation will work without reparsing the template.- Specified by:
isStandalonein classTemplate.Segment- Returns:
- true if the tag is standalone.
-
isStandaloneStart
public boolean isStandaloneStart()
- Specified by:
isStandaloneStartin interfaceMustache.StandaloneSection
-
isStandaloneEnd
public boolean isStandaloneEnd()
- Specified by:
isStandaloneEndin interfaceMustache.StandaloneSection
-
standaloneStart
public void standaloneStart(boolean standaloneStart)
- Specified by:
standaloneStartin interfaceMustache.StandaloneSection
-
standaloneEnd
public void standaloneEnd(boolean standaloneEnd)
- Specified by:
standaloneEndin interfaceMustache.StandaloneSection
-
_segs
public Template.Segment[] _segs()
- Specified by:
_segsin interfaceMustache.StandaloneSection
-
-