com.samskivert.mustache.Mustache.compiler()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中com.samskivert.mustache.Mustache.compiler()方法的一些代码示例,展示了Mustache.compiler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mustache.compiler()方法的具体详情如下:
包路径:com.samskivert.mustache.Mustache
类名称:Mustache
方法名:compiler

Mustache.compiler介绍

[英]Returns a compiler that escapes HTML by default and does not use standards mode.
[中]返回默认情况下转义HTML且不使用标准模式的编译器。

代码示例

代码示例来源: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: 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: rapidoid/rapidoid

@Override
protected Mustache.Compiler createViewFactory(ResourceLoader templateLoader) {
  return Mustache.compiler().withLoader(loader(templateLoader));
}

代码示例来源: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: 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: com.atlassian.labs/speakeasy-plugin

private static Template compile(Plugin plugin, String path)
{
  InputStream in = null;
  try
  {
    in = plugin.getResourceAsStream(path);
    return Mustache.compiler().standardsMode(true).compile(new InputStreamReader(in));
  }
  finally
  {
    IOUtils.closeQuietly(in);
  }
}

代码示例来源: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));
}

代码示例来源:origin: restx/restx

protected Path resolvePath(Path path, String relative, Object scope) {
  return path.resolve(Mustaches.execute(
      Mustache.compiler().escapeHTML(false).compile(relative), scope));
}

代码示例来源:origin: org.kill-bill.billing/killbill-util

@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: restx/restx

protected Template getTemplate(String key, Locale locale) {
  return Mustache.compiler().escapeHTML(false).compile(getTemplateString(key, locale));
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Bean
public ViewResolver mustacheViewResolver() {
  String prefix = "classpath:/templates/";
  String suffix = ".mustache";
  Mustache.TemplateLoader loader = new MustacheResourceTemplateLoader(prefix, suffix);
  MustacheViewResolver mustacheViewResolver = new MustacheViewResolver(Mustache.compiler().withLoader(loader));
  mustacheViewResolver.setPrefix(prefix);
  mustacheViewResolver.setSuffix(suffix);
  return mustacheViewResolver;
}

代码示例来源:origin: com.github.sps.mustache/mustache-spring-view

public void afterPropertiesSet() throws Exception {
  templateLoader.setPrefix(prefix);
  templateLoader.setSuffix(suffix);
  if (compiler == null) {
    compiler = Mustache.compiler()
        .escapeHTML(escapeHTML)
        .standardsMode(standardsMode)
        .withLoader(templateLoader);
  }
}

代码示例来源:origin: sps/mustache-spring-view

public void afterPropertiesSet() throws Exception {
  templateLoader.setPrefix(prefix);
  templateLoader.setSuffix(suffix);
  if (compiler == null) {
    compiler = Mustache.compiler()
        .escapeHTML(escapeHTML)
        .standardsMode(standardsMode)
        .withLoader(templateLoader);
  }
}

相关文章

Mustache类方法