From 091a8a525b668761f721cb51167a1bd8acf6b423 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Fri, 17 Oct 2014 15:49:57 +0200 Subject: Make the link to continue reading a parent of the main div, not at the cut-here level. --- org/madore/damlengine/TodoCutHere.java | 28 ++++++++++++++++------------ org/madore/damlengine/TodoEntryElement.java | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'org/madore') 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"); -- cgit v1.2.3