summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-10 14:50:30 (GMT)
committerDavid A. Madore <david+git@madore.org>2014-10-10 14:50:30 (GMT)
commit01ad55efbfb3b0056efaa0f9a7d7c48765d7db81 (patch)
tree9148ef9f713d9d31fae3444217c047755677e2cb
parent00f33d7378a04bf8dd83ac4c033eb98c0133eedb (diff)
parent608c0e55989d40c0f8f3a47c244356acf5002f48 (diff)
downloaddamlengine-01ad55efbfb3b0056efaa0f9a7d7c48765d7db81.zip
damlengine-01ad55efbfb3b0056efaa0f9a7d7c48765d7db81.tar.gz
damlengine-01ad55efbfb3b0056efaa0f9a7d7c48765d7db81.tar.bz2
Merge branch 'master' into servlet
-rw-r--r--org/madore/damlengine/TodoWXrefAttr.java2
-rw-r--r--org/madore/damlengine/TodoWrefAttr.java15
2 files changed, 12 insertions, 5 deletions
diff --git a/org/madore/damlengine/TodoWXrefAttr.java b/org/madore/damlengine/TodoWXrefAttr.java
index 5065465..bb1c861 100644
--- a/org/madore/damlengine/TodoWXrefAttr.java
+++ b/org/madore/damlengine/TodoWXrefAttr.java
@@ -38,6 +38,8 @@ public class TodoWXrefAttr extends TodoAttr {
= ctx.doc.createAttributeNS(DamlEngine.DAML_NS, "d:wref");
newAttr.setValue(target);
this.owner.setAttributeNodeNS(newAttr);
+ // Force linking to the month page.
+ this.owner.setAttributeNS(DamlEngine.DAML_NS, "d:wrefcat", "@month");
this.ownerDeque.registerAtStart(new TodoWrefAttr(newAttr, this.owner,
this.ctx, this));
} else {
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java
index 9341919..b707a95 100644
--- a/org/madore/damlengine/TodoWrefAttr.java
+++ b/org/madore/damlengine/TodoWrefAttr.java
@@ -54,13 +54,16 @@ public class TodoWrefAttr extends TodoAttr {
if ( ! ((wrefYearStr+"-"+wrefMonthStr+"-"+wrefDayStr)
.equals(esum.date)) )
throw new IllegalArgumentException("date mismatch for reference to entry "+wrefNumberStr);
- if ( wrefCat != null ) {
+ if ( wrefCat != null && ! wrefCat.equals("@month") ) {
if ( esum.catSet == null || ! esum.catSet.contains(wrefCat) )
throw new IllegalArgumentException("reference to entry "+wrefNumberStr+" in wrong category "+wrefCat);
}
}
// Choose file portion of link target
if ( esum != null && esum.doSinglePage != null && ! wrefSupplementStr.equals("") ) {
+ // Linking to a _fragment_ of an entry that has a single page.
+ if ( wrefCat != null )
+ System.err.println("warning: ignoring d:wrefcat attribute!");
if ( ctx.wsc != null && ctx.wsc.sel != null
&& ctx.wsc instanceof Context.WeblogSingleSelectionContext
&& ((Context.WeblogSingleSelectionContext)ctx.wsc).number == wrefNumber )
@@ -69,16 +72,18 @@ public class TodoWrefAttr extends TodoAttr {
targetFile = targetStdDir + esum.date + "-" + esum.doSinglePage + ".html";
} else if ( ctx.wsc != null && ctx.wsc.sel != null
&& ctx.wsc.sel.contains(wrefNumber) ) {
+ // Linking to an entry already present on this page.
targetFile = "";
- } else if ( wrefCat != null ) {
+ } else if ( wrefCat != null && ! wrefCat.equals("@month") ) {
+ // Linking to an entry in a designated category.
targetFile = targetStdDir + wrefCat + ".html";
} else {
+ // Linking to an entry in its month, or single page.
targetFile = targetStdDir + wrefYearStr + "-" + wrefMonthStr + ".html";
if ( esum != null && esum.doSinglePage != null
// Note to self: remember we could be called from d:wxref
- // because of link on "older entries": we don't want
- // to link to single entry page in this case. :-\
- && ! ( caller instanceof TodoWXrefAttr ) ) {
+ // because of link on "older entries".
+ && ( wrefCat == null || ! wrefCat.equals("@month") ) ) {
targetFile = targetStdDir + esum.date + "-" + esum.doSinglePage + ".html";
}
}