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
FieldsModifier and TypeFieldDescriptionprotected final Map<String, Mustache.BlockSegment> protected final Template.Segment[]protected booleanprotected booleanFields inherited from class Mustache.AbstractPartialSegment
_comp, _indentFields inherited from class Mustache.NamedSegment
_line, _name -
Constructor Summary
ConstructorsModifierConstructorDescriptionParentTemplateSegment(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line) privateParentTemplateSegment(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line, String indent) privateParentTemplateSegment(Mustache.ParentTemplateSegment original, Template.Segment[] segs, String indent, Map<String, Mustache.BlockSegment> blocks) -
Method Summary
Modifier and TypeMethodDescriptionprotected Template_segs()voiddecompile(Mustache.Delims delims, StringBuilder into) protected Mustache.ParentTemplateSegmentRecursively indent by the parameter indent.booleanWhether or not the segment is standalone.booleanbooleanbooleanprivate static Template.Segment[]removeNonBlocks(Template.Segment[] segs) replaceBlocks(Map<String, Mustache.BlockSegment> blocks) voidstandaloneEnd(boolean standaloneEnd) voidstandaloneStart(boolean standaloneStart) toString()voidvoidvisit(Mustache.Visitor visitor) Methods inherited from class Mustache.AbstractPartialSegment
execute, getTemplateMethods inherited from class Template.Segment
writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Mustache.StandaloneSection
firstLeadsBlank, trimFirstBlank
-
Field Details
-
_segs
-
_standaloneStart
protected boolean _standaloneStart -
_standaloneEnd
protected boolean _standaloneEnd -
_blocks
-
-
Constructor Details
-
ParentTemplateSegment
public ParentTemplateSegment(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line) -
ParentTemplateSegment
private ParentTemplateSegment(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line, String indent) -
ParentTemplateSegment
private ParentTemplateSegment(Mustache.ParentTemplateSegment original, Template.Segment[] segs, String indent, Map<String, Mustache.BlockSegment> blocks)
-
-
Method Details
-
removeNonBlocks
-
decompile
- Specified by:
decompilein classTemplate.Segment
-
visit
- Specified by:
visitin classTemplate.Segment
-
indent
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
- Overrides:
_loadTemplatein classMustache.AbstractPartialSegment
-
lastTrailsBlank
public boolean lastTrailsBlank()- Specified by:
lastTrailsBlankin interfaceMustache.StandaloneSection
-
trimLastBlank
public void trimLastBlank()- Specified by:
trimLastBlankin interfaceMustache.StandaloneSection
-
replaceBlocks
- Specified by:
replaceBlocksin interfaceMustache.BlockReplaceable
-
_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
-