Class Mustache


  • public class Mustache
    extends java.lang.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!"
     
    • Constructor Detail

      • Mustache

        private Mustache()
    • Method Detail

      • 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​(java.io.Reader source,
                                          Mustache.Compiler compiler)
        Compiles the supplied template into a repeatedly executable intermediate form.
      • indentSegs

        static Template.Segment[] indentSegs​(Template.Segment[] _segs,
                                             java.lang.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
      • restoreStartTag

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

        protected static boolean allowsWhitespace​(char typeChar)