use of org.apache.wicket.markup.RawMarkup in project wicket by apache.
the class StyleAndScriptIdentifier method postProcess.
@Override
public void postProcess(Markup markup) {
for (int i = 0; i < markup.size(); i++) {
MarkupElement elem = markup.get(i);
if (elem instanceof ComponentTag) {
ComponentTag open = (ComponentTag) elem;
if (shouldProcess(open)) {
if (open.isOpen() && ((i + 2) < markup.size())) {
MarkupElement body = markup.get(i + 1);
MarkupElement tag2 = markup.get(i + 2);
if ((body instanceof RawMarkup) && (tag2 instanceof ComponentTag)) {
ComponentTag close = (ComponentTag) tag2;
if (close.closes(open)) {
String text = body.toString().trim();
if (shouldWrapInCdata(text)) {
text = JavaScriptUtils.SCRIPT_CONTENT_PREFIX + body.toString() + JavaScriptUtils.SCRIPT_CONTENT_SUFFIX;
markup.replace(i + 1, new RawMarkup(text));
}
}
}
}
}
}
}
}
Aggregations