Package com.github.mustachejava

Examples of com.github.mustachejava.DefaultMustacheFactory.compile()


    };
  }

  private Mustache getMustache() {
    DefaultMustacheFactory mb = createMustacheFactory();
    return mb.compile("timeline.mustache");
  }

  private void singlethreaded(Mustache parse, Object parent) {
    long start = System.currentTimeMillis();
    System.out.println(System.currentTimeMillis() - start);
View Full Code Here


  @Test
  public void testComplex() throws IOException {
    Object context = makeComplex();
    DefaultMustacheFactory mf = new DefaultMustacheFactory(root);
    mf.setObjectHandler(new JRubyObjectHandler());
    Mustache m = mf.compile("complex.html");
    Writer writer = complextest(m, context);
    assertEquals(getContents(root, "complex.txt"), writer.toString());
  }

  private Object makeComplex() {
View Full Code Here

    System.out.println("complex.html evaluations per millisecond:");
    for (int i = 0; i < 3; i++) {
      {
        DefaultMustacheFactory cf = new DefaultMustacheFactory();
        cf.setObjectHandler(new JRubyObjectHandler());
        Mustache m = cf.compile("complex.html");
        Object context = makeComplex();
        assertEquals(getContents(root, "complex.txt"), complextest(m, context).toString());
        long start = System.currentTimeMillis();
        int total = 0;
        while (true) {
View Full Code Here

        }
        System.out.println("Ruby: " + total / TIME);
      }
      {
        DefaultMustacheFactory cf = new DefaultMustacheFactory();
        Mustache m = cf.compile("complex.html");
        Object context = new ComplexObject();
        assertEquals(getContents(root, "complex.txt"), complextest(m, context).toString());
        long start = System.currentTimeMillis();
        int total = 0;
        while (true) {
View Full Code Here

    try {
      Set<File> files = scanner.getIncludedSources(sourceDirectory, outputDirectory);

      for (File file : files) {
        try {
          mustacheFactory.compile(new FileReader(file), file.getAbsolutePath());
        } catch (MustacheException e) {
          throw new MojoFailureException(e.getMessage(), e);
        }
      }
View Full Code Here

public class InverterTest extends InvertUtils {

  @Test
  public void testParser() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli.mustache");
    Path file = getPath("src/test/resources/fdbcli.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);
    System.out.println(invert);
  }
View Full Code Here

  }

  @Test
  public void testSimple() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache test = dmf.compile(new StringReader("test {{value}} test"), "test");
    Node invert = test.invert("test value test");
    Node node = new Node();
    node.put("value", value("value"));
    assertEquals(node, invert);
  }
View Full Code Here

  }

  @Test
  public void testIterable() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache test = dmf.compile(new StringReader("{{#values}}\ntest: {{value}}\n{{/values}}"), "test");
    Node invert = test.invert("test: sam\ntest: fred\n");
    Node node = new Node();
    Node sam = new Node();
    sam.put("value", value("sam"));
    Node fred = new Node();
View Full Code Here

  }

  @Test
  public void testCollectPoints() throws Exception {
    MustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile(new StringReader("{{#page}}This is a {{test}}{{/page}}"),
            UUID.randomUUID().toString());
    Node node = compile.invert("This is a good day");
    assertNotNull(node);
  }
View Full Code Here

  }

  @Test
  public void testNoNode() throws Exception {
    MustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile(new StringReader("Using cluster file [^\\n]+\nHello World"),
        UUID.randomUUID().toString());
    Node node = compile.invert("Using cluster file `/etc/foundationdb/fdb.cluster'.\nHello World");
    assertNotNull(node);
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.