本文整理了Java中com.samskivert.mustache.Mustache
类的一些代码示例,展示了Mustache
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mustache
类的具体详情如下:
包路径:com.samskivert.mustache.Mustache
类名称:Mustache
[英]Provides Mustache templating services.
Basic usage:
String source = "Hello {{arg}}!";
Template tmpl = Mustache.compiler().compile(source);
Map context = new HashMap();
context.put("arg", "world");
tmpl.execute(context); // returns "Hello world!"
}
[中]提供Mustache模板服务。
基本用法:
String source = "Hello {{arg}}!";
Template tmpl = Mustache.compiler().compile(source);
Map context = new HashMap();
context.put("arg", "world");
tmpl.execute(context); // returns "Hello world!"
}
代码示例来源:origin: org.springframework.boot/spring-boot
/**
* Create a {@code MustacheViewResolver} backed by a default instance of a
* {@link Compiler}.
*/
public MustacheViewResolver() {
this.compiler = Mustache.compiler();
setViewClass(requiredViewClass());
}
代码示例来源:origin: samskivert/jmustache
/** Compiles the supplied template into a repeatedly executable intermediate form. */
public Template compile (Reader source) {
return Mustache.compile(source, this);
}
代码示例来源:origin: samskivert/jmustache
restoreStartTag(text, delims);
break;
case MATCHING_END:
restoreStartTag(text, delims);
text.append(delims.end1);
break;
代码示例来源:origin: samskivert/jmustache
restoreStartTag(text, delims);
accum.addTextSegment(text);
tagStartColumn = column;
代码示例来源:origin: org.springframework.boot/spring-boot
/**
* Create a {@code MustacheViewResolver} backed by a default instance of a
* {@link Compiler}.
*/
public MustacheViewResolver() {
this.compiler = Mustache.compiler();
setViewClass(requiredViewClass());
}
代码示例来源:origin: com.samskivert/jmustache
restoreStartTag(text, delims);
break;
case MATCHING_END:
restoreStartTag(text, delims);
text.append(delims.end1);
break;
代码示例来源:origin: com.samskivert/jmustache
/** Compiles the supplied template into a repeatedly executable intermediate form. */
public Template compile (Reader source) {
return Mustache.compile(source, this);
}
代码示例来源:origin: rapidoid/rapidoid
@Override
protected Mustache.Compiler createViewFactory(ResourceLoader templateLoader) {
return Mustache.compiler().withLoader(loader(templateLoader));
}
代码示例来源:origin: com.samskivert/jmustache
restoreStartTag(text, delims);
accum.addTextSegment(text);
tagStartColumn = column;
代码示例来源:origin: spring-io/initializr
private static Compiler mustacheCompiler() {
return Mustache.compiler().withLoader(mustacheTemplateLoader());
}
代码示例来源:origin: killbill/killbill
@Override
public String executeTemplateText(final String templateText, final Map<String, Object> data) {
final Template template = Mustache.compiler().nullValue("").compile(templateText);
return template.execute(data);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
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; charset=UTF-8", null);
}
代码示例来源:origin: purplejs/purplejs
MustacheServiceImpl()
{
this.compiler = Mustache.compiler();
}
代码示例来源:origin: dstl/baleen
/**
* Compile template.
*
* @return
* @throws IOException Signals that an I/O exception has occurred.
*/
protected static Template compileTemplate(Path templateFilepath) throws IOException {
Compiler compiler = Mustache.compiler();
String templateHtml = new String(Files.readAllBytes(templateFilepath), StandardCharsets.UTF_8);
return compiler.compile(templateHtml);
}
代码示例来源:origin: restx/restx
private static Mustache.Compiler createCompiler() {
return Mustache.compiler().escapeHTML(false);
}
代码示例来源:origin: io.restx/restx-common
private static Mustache.Compiler createCompiler() {
return Mustache.compiler().escapeHTML(false);
}
代码示例来源:origin: com.ning.billing/killbill-util
@VisibleForTesting
public String executeTemplateText(final String templateText, final Map<String, Object> data) {
final Template template = Mustache.compiler().compile(templateText);
return template.execute(data);
}
代码示例来源:origin: sdeleuze/spring-kotlin-deepdive
@Bean
public Mustache.Compiler mustacheCompiler(TemplateLoader loader) {
return compiler().escapeHTML(false).withLoader(loader);
}
代码示例来源:origin: hantsy/spring-reactive-sample
/**
* Create a {@code MustacheViewResolver} backed by a default instance of a
* {@link Compiler}.
*/
public MustacheViewResolver() {
this.compiler = Mustache.compiler();
setViewClass(requiredViewClass());
}
代码示例来源:origin: threerings/narya
/**
* Merges the specified template using the supplied mapping of string keys to objects.
*
* @return a string containing the merged text.
*/
protected String mergeTemplate (String template, Map<String, Object> data)
throws IOException
{
Reader reader =
new InputStreamReader(getClass().getClassLoader().getResourceAsStream(template), UTF_8);
return convertEols(Mustache.compiler().escapeHTML(false).compile(reader).execute(data));
}
内容来源于网络,如有侵权,请联系作者删除!