use of com.squarespace.template.Compiler in project template-compiler by Squarespace.
the class TemplateC method compiler.
protected Compiler compiler() {
FormatterTable formatterTable = new FormatterTable();
PredicateTable predicateTable = new PredicateTable();
// core
formatterTable.register(new CoreFormatters());
predicateTable.register(new CorePredicates());
// TODO: dynamic classpath scan and registration of plugin jars.
// squarespace
formatterTable.register(new CommerceFormatters());
formatterTable.register(new ContentFormatters());
formatterTable.register(new SocialFormatters());
formatterTable.register(new InternationalFormatters());
predicateTable.register(new CommercePredicates());
predicateTable.register(new ContentPredicates());
predicateTable.register(new SlidePredicates());
predicateTable.register(new SocialPredicates());
predicateTable.register(new InternationalPredicates());
return new Compiler(formatterTable, predicateTable);
}
use of com.squarespace.template.Compiler in project template-compiler by Squarespace.
the class MoneyFormatterTest method executeLocale.
private String executeLocale(String template, String json, String locale) throws CodeException {
Compiler compiler = compiler();
Context ctx = compiler.newExecutor().json(json).template(template).locale(Locale.forLanguageTag(locale)).execute();
return ctx.buffer().toString();
}
use of com.squarespace.template.Compiler in project template-compiler by Squarespace.
the class MoneyFormatterTest method executeLocale.
private String executeLocale(String template, String json, CLDR.Locale locale) throws CodeException {
Compiler compiler = compiler();
Context ctx = compiler.newExecutor().json(json).template(template).cldrLocale(locale).execute();
return ctx.buffer().toString();
}
use of com.squarespace.template.Compiler in project template-compiler by Squarespace.
the class MoneyFormatterLegacyTest method executeLocale.
private String executeLocale(String template, String json, String locale) throws CodeException {
Compiler compiler = compiler();
Context ctx = compiler.newExecutor().json(json).template(template).locale(Locale.forLanguageTag(locale)).execute();
return ctx.buffer().toString();
}
Aggregations