diff options
-rw-r--r-- | org/madore/damlengine/TodoDamlElement.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java index dff27ee..50c39bb 100644 --- a/org/madore/damlengine/TodoDamlElement.java +++ b/org/madore/damlengine/TodoDamlElement.java @@ -98,6 +98,32 @@ public final class TodoDamlElement extends TodoDefaultElement { headNode.appendChild(meta); headNode.appendChild(ctx.doc.createTextNode("\n")); + // Twitter summary card + if ( ctx.wsc != null && ctx.wsc instanceof Context.WeblogSingleSelectionContext ) { + meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta"); + meta.setAttributeNS(null, "name", "twitter:card"); + meta.setAttributeNS(null, "content", "summary"); + headNode.appendChild(meta); + headNode.appendChild(ctx.doc.createTextNode("\n")); + meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta"); + meta.setAttributeNS(null, "name", "twitter:site"); + meta.setAttributeNS(null, "content", "@gro_tsen"); + headNode.appendChild(meta); + headNode.appendChild(ctx.doc.createTextNode("\n")); + final WeblogSummary wsum = WeblogSummary.getSummary(ctx.dc); + if ( wsum != null ) { + final WeblogSummary.EntrySummary esum + = wsum.entries.get(new Integer(((Context.WeblogSingleSelectionContext)(ctx.wsc)).number)); + if ( esum != null && esum.title != null ) { + meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta"); + meta.setAttributeNS(null, "name", "twitter:title"); + meta.setAttributeNS(null, "content", esum.title); + headNode.appendChild(meta); + headNode.appendChild(ctx.doc.createTextNode("\n")); + } + } + } + ArrayList<Node> childList = getChildList(this.node); ArrayList<TodoElement> toProcessFirst = new ArrayList<TodoElement>(); ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()+8); |