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
_comp
protected Template.Segment[]
_segs
protected boolean
_standaloneEnd
protected boolean
_standaloneStart
-
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSectionSegment(Mustache.AbstractSectionSegment original, Template.Segment[] segs)
protected
AbstractSectionSegment(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 void
executeSegs(Template tmpl, Template.Context ctx, java.io.Writer out)
protected abstract Mustache.AbstractSectionSegment
indent(java.lang.String indent, boolean first, boolean last)
Recursively indent by the parameter indent.boolean
isStandalone()
Whether or not the segment is standalone.boolean
isStandaloneEnd()
boolean
isStandaloneStart()
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 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.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
public Template.Segment[] _segs()
- Specified by:
_segs
in interfaceMustache.StandaloneSection
-
-