summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-11 01:51:01 +0200
committerDavid A. Madore <david+git@madore.org>2014-10-11 01:51:01 +0200
commit249890ebd2da16e3ff515e0b515cd5ffe15eb368 (patch)
treed09991fdacd1863532aa82be3b58ce17f53d274c /org/madore/damlengine
parentf4e0494e6509cecce22346f6241831d3a5791847 (diff)
downloaddamlengine-249890ebd2da16e3ff515e0b515cd5ffe15eb368.tar.gz
damlengine-249890ebd2da16e3ff515e0b515cd5ffe15eb368.tar.bz2
damlengine-249890ebd2da16e3ff515e0b515cd5ffe15eb368.zip
Add links to whole months pages in the index.
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r--org/madore/damlengine/TodoWeblogIndexSelectElement.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/org/madore/damlengine/TodoWeblogIndexSelectElement.java b/org/madore/damlengine/TodoWeblogIndexSelectElement.java
index 9d2d3af..9e1e9bc 100644
--- a/org/madore/damlengine/TodoWeblogIndexSelectElement.java
+++ b/org/madore/damlengine/TodoWeblogIndexSelectElement.java
@@ -34,16 +34,19 @@ public final class TodoWeblogIndexSelectElement extends TodoDefaultElement {
throw new IllegalStateException("weblog-index-select element encountered with no weblog summary available");
}
TreeSet<Integer> entlist = new TreeSet<Integer>(wsum.entries.keySet());
- Element ul = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "ul");
- ul.setAttributeNS(null, "id", "index");
- ul.appendChild(ctx.doc.createTextNode("\n"));
- node.getParentNode().replaceChild(ul, node);
+ Element ul0 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "ul");
+ ul0.setAttributeNS(null, "id", "index");
+ ul0.appendChild(ctx.doc.createTextNode("\n"));
+ node.getParentNode().replaceChild(ul0, node);
final DOMImplementationLS domi
= (DOMImplementationLS)ctx.doc.getImplementation();
LSParser par = domi.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
ArrayList<TodoElement> toProcess
= new ArrayList<TodoElement>(entlist.size()*2);
Context ctx2 = ctx.clone(); ctx2.killA = true;
+ String prevYandm = null;
+ Element li0 = null; Element ul = null;
+ final String baseDir = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/"));
for ( Iterator<Integer> iter=entlist.descendingIterator() ; iter.hasNext() ; ) {
final WeblogSummary.EntrySummary ent = wsum.entries.get(iter.next());
final Matcher matcher = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})$").matcher(ent.date);
@@ -53,10 +56,28 @@ public final class TodoWeblogIndexSelectElement extends TodoDefaultElement {
final String monthStr = matcher.group(2);
final String dayStr = matcher.group(3);
final String numberStr = String.format("%04d",ent.id);
- final String baseDir = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/"));
+ final String yandmStr = yearStr + "-" + monthStr;
final WeblogLink lk = new WeblogLink(yearStr, monthStr, dayStr,
numberStr, "",
ent.doSinglePage);
+ if ( li0 == null || ul == null || ! yandmStr.equals(prevYandm) ) {
+ li0 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "li");
+ ul0.appendChild(li0);
+ ul0.appendChild(ctx.doc.createTextNode("\n"));
+ li0.setAttributeNS(null, "id", "d."+yandmStr);
+ Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
+ li0.appendChild(a);
+ lk.setTypeMonth();
+ a.setAttributeNS(null, "href", lk.getFile(baseDir));
+ String mstr = TodoWeblogMonthsCalendar.monthAbbr[Integer.parseInt(monthStr)] + " " + yearStr;
+ a.appendChild(ctx.doc.createTextNode(mstr));
+ li0.appendChild(ctx.doc.createTextNode(":\n"));
+ ul = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "ul");
+ li0.appendChild(ul);
+ li0.appendChild(ctx.doc.createTextNode("\n"));
+ ul.appendChild(ctx.doc.createTextNode("\n"));
+ prevYandm = yandmStr;
+ }
lk.setTypeStandard();
String target = lk.getTarget(baseDir);
Element li = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "li");