use of org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke in project sling by apache.
the class MarkupHandler method onCloseTag.
public void onCloseTag(String markup) {
ElementContext context = elementStack.pop();
PluginInvoke invoke = context.pluginInvoke();
invoke.afterChildren(stream);
boolean selfClosingTag = StringUtils.isEmpty(markup);
boolean slyTag = "sly".equalsIgnoreCase(context.getTagName());
if (slyTag) {
Patterns.beginStreamIgnore(stream);
}
invoke.beforeTagClose(stream, selfClosingTag);
out(markup);
invoke.afterTagClose(stream, selfClosingTag);
if (slyTag) {
Patterns.endStreamIgnore(stream);
}
invoke.afterElement(stream);
}
use of org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke in project sling by apache.
the class MarkupHandler method onOpenTagEnd.
public void onOpenTagEnd(String markup) {
ElementContext context = elementStack.peek();
PluginInvoke invoke = context.pluginInvoke();
invoke.beforeElement(stream, context.getTagName());
boolean slyTag = "sly".equalsIgnoreCase(context.getTagName());
if (slyTag) {
Patterns.beginStreamIgnore(stream);
}
invoke.beforeTagOpen(stream);
out(context.getOpenTagStartMarkup());
invoke.beforeAttributes(stream);
traverseAttributes(context, invoke);
invoke.afterAttributes(stream);
out(markup);
invoke.afterTagOpen(stream);
if (slyTag) {
Patterns.endStreamIgnore(stream);
}
invoke.beforeChildren(stream);
}
use of org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke in project sling by apache.
the class MarkupHandler method handlePlugin.
private void handlePlugin(String name, String value, ElementContext context) {
PluginCallInfo callInfo = Syntax.parsePluginAttribute(name);
if (callInfo != null) {
Plugin plugin = obtainPlugin(callInfo.getName());
ExpressionContext expressionContext = ExpressionContext.getContextForPlugin(plugin.name());
Expression expr = expressionWrapper.transform(expressionParser.parseInterpolation(value), null, expressionContext);
PluginInvoke invoke = plugin.invoke(expr, callInfo, compilerContext);
context.addPlugin(invoke, plugin.priority());
context.addPluginCall(name, callInfo, expr);
}
}
use of org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke in project sling by apache.
the class ElementContext method pluginInvoke.
public PluginInvoke pluginInvoke() {
if (aggregateInvoke == null) {
Collections.sort(invokeList);
ArrayList<PluginInvoke> result = new ArrayList<>();
for (PrioritizedInvoke prioritizedInvoke : invokeList) {
result.add(prioritizedInvoke.invoke);
}
aggregateInvoke = new AggregatePluginInvoke(result);
}
return aggregateInvoke;
}
Aggregations