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
FieldsModifier and TypeFieldDescriptionprotected final Map
<String, Mustache.BlockSegment> protected final Template.Segment[]
protected boolean
protected boolean
Fields inherited from class com.samskivert.mustache.Mustache.AbstractPartialSegment
_comp, _indent
Fields inherited from class com.samskivert.mustache.Mustache.NamedSegment
_line, _name
-
Constructor Summary
ConstructorsModifierConstructorDescriptionParentTemplateSegment
(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line) private
ParentTemplateSegment
(Mustache.Compiler compiler, String name, Template.Segment[] segs, int line, String indent) private
ParentTemplateSegment
(Mustache.ParentTemplateSegment original, Template.Segment[] segs, String indent, Map<String, Mustache.BlockSegment> blocks) -
Method Summary
Modifier and TypeMethodDescriptionprotected Template
_segs()
void
decompile
(Mustache.Delims delims, StringBuilder into) protected Mustache.ParentTemplateSegment
Recursively indent by the parameter indent.boolean
Whether or not the segment is standalone.boolean
boolean
boolean
private static Template.Segment[]
removeNonBlocks
(Template.Segment[] segs) replaceBlocks
(Map<String, Mustache.BlockSegment> blocks) void
standaloneEnd
(boolean standaloneEnd) void
standaloneStart
(boolean standaloneStart) toString()
void
void
visit
(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 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:
decompile
in classTemplate.Segment
-
visit
- Specified by:
visit
in classTemplate.Segment
-
indent
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.
-
_loadTemplate
- Overrides:
_loadTemplate
in classMustache.AbstractPartialSegment
-
lastTrailsBlank
public boolean lastTrailsBlank()- Specified by:
lastTrailsBlank
in interfaceMustache.StandaloneSection
-
trimLastBlank
public void trimLastBlank()- Specified by:
trimLastBlank
in interfaceMustache.StandaloneSection
-
replaceBlocks
- Specified by:
replaceBlocks
in interfaceMustache.BlockReplaceable
-
_segs
- Specified by:
_segs
in interfaceMustache.StandaloneSection
-
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 classMustache.AbstractPartialSegment
- 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
-
toString
-