Search in sources :

Example 1 with ElementContext

use of org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext 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);
}
Also used : PluginInvoke(org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke) ElementContext(org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext)

Example 2 with ElementContext

use of org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext 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);
}
Also used : PluginInvoke(org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke) ElementContext(org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext)

Example 3 with ElementContext

use of org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext in project sling by apache.

the class MarkupHandler method onOpenTagStart.

public void onOpenTagStart(String markup, String tagName) {
    ElementContext context = new ElementContext(tagName, markup);
    elementStack.push(context);
}
Also used : ElementContext(org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext)

Aggregations

ElementContext (org.apache.sling.scripting.sightly.impl.compiler.frontend.ElementContext)3 PluginInvoke (org.apache.sling.scripting.sightly.impl.plugin.PluginInvoke)2