use of com.mitchellbosecke.pebble.extension.escaper.SafeString in project Orchid by JavaEden.
the class PebbleWrapperTemplateFilter method doApply.
private Object doApply(Object input, Map<String, Object> args, EvaluationContext context) throws PebbleException {
args.put(inputParam, input);
TemplateFunction freshFunction = contextProvider.get().resolve(functionClass);
Object pageVar = context.getVariable("page");
final OrchidPage actualPage;
if (pageVar instanceof OrchidPage) {
actualPage = (OrchidPage) pageVar;
} else {
actualPage = null;
}
freshFunction.extractOptions(contextProvider.get(), args);
Object output = freshFunction.apply(contextProvider.get(), actualPage);
if (freshFunction.isSafeString()) {
return new SafeString(output.toString());
} else {
return output;
}
}
use of com.mitchellbosecke.pebble.extension.escaper.SafeString in project Orchid by JavaEden.
the class PebbleWrapperTemplateFunction method doExecute.
private Object doExecute(Map<String, Object> args, EvaluationContext context) {
TemplateFunction freshFunction = contextProvider.get().resolve(functionClass);
Object pageVar = context.getVariable("page");
final OrchidPage actualPage;
if (pageVar instanceof OrchidPage) {
actualPage = (OrchidPage) pageVar;
} else {
actualPage = null;
}
freshFunction.extractOptions(contextProvider.get(), args);
Object output = freshFunction.apply(contextProvider.get(), actualPage);
if (freshFunction.isSafeString()) {
return new SafeString(output.toString());
} else {
return output;
}
}
Aggregations