use of com.mitchellbosecke.pebble.error.PebbleException in project symja_android_library by axkr.
the class TemplateUtils method getNewEngine.
public static PebbleEngine getNewEngine() {
PebbleEngine engine;
try {
Loader<?> loader = new ClasspathLoader();
if (templateLocations != null && !templateLocations.isEmpty()) {
List<Loader<?>> loaders = new ArrayList<>();
for (String templateLocation : templateLocations) {
FileLoader fileLoader = new FileLoader();
fileLoader.setPrefix(templateLocation);
loaders.add(fileLoader);
}
// add this one last, so it is shadowed
loaders.add(loader);
loader = new DelegatingLoader(loaders);
}
engine = new PebbleEngine.Builder().loader(loader).strictVariables(false).build();
} catch (PebbleException e) {
throw new IllegalStateException(e);
}
return engine;
}
use of com.mitchellbosecke.pebble.error.PebbleException in project symja_android_library by axkr.
the class HeatmapTrace method asJavascript.
@Override
public String asJavascript(int i) {
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = engine.getTemplate("trace_template.html");
compiledTemplate.evaluate(writer, getContext());
} catch (PebbleException e) {
throw new IllegalStateException(e);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return writer.toString();
}
Aggregations