diff options
-rw-r--r-- | org/madore/damlengine/TodoDamlElement.java | 9 | ||||
-rw-r--r-- | org/madore/damlengine/TodoFooter.java | 27 | ||||
-rw-r--r-- | org/madore/damlengine/TodoWXrefAttr.java | 4 | ||||
-rw-r--r-- | org/madore/damlengine/TodoWeblogSelectionElement.java | 4 | ||||
-rw-r--r-- | org/madore/damlengine/WeblogSelect.java | 2 | ||||
-rw-r--r-- | org/madore/damlengine/WeblogServlet.java | 9 |
6 files changed, 44 insertions, 11 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java index 50c39bb..7cd94e3 100644 --- a/org/madore/damlengine/TodoDamlElement.java +++ b/org/madore/damlengine/TodoDamlElement.java @@ -58,7 +58,12 @@ public final class TodoDamlElement extends TodoDefaultElement { Element bodyNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "body"); htmlNode.appendChild(bodyNode); htmlNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.setAttributeNS(null, "onload", "onLoad()"); + bodyNode.setAttributeNS(null, "onload", "if (onLoad) { onLoad(); }"); + Element earlyScript = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "script"); + earlyScript.setAttributeNS(null, "type", "text/javascript"); + earlyScript.appendChild(ctx.doc.createTextNode("if (onEarly) { onEarly(); }")); + bodyNode.appendChild(ctx.doc.createTextNode("\n")); + bodyNode.appendChild(earlyScript); ctx.gc.styleContent = new StringBuffer(); try { @@ -113,7 +118,7 @@ public final class TodoDamlElement extends TodoDefaultElement { final WeblogSummary wsum = WeblogSummary.getSummary(ctx.dc); if ( wsum != null ) { final WeblogSummary.EntrySummary esum - = wsum.entries.get(new Integer(((Context.WeblogSingleSelectionContext)(ctx.wsc)).number)); + = wsum.entries.get(Integer.valueOf(((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"); diff --git a/org/madore/damlengine/TodoFooter.java b/org/madore/damlengine/TodoFooter.java index 90d4f5f..cace28c 100644 --- a/org/madore/damlengine/TodoFooter.java +++ b/org/madore/damlengine/TodoFooter.java @@ -22,6 +22,11 @@ public final class TodoFooter extends TodoElement { 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")); @@ -45,6 +50,7 @@ public final class TodoFooter extends TodoElement { 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", @@ -53,22 +59,39 @@ public final class TodoFooter extends TodoElement { 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", "author"); + 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", "http://www.facebook.com/grotsen"); - a.setAttributeNS(null, "rel", "author"); + a.setAttributeNS(null, "rel", "me"); addr.appendChild(a); a.appendChild(ctx.doc.createTextNode("Facebook")); addr.appendChild(ctx.doc.createTextNode(")")); diff --git a/org/madore/damlengine/TodoWXrefAttr.java b/org/madore/damlengine/TodoWXrefAttr.java index 2f0ca3c..68e5c54 100644 --- a/org/madore/damlengine/TodoWXrefAttr.java +++ b/org/madore/damlengine/TodoWXrefAttr.java @@ -30,9 +30,9 @@ public class TodoWXrefAttr extends TodoAttr { + (wxrefStr.equals("##weblog-selection-older") ? -1 : 1); WeblogSummary sum = WeblogSummary.getSummary(ctx.dc); if ( sum != null && sum.entries != null - && sum.entries.containsKey(new Integer(trgt)) ) { + && sum.entries.containsKey(Integer.valueOf(trgt)) ) { WeblogSummary.EntrySummary ent - = sum.entries.get(new Integer(trgt)); + = sum.entries.get(Integer.valueOf(trgt)); String target = "#d." + ent.date + "." + String.format("%04d", ent.id); this.owner.removeAttributeNode(this.attr); diff --git a/org/madore/damlengine/TodoWeblogSelectionElement.java b/org/madore/damlengine/TodoWeblogSelectionElement.java index 437da1f..3029f9f 100644 --- a/org/madore/damlengine/TodoWeblogSelectionElement.java +++ b/org/madore/damlengine/TodoWeblogSelectionElement.java @@ -79,6 +79,8 @@ public final class TodoWeblogSelectionElement extends TodoDefaultElement { categoryNames.get("en").put("lang", "Languages & Linguistics"); categoryNames.get("fr").put("lang", "Langues & Linguistique"); categoryNames.get("ia").put("lang", "Liguas & Linguistica"); + categoryNames.get("en").put("meteo", "Meteorology"); + categoryNames.get("fr").put("meteo", "M\u00e9t\u00e9orologie"); categoryNames.get("en").put("unicode", "Unicode"); categoryNames.get("fr").put("unicode", "Unicode"); categoryNames.get("en").put("cinema", "Films & Movies"); @@ -173,7 +175,7 @@ public final class TodoWeblogSelectionElement extends TodoDefaultElement { if ( wsum == null || wsum.entries == null ) throw new IllegalStateException("failed to obtain weblog summary for weblog-selection-single-title"); WeblogSummary.EntrySummary esum - = wsum.entries.get(new Integer(((Context.WeblogSingleSelectionContext)(ctx.wsc)).number)); + = wsum.entries.get(Integer.valueOf(((Context.WeblogSingleSelectionContext)(ctx.wsc)).number)); if ( esum == null ) throw new IllegalStateException("tried weblog-selection-single-title on inexistent entry"); { diff --git a/org/madore/damlengine/WeblogSelect.java b/org/madore/damlengine/WeblogSelect.java index 4e759cc..d6ede8b 100644 --- a/org/madore/damlengine/WeblogSelect.java +++ b/org/madore/damlengine/WeblogSelect.java @@ -48,7 +48,7 @@ public final class WeblogSelect { while ( selRes.next() ) { int id = selRes.getInt(1); String content = selRes.getString(2); - wsc.sel.add(new Integer(id)); + wsc.sel.add(Integer.valueOf(id)); wsc.xmlData.add(content); } diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java index 0f7341c..86f231a 100644 --- a/org/madore/damlengine/WeblogServlet.java +++ b/org/madore/damlengine/WeblogServlet.java @@ -89,8 +89,10 @@ public class WeblogServlet extends HttpServlet { String specialName = selRes.getString(3); if ( id != number ) throw new ServletException("this cannot happen"); - if ( extra != null && ! extra.equals(specialName) ) - return new NoSuchPath(); + if ( ! ( ( extra == null && specialName == null ) + || ( extra != null && specialName != null + && extra.equals(specialName) ) ) ) + return new SingleBlogEntryRedirectPath(date, id, specialName); long lastModified = (long)(mdate*1000); long thisLastModified; try { @@ -108,6 +110,7 @@ public class WeblogServlet extends HttpServlet { throw new ServletException(e); } } + // Legacy support for an old permalink format: if ( inGet && (matcher=Pattern.compile("/d\\.(\\d{4}-\\d{2}-\\d{2})\\.([\\p{Alpha}][\\p{Alnum}\\-]*)\\.html").matcher(pathInfo)).matches() ) { final String date; final String extra; @@ -151,7 +154,7 @@ public class WeblogServlet extends HttpServlet { static final class SingleBlogEntryRedirectPath extends RequestPath { public String date; public int number; - public String extra; + public String extra; // May be null (passed to WeblogLink class) public SingleBlogEntryRedirectPath(String date, int number, String extra) { this.date = date; this.number = number; |