summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoWrefAttr.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-08-28 19:52:02 +0200
committerDavid A. Madore <david+git@madore.org>2011-08-28 19:52:02 +0200
commit3b1023c45a919f25ef38c080f2ac2c0dc5d5e7ca (patch)
tree109f659090d4f08bc11f8da0f16fbff364dbbf9a /org/madore/damlengine/TodoWrefAttr.java
parent9c54e57c4a2e7029d8dbcd65ae63353135a18401 (diff)
downloaddamlengine-3b1023c45a919f25ef38c080f2ac2c0dc5d5e7ca.tar.gz
damlengine-3b1023c45a919f25ef38c080f2ac2c0dc5d5e7ca.tar.bz2
damlengine-3b1023c45a919f25ef38c080f2ac2c0dc5d5e7ca.zip
(Preliminary) handling of weblog entry selection and summary.
Diffstat (limited to 'org/madore/damlengine/TodoWrefAttr.java')
-rw-r--r--org/madore/damlengine/TodoWrefAttr.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java
index 60fec1d..df30d99 100644
--- a/org/madore/damlengine/TodoWrefAttr.java
+++ b/org/madore/damlengine/TodoWrefAttr.java
@@ -33,10 +33,8 @@ public class TodoWrefAttr extends TodoAttr {
String wrefNumberStr = wrefMatcher.group(4);
String wrefSupplementStr = wrefMatcher.group(5);
String targetFile = "";
- if ( ctx.wsc != null
- && ctx.wsc instanceof Context.WeblogMonthSelectionContext
- && wrefYearStr.equals(((Context.WeblogMonthSelectionContext)ctx.wsc).year)
- && wrefMonthStr.equals(((Context.WeblogMonthSelectionContext)ctx.wsc).month) )
+ if ( ctx.wsc != null && ctx.wsc.sel != null
+ && ctx.wsc.sel.contains(new Integer(wrefNumberStr)) )
targetFile = "";
else
targetFile = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/"))
@@ -48,6 +46,21 @@ public class TodoWrefAttr extends TodoAttr {
this.owner.setAttributeNS(null, "href", target);
if ( ! this.owner.hasAttributeNS(null, "class") )
this.owner.setAttributeNS(null, "class", "weblog-internal-link");
+ if ( wrefSupplementStr.equals("")
+ && ! this.owner.hasAttributeNS(null, "title") ) {
+ WeblogSummary wsum = WeblogSummary.getSummary();
+ if ( wsum != null && wsum.entries != null ) {
+ WeblogSummary.EntrySummary esum
+ = wsum.entries.get(new Integer(wrefNumberStr));
+ if ( esum != null ) {
+ if ( ! ((wrefYearStr+"-"+wrefMonthStr+"-"+wrefDayStr)
+ .equals(esum.date)) )
+ System.err.println("warning: date mismatch for reference to entry "+wrefNumberStr);
+ if ( esum.title != null )
+ this.owner.setAttributeNS(null, "title", esum.title);
+ }
+ }
+ }
}
}