summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org/madore/damlengine/Context.java1
-rw-r--r--org/madore/damlengine/TodoDateExtraElement.java36
-rw-r--r--org/madore/damlengine/TodoElement.java1
-rw-r--r--org/madore/damlengine/TodoEntryElement.java1
4 files changed, 39 insertions, 0 deletions
diff --git a/org/madore/damlengine/Context.java b/org/madore/damlengine/Context.java
index f5d12bf..5ae7285 100644
--- a/org/madore/damlengine/Context.java
+++ b/org/madore/damlengine/Context.java
@@ -33,6 +33,7 @@ public class Context implements Cloneable {
public String date;
public String number;
public String dow;
+ public Element headerNode;
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/TodoDateExtraElement.java b/org/madore/damlengine/TodoDateExtraElement.java
new file mode 100644
index 0000000..a8dd0b6
--- /dev/null
+++ b/org/madore/damlengine/TodoDateExtraElement.java
@@ -0,0 +1,36 @@
+package org.madore.damlengine;
+
+import org.w3c.dom.*;
+
+public final class TodoDateExtraElement extends TodoDefaultElement {
+
+ public static class Factory extends TodoElement.Factory {
+ @Override
+ public TodoDateExtraElement newItem(Element node,
+ Context ctx,
+ TodoItem caller) {
+ return new TodoDateExtraElement(node, ctx, caller);
+ }
+ }
+
+ public TodoDateExtraElement(Element node,
+ Context ctx,
+ TodoItem caller) {
+ super(node, ctx, caller);
+ }
+
+ @Override
+ public void handleNodeOnly() {
+ String lang = LangHelper.getLangRec(node);
+ String explicitLang = LangHelper.getLangNorec(node);
+ if ( explicitLang != null && explicitLang != lang ) {
+ System.err.println("warning: lang attribute on date-extra will be ignored");
+ explicitLang = null;
+ }
+ 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()));
+ node.getParentNode().removeChild(node);
+ }
+
+}
diff --git a/org/madore/damlengine/TodoElement.java b/org/madore/damlengine/TodoElement.java
index c597430..94867cc 100644
--- a/org/madore/damlengine/TodoElement.java
+++ b/org/madore/damlengine/TodoElement.java
@@ -42,6 +42,7 @@ public abstract class TodoElement extends TodoItem {
damlFactories.put("translation", new TodoTranslationElement.Factory());
damlFactories.put("meta-description", new TodoMetaElement.Factory(TodoMetaElement.Type.DESCRIPTION));
damlFactories.put("meta-keywords", new TodoMetaElement.Factory(TodoMetaElement.Type.KEYWORDS));
+ damlFactories.put("date-extra", new TodoDateExtraElement.Factory());
damlFactories.put("email-despammed", new TodoEmailDespammedElement.Factory());
damlFactories.put("email-at", new TodoEmailAtOrDotElement.Factory(TodoEmailAtOrDotElement.Type.AT));
damlFactories.put("email-dot", new TodoEmailAtOrDotElement.Factory(TodoEmailAtOrDotElement.Type.DOT));
diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java
index 4853a9a..8b38881 100644
--- a/org/madore/damlengine/TodoEntryElement.java
+++ b/org/madore/damlengine/TodoEntryElement.java
@@ -73,6 +73,7 @@ public final class TodoEntryElement extends TodoDefaultElement {
ctx2.ent
= new Context.EntryContext(entryYearStr, entryMonthStr, entryDayStr,
entryNumberStr, entryDowStr);
+ ctx2.ent.headerNode = header;
ArrayList<Node> childList = getChildList(this.node);
ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()+8);