summaryrefslogtreecommitdiffstats
path: root/org
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-07 18:24:44 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-07 18:24:44 +0200
commit5d04d7e32ab93c6b3c3ec7e3698f0a41b55fa4cb (patch)
tree58f3252da010cafffe63f896f526ae5f093f2a19 /org
parent457ce3fb7d0bd2198d1397912093cc1f99befe26 (diff)
downloaddamlengine-5d04d7e32ab93c6b3c3ec7e3698f0a41b55fa4cb.tar.gz
damlengine-5d04d7e32ab93c6b3c3ec7e3698f0a41b55fa4cb.tar.bz2
damlengine-5d04d7e32ab93c6b3c3ec7e3698f0a41b55fa4cb.zip
Also use HTML5 elements (article, header, footer) for weblog entries.
Diffstat (limited to 'org')
-rw-r--r--org/madore/damlengine/Context.java1
-rw-r--r--org/madore/damlengine/TodoComments.java4
-rw-r--r--org/madore/damlengine/TodoDateExtraElement.java2
-rw-r--r--org/madore/damlengine/TodoEntryElement.java14
-rw-r--r--org/madore/damlengine/TodoEntryTitleElement.java11
-rw-r--r--org/madore/damlengine/included.css4
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;