if (tagContext == null) {
tagContext = new HashMap<Object, Object>();
tagContext.put(GroovyPage.OUT, out);
tagContext.put(GroovyPageParser.class, this);
}
GroovySyntaxTag tag = (GroovySyntaxTag) tagRegistry.newTag(tagName);
tag.init(tagContext);
tag.setAttributes(attrs);
if (tag.isKeepPrecedingWhiteSpace() && currentlyBufferingWhitespace) {
flushBufferedWhiteSpace();
}
else if (!tag.isAllowPrecedingContent() && previousContentWasNonWhitespace) {
throw new GrailsTagException("Tag [" + tag.getName() +
"] cannot have non-whitespace characters directly preceding it.", pageName,
getCurrentOutputLineNumber());
}
else {
// If tag does not specify buffering of WS, we swallow it here
clearBufferedWhiteSpace();
}
tag.doStartTag();
tm.instance = tag;
}
else {
// Custom taglibs have to always flush the whitespace, there's no