diff options
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r-- | org/madore/damlengine/Context.java | 1 | ||||
-rw-r--r-- | org/madore/damlengine/TodoComments.java | 4 | ||||
-rw-r--r-- | org/madore/damlengine/TodoDateExtraElement.java | 2 | ||||
-rw-r--r-- | org/madore/damlengine/TodoEntryElement.java | 14 | ||||
-rw-r--r-- | org/madore/damlengine/TodoEntryTitleElement.java | 11 | ||||
-rw-r--r-- | org/madore/damlengine/included.css | 4 |
6 files changed, 26 insertions, 10 deletions
diff --git a/org/madore/damlengine/Context.java b/org/madore/damlengine/Context.java index 15ce76a..d7c950a 100644 --- a/org/madore/damlengine/Context.java +++ b/org/madore/damlengine/Context.java @@ -69,6 +69,7 @@ public class Context implements Cloneable { public String number; public String dow; public Element headerNode; + public Element headlinkNode; public EntryContext(String year, String month, String day, String number, String dow) { this.year = year; this.month = month; this.day = day; diff --git a/org/madore/damlengine/TodoComments.java b/org/madore/damlengine/TodoComments.java index e5cb04e..b37129f 100644 --- a/org/madore/damlengine/TodoComments.java +++ b/org/madore/damlengine/TodoComments.java @@ -24,6 +24,7 @@ public final class TodoComments extends TodoElement { @Override public void handle() { + Element footer = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "footer"); Element p = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p"); String lang = LangHelper.getLangRec(node); String explicitLang = LangHelper.getLangNorec(node); @@ -35,7 +36,8 @@ public final class TodoComments extends TodoElement { if ( explicitLang != null ) LangHelper.setLangNorec(p, explicitLang); p.setAttributeNS(null, "class", "talkback-link"); - node.getParentNode().replaceChild(p, node); + node.getParentNode().replaceChild(footer, node); + footer.appendChild(p); Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); if ( ctx.ent == null ) throw new IllegalStateException("entry context not defined in comments element"); diff --git a/org/madore/damlengine/TodoDateExtraElement.java b/org/madore/damlengine/TodoDateExtraElement.java index a8dd0b6..f82dfc7 100644 --- a/org/madore/damlengine/TodoDateExtraElement.java +++ b/org/madore/damlengine/TodoDateExtraElement.java @@ -29,7 +29,7 @@ public final class TodoDateExtraElement extends TodoDefaultElement { } if ( ctx.ent == null ) throw new IllegalStateException("entry context not defined in date-extra element"); - ctx.ent.headerNode.appendChild(ctx.doc.createTextNode(" \u00b7 "+node.getTextContent())); + ctx.ent.headlinkNode.appendChild(ctx.doc.createTextNode(" \u00b7 "+node.getTextContent())); node.getParentNode().removeChild(node); } diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java index 78bffd1..7365b88 100644 --- a/org/madore/damlengine/TodoEntryElement.java +++ b/org/madore/damlengine/TodoEntryElement.java @@ -28,7 +28,7 @@ public final class TodoEntryElement extends TodoDefaultElement { || caller instanceof TodoWeblogSelectElement ) ) throw new IllegalArgumentException("entry node can only be child of weblog node"); - Element div = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "div"); + Element div = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "article"); String explicitLang = LangHelper.getLangNorec(node); if ( explicitLang != null ) LangHelper.setLangNorec(div, explicitLang); @@ -56,25 +56,29 @@ public final class TodoEntryElement extends TodoDefaultElement { } div.appendChild(ctx.doc.createTextNode("\n")); - Element header = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p"); - header.setAttributeNS(null, "class", "weblog-entry-header"); + Element header = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "header"); div.appendChild(header); div.appendChild(ctx.doc.createTextNode("\n")); + Element headlink = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p"); + headlink.setAttributeNS(null, "class", "weblog-entry-headlink"); + header.appendChild(headlink); + header.appendChild(ctx.doc.createTextNode("\n")); Element permalink = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); permalink.setAttributeNS(null, "href", entryYearStr+"-"+entryMonthStr+".html" +"#"+entryIdStr); permalink.appendChild(ctx.doc.createTextNode(entryDateStr)); - header.appendChild(permalink); + headlink.appendChild(permalink); if ( ! entryDowStr.equals("") ) - header.appendChild(ctx.doc.createTextNode(" ("+entryDowStr+")")); + headlink.appendChild(ctx.doc.createTextNode(" ("+entryDowStr+")")); Context ctx2 = ctx.clone(); ctx2.ent = new Context.EntryContext(entryYearStr, entryMonthStr, entryDayStr, entryNumberStr, entryDowStr); ctx2.ent.headerNode = header; + ctx2.ent.headlinkNode = headlink; ArrayList<Node> childList = getChildList(this.node); ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()+8); diff --git a/org/madore/damlengine/TodoEntryTitleElement.java b/org/madore/damlengine/TodoEntryTitleElement.java index e5da837..6a17a24 100644 --- a/org/madore/damlengine/TodoEntryTitleElement.java +++ b/org/madore/damlengine/TodoEntryTitleElement.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 TodoEntryTitleElement extends TodoDefaultElement { @@ -22,11 +23,19 @@ public final class TodoEntryTitleElement extends TodoDefaultElement { @Override public void handleNodeOnly() { + if ( ctx.ent == null ) + throw new IllegalStateException("entry context not defined in entry title element"); Element h2 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "h2"); String explicitLang = LangHelper.getLangNorec(node); if ( explicitLang != null ) LangHelper.setLangNorec(h2, explicitLang); - node.getParentNode().replaceChild(h2, node); + ctx.ent.headerNode.appendChild(h2); + Node ws = node.getNextSibling(); + if ( ws != null && ( 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); h2.setAttributeNS(null, "class", "weblog-entry-title"); ArrayList<Node> childList = getChildList(this.node); ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()); diff --git a/org/madore/damlengine/included.css b/org/madore/damlengine/included.css index a7cdce3..2f42d69 100644 --- a/org/madore/damlengine/included.css +++ b/org/madore/damlengine/included.css @@ -30,8 +30,8 @@ h3 { color: rgb(96,64,0); } .important { font-weight: bold; border: solid; padding: 1em; } .outset { border: outset; padding-left: 0.5em; padding-right: 0.5em; } .sidenote { font-size: .83em; } -.weblog-entry-header { color: rgb(128,64,0); } -.weblog-entry-header > a { color: inherit; } +.weblog-entry-headlink { color: rgb(128,64,0); } +.weblog-entry-headlink > a { color: inherit; } .weblog-entry-title { color: black; font-size: 1.17em; |