Module com.samskivert.jmustache
Package com.samskivert.mustache
Class Mustache.ParentTemplateSegment
- java.lang.Object
-
- com.samskivert.mustache.Template.Segment
-
- com.samskivert.mustache.Mustache.NamedSegment
-
- com.samskivert.mustache.Mustache.AbstractPartialSegment
-
- com.samskivert.mustache.Mustache.ParentTemplateSegment
-
- All Implemented Interfaces:
Mustache.BlockReplaceable,Mustache.StandaloneSection
- Enclosing class:
- Mustache
protected static class Mustache.ParentTemplateSegment extends Mustache.AbstractPartialSegment implements Mustache.StandaloneSection
A segment that loads and executes a parent template by spec called inheritance.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,Mustache.BlockSegment>_blocksprotected Template.Segment[]_segsprotected boolean_standaloneEndprotected boolean_standaloneStart-
Fields inherited from class com.samskivert.mustache.Mustache.AbstractPartialSegment
_comp, _indent
-
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
-
Constructor Summary
Constructors Modifier Constructor Description ParentTemplateSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line)privateParentTemplateSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line, java.lang.String indent)privateParentTemplateSegment(Mustache.ParentTemplateSegment original, Template.Segment[] segs, java.lang.String indent, java.util.Map<java.lang.String,Mustache.BlockSegment> blocks)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Template_loadTemplate()Template.Segment[]_segs()voiddecompile(Mustache.Delims delims, java.lang.StringBuilder into)protected Mustache.ParentTemplateSegmentindent(java.lang.String indent, boolean first, boolean last)Recursively indent by the parameter indent.booleanisStandalone()Whether or not the segment is standalone.booleanisStandaloneEnd()booleanisStandaloneStart()booleanlastTrailsBlank()private static Template.Segment[]removeNonBlocks(Template.Segment[] segs)Mustache.ParentTemplateSegmentreplaceBlocks(java.util.Map<java.lang.String,Mustache.BlockSegment> blocks)voidstandaloneEnd(boolean standaloneEnd)voidstandaloneStart(boolean standaloneStart)java.lang.StringtoString()voidtrimLastBlank()voidvisit(Mustache.Visitor visitor)-
Methods inherited from class com.samskivert.mustache.Mustache.AbstractPartialSegment
execute, getTemplate
-
Methods inherited from class com.samskivert.mustache.Template.Segment
write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.samskivert.mustache.Mustache.StandaloneSection
firstLeadsBlank, trimFirstBlank
-
-
-
-
Field Detail
-
_segs
protected final Template.Segment[] _segs
-
_standaloneStart
protected boolean _standaloneStart
-
_standaloneEnd
protected boolean _standaloneEnd
-
_blocks
protected final java.util.Map<java.lang.String,Mustache.BlockSegment> _blocks
-
-
Constructor Detail
-
ParentTemplateSegment
public ParentTemplateSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line)
-
ParentTemplateSegment
private ParentTemplateSegment(Mustache.Compiler compiler, java.lang.String name, Template.Segment[] segs, int line, java.lang.String indent)
-
ParentTemplateSegment
private ParentTemplateSegment(Mustache.ParentTemplateSegment original, Template.Segment[] segs, java.lang.String indent, java.util.Map<java.lang.String,Mustache.BlockSegment> blocks)
-
-
Method Detail
-
removeNonBlocks
private static Template.Segment[] removeNonBlocks(Template.Segment[] segs)
-
decompile
public void decompile(Mustache.Delims delims, java.lang.StringBuilder into)
- Specified by:
decompilein classTemplate.Segment
-
visit
public void visit(Mustache.Visitor visitor)
- Specified by:
visitin classTemplate.Segment
-
indent
protected Mustache.ParentTemplateSegment 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.
-
_loadTemplate
protected Template _loadTemplate()
- Overrides:
_loadTemplatein classMustache.AbstractPartialSegment
-
lastTrailsBlank
public boolean lastTrailsBlank()
- Specified by:
lastTrailsBlankin interfaceMustache.StandaloneSection
-
trimLastBlank
public void trimLastBlank()
- Specified by:
trimLastBlankin interfaceMustache.StandaloneSection
-
replaceBlocks
public Mustache.ParentTemplateSegment replaceBlocks(java.util.Map<java.lang.String,Mustache.BlockSegment> blocks)
- Specified by:
replaceBlocksin interfaceMustache.BlockReplaceable
-
_segs
public Template.Segment[] _segs()
- Specified by:
_segsin interfaceMustache.StandaloneSection
-
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 classMustache.AbstractPartialSegment- 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-