Class Template.Segment

java.lang.Object
com.samskivert.mustache.Template.Segment
Direct Known Subclasses:
Mustache.FauxSegment, Mustache.NamedSegment, Mustache.StringSegment
Enclosing class:
Template

protected abstract static class Template.Segment extends Object
A template is broken into segments.
  • Constructor Details

    • Segment

      protected Segment()
  • Method Details

    • execute

      abstract void execute(Template tmpl, Template.Context ctx, Writer out)
    • decompile

      abstract void decompile(Mustache.Delims delims, StringBuilder into)
    • visit

      abstract void visit(Mustache.Visitor visitor)
    • indent

      abstract Template.Segment indent(String indent, boolean first, boolean last)
      Recursively indent by the parameter indent.
      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

      abstract boolean isStandalone()
      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. Once trim is called, standalone tags are determined so that proper (re)indentation will work without reparsing the template.
      Returns:
      true if the tag is standalone.
    • write

      protected static void write(Writer out, CharSequence data)