Class Mustache

java.lang.Object
com.samskivert.mustache.Mustache

public class Mustache extends Object
Provides Mustache templating services.

Basic usage:


 String source = "Hello {{arg}}!";
 Template tmpl = Mustache.compiler().compile(source);
 Map<String, Object> context = new HashMap<String, Object>();
 context.put("arg", "world");
 tmpl.execute(context); // returns "Hello world!"
 
  • Field Details

  • Constructor Details

    • Mustache

      private Mustache()
  • Method Details

    • compiler

      public static Mustache.Compiler compiler()
      Returns a compiler that escapes HTML by default and does not use standards mode.
    • compile

      protected static Template compile(Reader source, Mustache.Compiler compiler)
      Compiles the supplied template into a repeatedly executable intermediate form.
    • trim

      protected static Template.Segment[] trim(Template.Segment[] segs, boolean top)
    • indentSegs

      static Template.Segment[] indentSegs(Template.Segment[] _segs, String indent, boolean _first, boolean _last)
      Indents segments by indent.
      Parameters:
      _segs - segments to be cloned if indentation is needed
      indent - the space to use for indent.
      _first - whether to append an indent on the first segment
      _last - whether to append an indent on the last segment last empty newline (no character after \n).
      Returns:
      cloned segments if changed
    • replaceBlockSegs

      static Template.Segment[] replaceBlockSegs(Template.Segment[] _segs, Map<String,Mustache.BlockSegment> blocks)
    • restoreStartTag

      protected static void restoreStartTag(StringBuilder text, Mustache.Delims starts)
    • allowsWhitespace

      protected static boolean allowsWhitespace(char typeChar)