Package com.samskivert.mustache

Examples of com.samskivert.mustache.Template


    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

* Time: 6:44 PM
*/
public class MustachesTest {
    @Test
    public void should_compile_and_execute() throws Exception {
        Template mustache = Mustaches.compile(MustachesTest.class, "MustachesTestFixture1.mustache");
        assertThat(Mustaches.execute(mustache, ImmutableMap.of("name", "world"))).isEqualTo("Hello world");
    }
View Full Code Here

TOP

Related Classes of com.samskivert.mustache.Template

Copyright © 2018 www.massapicom. 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.