/** * Create a {@code MustacheViewResolver} backed by a default instance of a * {@link Compiler}. */ public MustacheViewResolver() { this.compiler = Mustache.compiler(); setViewClass(requiredViewClass()); }
/** * Create a {@code MustacheViewResolver} backed by a default instance of a * {@link Compiler}. */ public MustacheViewResolver() { this.compiler = Mustache.compiler(); setViewClass(requiredViewClass()); }
@Override protected Mustache.Compiler createViewFactory(ResourceLoader templateLoader) { return Mustache.compiler().withLoader(loader(templateLoader)); }
private static Compiler mustacheCompiler() { return Mustache.compiler().withLoader(mustacheTemplateLoader()); }
@Override public String executeTemplateText(final String templateText, final Map<String, Object> data) { final Template template = Mustache.compiler().nullValue("").compile(templateText); return template.execute(data); } }
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); }
MustacheServiceImpl() { this.compiler = Mustache.compiler(); }
/** * 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); }
private static Mustache.Compiler createCompiler() { return Mustache.compiler().escapeHTML(false); }
@VisibleForTesting public String executeTemplateText(final String templateText, final Map<String, Object> data) { final Template template = Mustache.compiler().compile(templateText); return template.execute(data); }
@Bean public Mustache.Compiler mustacheCompiler(TemplateLoader loader) { return compiler().escapeHTML(false).withLoader(loader); }
/** * Create a {@code MustacheViewResolver} backed by a default instance of a * {@link Compiler}. */ public MustacheViewResolver() { this.compiler = Mustache.compiler(); setViewClass(requiredViewClass()); }
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); } }
/** * 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)); }
protected Path resolvePath(Path path, String relative, Object scope) { return path.resolve(Mustaches.execute( Mustache.compiler().escapeHTML(false).compile(relative), scope)); }
@Override public String executeTemplateText(final String templateText, final Map<String, Object> data) { final Template template = Mustache.compiler().nullValue("").compile(templateText); return template.execute(data); } }
protected Template getTemplate(String key, Locale locale) { return Mustache.compiler().escapeHTML(false).compile(getTemplateString(key, locale)); }
@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; }
public void afterPropertiesSet() throws Exception { templateLoader.setPrefix(prefix); templateLoader.setSuffix(suffix); if (compiler == null) { compiler = Mustache.compiler() .escapeHTML(escapeHTML) .standardsMode(standardsMode) .withLoader(templateLoader); } }
public void afterPropertiesSet() throws Exception { templateLoader.setPrefix(prefix); templateLoader.setSuffix(suffix); if (compiler == null) { compiler = Mustache.compiler() .escapeHTML(escapeHTML) .standardsMode(standardsMode) .withLoader(templateLoader); } }