Package com.samskivert.mustache

Examples of com.samskivert.mustache.Template.execute()


    public void render(Writer out, String view, Object context) throws IOException {
        Reader source = null;
        try {
            source = load(view);
            Template template = mustache.compile(source);
            template.execute(context, out);
        } finally {
            Streams.close(source);
        }
    }
View Full Code Here


    public void test (Spec spec) {
        loader.setSpec(spec);
        String tmpl = spec.getTemplate();
        Template t = compiler.compile(spec.getTemplate());
        String out = t.execute(spec.getData());
        Assert.assertEquals(String.format("When rendering '''%s''' with '%s'",
                                          tmpl.replaceAll("\n", "\\\\n"),
                                          spec.getData().toString().replaceAll("\n", "\\\\n")),
                            spec.getExpectedOutput(), out);
    }
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.