Search in sources :

Example 1 with Template

use of com.samskivert.mustache.Template in project cw-omnibus by commonsguy.

the class MainActivity method printReport.

private void printReport() {
    Template tmpl = Mustache.compiler().compile(getString(R.string.report_body));
    WebView print = prepPrintWebView(getString(R.string.tps_report));
    print.loadData(tmpl.execute(new TpsReportContext(prose.getText().toString())), "text/html", "UTF-8");
}
Also used : WebView(android.webkit.WebView) Template(com.samskivert.mustache.Template)

Example 2 with Template

use of com.samskivert.mustache.Template in project spring-boot by spring-projects.

the class MustacheWebIntegrationTests method contextLoads.

@Test
public void contextLoads() {
    String source = "Hello {{arg}}!";
    Template tmpl = Mustache.compiler().compile(source);
    Map<String, String> context = new HashMap<>();
    context.put("arg", "world");
    // returns "Hello
    assertThat(tmpl.execute(context)).isEqualTo("Hello world!");
// world!"
}
Also used : HashMap(java.util.HashMap) Template(com.samskivert.mustache.Template) TestRestTemplate(org.springframework.boot.test.web.client.TestRestTemplate) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Template (com.samskivert.mustache.Template)2 WebView (android.webkit.WebView)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 TestRestTemplate (org.springframework.boot.test.web.client.TestRestTemplate)1