summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoFooter.java
blob: 9af9df151e726d0504dce0d4429570dc4324f934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package org.madore.damlengine;

import java.util.ArrayList;
import java.util.regex.Pattern;
import org.w3c.dom.*;

public final class TodoFooter extends TodoElement {

    public TodoFooter(Element node,
		      Context ctx,
		      TodoItem caller) {
	super(node, ctx, caller);
    }

    @Override
    public void handle() {
	Element footer = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "footer");
	node.getParentNode().insertBefore(footer, node);
	node.getParentNode().insertBefore(ctx.doc.createTextNode("\n"), node);
	footer.setAttributeNS(null, "class", "cleared");
	ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(2);
	Element hr = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "hr");
	footer.appendChild(hr);
	footer.appendChild(ctx.doc.createTextNode("\n"));
	Element jsFootSpace = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "div");
	footer.appendChild(jsFootSpace);
	footer.appendChild(ctx.doc.createTextNode("\n"));
	jsFootSpace.setAttributeNS(null, "id", "js-foot-space");
	jsFootSpace.appendChild(ctx.doc.createComment(" To be filled by JavaScript "));
	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(" ("));
	Element email = ctx.doc.createElementNS(DamlEngine.DAML_NS, "d:email-despammed");
	addr.appendChild(email);
	email.appendChild(ctx.doc.createTextNode("david"));
	email.appendChild(ctx.doc.createElementNS(DamlEngine.DAML_NS, "d:email-plus"));
	email.appendChild(ctx.doc.createTextNode("www"));
	email.appendChild(ctx.doc.createElementNS(DamlEngine.DAML_NS, "d:email-at"));
	email.appendChild(ctx.doc.createTextNode("madore"));
	email.appendChild(ctx.doc.createElementNS(DamlEngine.DAML_NS, "d:email-dot"));
	email.appendChild(ctx.doc.createTextNode("org"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href",
			 ((ctx.gc.uriToTop==null)?"http://www.madore.org/~david/"
			  :ctx.gc.uriToTop) + "ego.html");
	a.setAttributeNS(null, "rel", "author");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("\u2042"));
	// addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	// addr.appendChild(ctx.doc.createTextNode("|"));
	// a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	// a.setAttributeNS(null, "href", "https://plus.google.com/+davidamadore");
	// a.setAttributeNS(null, "rel", "author");
	// addr.appendChild(a);
	// a.appendChild(ctx.doc.createTextNode("Google+"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href", "https://twitter.com/gro_tsen");
	a.setAttributeNS(null, "rel", "me");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("Twitter"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href", "https://bsky.app/profile/gro-tsen.bsky.social");
	a.setAttributeNS(null, "rel", "me");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("Bluesky"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href", "https://mastodon.sdf.org/@gro_tsen_test");
	a.setAttributeNS(null, "rel", "me");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("Mastodon (test)"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href", "https://www.reddit.com/user/Gro-Tsen/");
	a.setAttributeNS(null, "rel", "me");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("Reddit"));
	addr.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "wbr"));
	addr.appendChild(ctx.doc.createTextNode("|"));
	a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
	a.setAttributeNS(null, "href", "http://www.facebook.com/grotsen");
	a.setAttributeNS(null, "rel", "me");
	addr.appendChild(a);
	a.appendChild(ctx.doc.createTextNode("Facebook (unused)"));
	addr.appendChild(ctx.doc.createTextNode(")"));
	Node ws = node.getNextSibling();
	if ( ws != null && ( ws.getNodeType() == Node.TEXT_NODE
	       || ws.getNodeType() == Node.CDATA_SECTION_NODE )
	     && Pattern.matches("^\\s*$",((CharacterData)ws).getData()) )
	    node.getParentNode().removeChild(ws);
	node.getParentNode().removeChild(node);
	this.ownerDeque.registerAtStart(toProcess);
    }

}