diff options
author | David A. Madore <david+git@madore.org> | 2014-10-17 15:49:57 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2014-10-17 15:49:57 +0200 |
commit | 091a8a525b668761f721cb51167a1bd8acf6b423 (patch) | |
tree | d6926c4f88edf13af9c4c26503940197308f0db2 | |
parent | 6c4cab0a9f5dbc019d81eeaeae46c8f17c7bdca7 (diff) | |
download | damlengine-091a8a525b668761f721cb51167a1bd8acf6b423.tar.gz damlengine-091a8a525b668761f721cb51167a1bd8acf6b423.tar.bz2 damlengine-091a8a525b668761f721cb51167a1bd8acf6b423.zip |
Make the link to continue reading a parent of the main div, not at the cut-here level.
-rw-r--r-- | org/madore/damlengine/TodoCutHere.java | 28 | ||||
-rw-r--r-- | org/madore/damlengine/TodoEntryElement.java | 1 |
2 files changed, 17 insertions, 12 deletions
diff --git a/org/madore/damlengine/TodoCutHere.java b/org/madore/damlengine/TodoCutHere.java index 51935e7..4438b5f 100644 --- a/org/madore/damlengine/TodoCutHere.java +++ b/org/madore/damlengine/TodoCutHere.java @@ -38,7 +38,23 @@ public final class TodoCutHere extends TodoDefaultElement { div.appendChild(ctx.doc.createComment(" EMPTY ")); node.getParentNode().replaceChild(div, node); } else { + // Remove every node that follows. + Node killPoint = node; + while ( ! killPoint.isSameNode(ctx.ent.mainDivNode) ) { + Node parent = killPoint.getParentNode(); + while ( killPoint.getNextSibling() != null ) + parent.removeChild(killPoint.getNextSibling()); + // FIXME: deleted node may already have found its way + // in the todo deque, which means it could cause a + // null pointer exception by trying to access its + // parent node. Do something about this! + killPoint = parent; + } + // Remove the cut-point node itself. + node.getParentNode().removeChild(node); + // Now add the link to the full content. Element p = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p"); + ctx.ent.mainDivNode.appendChild(p); Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); p.appendChild(a); final String baseDir = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/")); @@ -56,18 +72,6 @@ public final class TodoCutHere extends TodoDefaultElement { a.appendChild(ctx.doc.createTextNode("[Leger ultra\u2026]")); else a.appendChild(ctx.doc.createTextNode("[\u2026]")); - node.getParentNode().replaceChild(p, node); - Node killPoint = p; - while ( ! killPoint.isSameNode(ctx.ent.mainDivNode) ) { - Node parent = killPoint.getParentNode(); - while ( killPoint.getNextSibling() != null ) - parent.removeChild(killPoint.getNextSibling()); - // FIXME: deleted node may already have found its way - // in the todo deque, which means it could cause a - // null pointer exception by trying to access its - // parent node. Do something about this! - killPoint = parent; - } } } diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java index fa29ebe..c41237b 100644 --- a/org/madore/damlengine/TodoEntryElement.java +++ b/org/madore/damlengine/TodoEntryElement.java @@ -161,6 +161,7 @@ public final class TodoEntryElement extends TodoDefaultElement { Element footer = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "footer"); article.appendChild(footer); article.appendChild(ctx.doc.createTextNode("\n")); + footer.setAttributeNS(null, "class", "entry-footer cleared"); if ( entryCatList.size() > 0 ) { Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS, "d:implicit-do-categories"); |