summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoWrefAttr.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2013-04-06 20:18:10 +0200
committerDavid A. Madore <david+git@madore.org>2013-04-06 20:18:10 +0200
commita49cff43d551b29dd726a6d5c19aba31db3bfc71 (patch)
treebc3fcaebfee6b0d457e918f878ca8852a906c85a /org/madore/damlengine/TodoWrefAttr.java
parent2836e8c6547a04a35e08abc14f4d97e5afaf7243 (diff)
downloaddamlengine-a49cff43d551b29dd726a6d5c19aba31db3bfc71.tar.gz
damlengine-a49cff43d551b29dd726a6d5c19aba31db3bfc71.tar.bz2
damlengine-a49cff43d551b29dd726a6d5c19aba31db3bfc71.zip
Support for d:wrefcat attribute to create links inside a category.
Diffstat (limited to 'org/madore/damlengine/TodoWrefAttr.java')
-rw-r--r--org/madore/damlengine/TodoWrefAttr.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java
index 7f40959..7f69a96 100644
--- a/org/madore/damlengine/TodoWrefAttr.java
+++ b/org/madore/damlengine/TodoWrefAttr.java
@@ -33,6 +33,13 @@ public class TodoWrefAttr extends TodoAttr {
String wrefNumberStr = wrefMatcher.group(4);
int wrefNumber = Integer.parseInt(wrefNumberStr);
String wrefSupplementStr = wrefMatcher.group(5);
+ String wrefCat;
+ if ( this.owner.hasAttributeNS(DamlEngine.DAML_NS, "wrefcat") ) {
+ wrefCat = this.owner.getAttributeNS(DamlEngine.DAML_NS, "wrefcat");
+ this.owner.removeAttributeNS(DamlEngine.DAML_NS, "wrefcat");
+ } else {
+ wrefCat = null;
+ }
String targetFile;
String targetStdDir = (ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/");
WeblogSummary wsum = WeblogSummary.getSummary();
@@ -47,6 +54,10 @@ 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 ( 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("") ) {
@@ -59,6 +70,8 @@ public class TodoWrefAttr extends TodoAttr {
} else if ( ctx.wsc != null && ctx.wsc.sel != null
&& ctx.wsc.sel.contains(wrefNumber) ) {
targetFile = "";
+ } else if ( wrefCat != null ) {
+ targetFile = targetStdDir + wrefCat + ".html";
} else {
targetFile = targetStdDir + wrefYearStr + "-" + wrefMonthStr + ".html";
if ( esum != null && esum.doSinglePage != null