summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-04-27 17:39:16 +0200
committerDavid A. Madore <david+git@madore.org>2011-04-27 17:39:16 +0200
commit89d000ad74a5599e69aa3c1c48f18a68d9aee97b (patch)
treed19ebe11532569c6f2aa33e80b848b3122bdf5ce
parent0434afe04c64502bc1181793f471c4f6d4409981 (diff)
downloaddamlengine-89d000ad74a5599e69aa3c1c48f18a68d9aee97b.tar.gz
damlengine-89d000ad74a5599e69aa3c1c48f18a68d9aee97b.tar.bz2
damlengine-89d000ad74a5599e69aa3c1c48f18a68d9aee97b.zip
The DAML <title> element is used for two different things. :-( Disambiguate.
-rw-r--r--org/madore/damlengine/TodoElement.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/org/madore/damlengine/TodoElement.java b/org/madore/damlengine/TodoElement.java
index 80565cc..a5784bb 100644
--- a/org/madore/damlengine/TodoElement.java
+++ b/org/madore/damlengine/TodoElement.java
@@ -12,6 +12,19 @@ public abstract class TodoElement extends TodoItem {
TodoItem caller);
}
+ public static class TitleDisambiguationFactory extends Factory {
+ Factory mainTitleFactory = new TodoTitleElement.Factory();
+ Factory entryTitleFactory = new TodoDefaultElement.Factory();
+ public TodoElement newItem(Element node,
+ Context ctx,
+ TodoItem caller) {
+ if ( caller instanceof TodoDamlElement )
+ return mainTitleFactory.newItem(node, ctx, caller);
+ else
+ return entryTitleFactory.newItem(node, ctx, caller);
+ }
+ }
+
protected final static Map<String,Factory> damlFactories;
protected final static Factory damlDefaultFactory;
@@ -20,7 +33,7 @@ public abstract class TodoElement extends TodoItem {
damlDefaultFactory = new TodoDefaultElement.Factory();
damlFactories.put("daml", new TodoDamlElement.Factory());
damlFactories.put("body", new TodoBodyElement.Factory());
- damlFactories.put("title", new TodoTitleElement.Factory());
+ damlFactories.put("title", new TitleDisambiguationFactory());
damlFactories.put("subtitle", new TodoSubtitleElement.Factory());
damlFactories.put("translation", new TodoTranslationElement.Factory());
damlFactories.put("meta-description", new TodoMetaElement.Factory(TodoMetaElement.Type.DESCRIPTION));