From 7fb2155a48f7312ff71bc841ce587c44f333384b Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Wed, 7 Sep 2011 14:51:59 +0200 Subject: Fix and correct some aspects of language handling. In particular, take better care to ensure that when an element is removed which might have an xml:lang attribute, its children keep their original language. --- org/madore/damlengine/TodoCommentsScript.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'org/madore/damlengine/TodoCommentsScript.java') diff --git a/org/madore/damlengine/TodoCommentsScript.java b/org/madore/damlengine/TodoCommentsScript.java index 224d547..eb250e8 100644 --- a/org/madore/damlengine/TodoCommentsScript.java +++ b/org/madore/damlengine/TodoCommentsScript.java @@ -1,5 +1,6 @@ package org.madore.damlengine; +import java.util.regex.Pattern; import org.w3c.dom.*; public final class TodoCommentsScript extends TodoElement { @@ -13,6 +14,11 @@ public final class TodoCommentsScript extends TodoElement { @Override public void handle() { if ( ctx.gc.commentsJSParam == null ) { + Node ws = node.getNextSibling(); + if ( ( ws.getNodeType() == Node.TEXT_NODE + || ws.getNodeType() == Node.CDATA_SECTION_NODE ) + && Pattern.matches("^\\s*$",((CharacterData)ws).getData()) ) + node.getParentNode().removeChild(ws); node.getParentNode().removeChild(node); return; } -- cgit v1.2.3