diff options
-rw-r--r-- | org/madore/damlengine/TodoElement.java | 15 |
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)); |