summaryrefslogtreecommitdiffstats
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/madore/damlengine/TodoEntryElement.java45
-rw-r--r--org/madore/damlengine/TodoEntryTitleElement.java2
-rw-r--r--org/madore/damlengine/TodoFooter.java2
3 files changed, 35 insertions, 14 deletions
diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java
index 4fed3c1..c42943c 100644
--- a/org/madore/damlengine/TodoEntryElement.java
+++ b/org/madore/damlengine/TodoEntryElement.java
@@ -28,11 +28,11 @@ 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, "article");
+ Element article = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "article");
String explicitLang = LangHelper.getLangNorec(node);
if ( explicitLang != null )
- LangHelper.setLangNorec(div, explicitLang);
- node.getParentNode().replaceChild(div, node);
+ LangHelper.setLangNorec(article, explicitLang);
+ node.getParentNode().replaceChild(article, node);
String entryNumberStr = node.getAttributeNS(null, "number");
if ( ! Pattern.matches("^\\d{4}$", entryNumberStr) )
@@ -46,6 +46,7 @@ public final class TodoEntryElement extends TodoDefaultElement {
String entryDayStr = entryDateMatcher.group(3);
String entryDowStr = node.getAttributeNS(null, "day_of_week");
String entryCatStr = node.getAttributeNS(null, "cat");
+ String entryCdateStr = node.getAttributeNS(null, "cdate");
ArrayList<String> entryCatList;
if ( entryCatStr.equals("") ) {
entryCatList = new ArrayList<String>(0);
@@ -59,18 +60,18 @@ public final class TodoEntryElement extends TodoDefaultElement {
}
String entryIdStr = "d."+entryDateStr+"."+entryNumberStr;
- div.setAttributeNS(null, "id", entryIdStr);
- div.setAttributeNS(null, "class", "weblog-entry");
+ article.setAttributeNS(null, "id", entryIdStr);
+ article.setAttributeNS(null, "class", "weblog-entry hentry");
{
String styleAtt = node.getAttributeNS(null, "style");
if ( ! styleAtt.equals("") )
node.setAttributeNS(null, "style", styleAtt);
}
- div.appendChild(ctx.doc.createTextNode("\n"));
+ article.appendChild(ctx.doc.createTextNode("\n"));
Element header = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "header");
- div.appendChild(header);
- div.appendChild(ctx.doc.createTextNode("\n"));
+ article.appendChild(header);
+ article.appendChild(ctx.doc.createTextNode("\n"));
Element headlink = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p");
headlink.setAttributeNS(null, "class", "weblog-entry-headlink");
header.appendChild(headlink);
@@ -81,11 +82,25 @@ public final class TodoEntryElement extends TodoDefaultElement {
entryYearStr+"-"+entryMonthStr+".html"
+"#"+entryIdStr);
permalink.setAttributeNS(null, "rel", "bookmark");
- permalink.appendChild(ctx.doc.createTextNode(entryDateStr));
+ Element time = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "time");
+ permalink.appendChild(time);
+ if ( Pattern.matches("^\\d{4}-\\d{2}-\\d{2}T\\d{2}\\:\\d{2}(?:\\:\\d{2})?(?:Z|[\\+\\-]\\d{2}\\:\\d{2})$", entryCdateStr) )
+ time.setAttributeNS(null, "datetime", entryCdateStr);
+ else
+ System.err.println("warning: cdate value "+entryCdateStr
+ +" is not a valid HTML5 datetime");
+ time.setAttributeNS(null, "pubdate", "pubdate");
+ time.setAttributeNS(null, "class", "published");
+ time.appendChild(ctx.doc.createTextNode(entryDateStr));
headlink.appendChild(permalink);
if ( ! entryDowStr.equals("") )
headlink.appendChild(ctx.doc.createTextNode(" ("+entryDowStr+")"));
+ Element mainDiv = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "div");
+ article.appendChild(mainDiv);
+ article.appendChild(ctx.doc.createTextNode("\n"));
+ mainDiv.setAttributeNS(null, "class", "entry-content");
+
Context ctx2 = ctx.clone();
ctx2.ent
= new Context.EntryContext(entryYearStr, entryMonthStr, entryDayStr,
@@ -100,17 +115,21 @@ public final class TodoEntryElement extends TodoDefaultElement {
|| child.getNodeType() == Node.CDATA_SECTION_NODE ) {
if ( ! Pattern.matches("^\\s*$",((CharacterData)child).getData()) )
throw new IllegalArgumentException("entry element cannot contain text");
- div.appendChild(ctx.doc.createTextNode("\n"));
+ mainDiv.appendChild(ctx.doc.createTextNode("\n"));
} else if ( child.getNodeType() == Node.ELEMENT_NODE ) {
- div.appendChild(child);
+ if ( child.getLocalName().equals("title") ) {
+ article.appendChild(child);
+ } else {
+ mainDiv.appendChild(child);
+ }
TodoElement it
= TodoElement.getTodoElement((Element)child, ctx2, this);
toProcess.add(it);
}
}
Element footer = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "footer");
- div.appendChild(footer);
- div.appendChild(ctx.doc.createTextNode("\n"));
+ article.appendChild(footer);
+ article.appendChild(ctx.doc.createTextNode("\n"));
if ( entryCatList.size() > 0 ) {
Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS,
"d:implicit-do-categories");
diff --git a/org/madore/damlengine/TodoEntryTitleElement.java b/org/madore/damlengine/TodoEntryTitleElement.java
index 6a17a24..d193c83 100644
--- a/org/madore/damlengine/TodoEntryTitleElement.java
+++ b/org/madore/damlengine/TodoEntryTitleElement.java
@@ -36,7 +36,7 @@ public final class TodoEntryTitleElement extends TodoDefaultElement {
&& Pattern.matches("^\\s*$",((CharacterData)ws).getData()) )
node.getParentNode().removeChild(ws);
node.getParentNode().removeChild(node);
- h2.setAttributeNS(null, "class", "weblog-entry-title");
+ h2.setAttributeNS(null, "class", "weblog-entry-title entry-title");
ArrayList<Node> childList = getChildList(this.node);
ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size());
for ( Node child : childList ) {
diff --git a/org/madore/damlengine/TodoFooter.java b/org/madore/damlengine/TodoFooter.java
index 1744efb..33bd1fc 100644
--- a/org/madore/damlengine/TodoFooter.java
+++ b/org/madore/damlengine/TodoFooter.java
@@ -25,12 +25,14 @@ public final class TodoFooter extends TodoElement {
Element addr = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "address");
footer.appendChild(addr);
footer.appendChild(ctx.doc.createTextNode("\n"));
+ addr.setAttributeNS(null, "class", "author vcard");
toProcess.add(TodoElement.getTodoElement(addr, this.ctx, this));
Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
a.setAttributeNS(null, "href",
(ctx.gc.uriToTop==null)?"http://www.madore.org/~david/"
:ctx.gc.uriToTop);
// a.setAttributeNS(null, "rel", "author");
+ a.setAttributeNS(null, "class", "url fn");
addr.appendChild(a);
a.appendChild(ctx.doc.createTextNode("David Madore"));
addr.appendChild(ctx.doc.createTextNode(" ("));