summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoCommentsScript.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-07 14:51:59 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-07 14:51:59 +0200
commit7fb2155a48f7312ff71bc841ce587c44f333384b (patch)
treea2c303966a686f5450adf99178b95bab28a90fab /org/madore/damlengine/TodoCommentsScript.java
parent58e0ddcdc2b5d47db753868b3cc937bbac59ec55 (diff)
downloaddamlengine-7fb2155a48f7312ff71bc841ce587c44f333384b.tar.gz
damlengine-7fb2155a48f7312ff71bc841ce587c44f333384b.tar.bz2
damlengine-7fb2155a48f7312ff71bc841ce587c44f333384b.zip
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.
Diffstat (limited to 'org/madore/damlengine/TodoCommentsScript.java')
-rw-r--r--org/madore/damlengine/TodoCommentsScript.java6
1 files changed, 6 insertions, 0 deletions
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;
}