summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoTitleOrSubtitle.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-07 14:21:29 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-07 14:21:29 +0200
commit58e0ddcdc2b5d47db753868b3cc937bbac59ec55 (patch)
treebfe8a1f4014ef8373c06184b449c4f3bfaccb854 /org/madore/damlengine/TodoTitleOrSubtitle.java
parent5acce829dc6ded492cca5ec87cd8bdbdb81667a5 (diff)
downloaddamlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.tar.gz
damlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.tar.bz2
damlengine-58e0ddcdc2b5d47db753868b3cc937bbac59ec55.zip
Move body handling (header, footer, etc.) to the <d:daml> element.
The <d:body> element is now sort of useless.
Diffstat (limited to 'org/madore/damlengine/TodoTitleOrSubtitle.java')
-rw-r--r--org/madore/damlengine/TodoTitleOrSubtitle.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/org/madore/damlengine/TodoTitleOrSubtitle.java b/org/madore/damlengine/TodoTitleOrSubtitle.java
index 1640b93..01c4973 100644
--- a/org/madore/damlengine/TodoTitleOrSubtitle.java
+++ b/org/madore/damlengine/TodoTitleOrSubtitle.java
@@ -1,6 +1,7 @@
package org.madore.damlengine;
import java.util.ArrayList;
+import java.util.regex.Pattern;
import org.w3c.dom.*;
public final class TodoTitleOrSubtitle extends TodoElement {
@@ -28,6 +29,15 @@ public final class TodoTitleOrSubtitle extends TodoElement {
@Override
public void handle() {
+ if ( ((t==Type.TITLE)?ctx.gc.title:ctx.gc.subtitle) == 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;
+ }
Element elt = ctx.doc.createElementNS(DamlEngine.XHTML_NS, t.eltName);
String expLang = (t==Type.TITLE)?ctx.gc.titleLang:ctx.gc.subtitleLang;
if ( expLang != null )