remarkNode.setText(jsBlockTrans.transform(context,
remarkNode.getText()));
emit(context, null, node, null);
} else if (NodeUtils.isTextNode(node)) {
TextNode textNode = (TextNode)node;
if (context.isInCSS()) {
handleCSSTextNode(context, textNode);
} else if (context.isInScriptText()) {
handleJSTextNode(context, textNode);
}
emit(context, null, textNode, null);
// handleContentTextNode(context,textNode);
} else if (NodeUtils.isTagNode(node)) {
TagNode tagNode = (TagNode)node;
if (tagNode.isEndTag()) {
if (tagNode.getTagName().equals("HEAD")) {
context.putData(FERRET_IN_HEAD, null);
}
if (checkAllowTag(pContext, tagNode)) {
emit(context, null, tagNode, null);
}
// handleCloseTagNode(context,tagNode);
} else if (tagNode.getTagName().startsWith("![CDATA[")) {
// CDATA section is delivered as TagNode, and it
// appears there's no ordinary way of replacing its
// body content. Also CSS/JS handling method wants
// TextNode. Create a temporary TextNode for them,
// and write "<![CDATA["..."]]>" around it.
String text = tagNode.getText();
int s = "![CDATA[".length();
// text is supposed to end with "]]", but just in case.
int e = text.endsWith("]]") ? text.length() - 2 : text.length();
if (context.isInCSS()) {
TextNode textNode = new TextNode(text.substring(s, e));
handleCSSTextNode(context, textNode);
emit(context, "<![CDATA[", textNode, "]]>");
} else if (context.isInScriptText()) {
TextNode textNode = new TextNode(text.substring(s, e));
handleJSTextNode(context, textNode);
emit(context, "<![CDATA[", textNode, "]]>");
} else {
emit(context, null, tagNode, null);
}