diff options
author | David A. Madore <david+git@madore.org> | 2013-04-06 19:28:03 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2013-04-06 19:28:03 +0200 |
commit | 2836e8c6547a04a35e08abc14f4d97e5afaf7243 (patch) | |
tree | 1b0375d2862b2e7b31db2cc0d955c73f5b700f21 /org | |
parent | 0f041a8ad9595584c9e048ec026ff87cbf481c6f (diff) | |
download | damlengine-2836e8c6547a04a35e08abc14f4d97e5afaf7243.tar.gz damlengine-2836e8c6547a04a35e08abc14f4d97e5afaf7243.tar.bz2 damlengine-2836e8c6547a04a35e08abc14f4d97e5afaf7243.zip |
Make local d:wref links inside single entry pages actually local.
Diffstat (limited to 'org')
-rw-r--r-- | org/madore/damlengine/TodoWrefAttr.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java index 0a94e0d..7f40959 100644 --- a/org/madore/damlengine/TodoWrefAttr.java +++ b/org/madore/damlengine/TodoWrefAttr.java @@ -31,6 +31,7 @@ public class TodoWrefAttr extends TodoAttr { String wrefMonthStr = wrefMatcher.group(2); String wrefDayStr = wrefMatcher.group(3); String wrefNumberStr = wrefMatcher.group(4); + int wrefNumber = Integer.parseInt(wrefNumberStr); String wrefSupplementStr = wrefMatcher.group(5); String targetFile; String targetStdDir = (ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/"); @@ -38,7 +39,7 @@ public class TodoWrefAttr extends TodoAttr { WeblogSummary.EntrySummary esum; // Get entry for target link from weblog summary if ( wsum != null && wsum.entries != null ) - esum = wsum.entries.get(new Integer(wrefNumberStr)); + esum = wsum.entries.get(wrefNumber); else esum = null; // Check consistency if summary was available @@ -49,9 +50,14 @@ public class TodoWrefAttr extends TodoAttr { } // Choose file portion of link target if ( esum != null && esum.doSinglePage != null && ! wrefSupplementStr.equals("") ) { - targetFile = targetStdDir + esum.date + "-" + esum.doSinglePage + ".html"; + if ( ctx.wsc != null && ctx.wsc.sel != null + && ctx.wsc instanceof Context.WeblogSingleSelectionContext + && ((Context.WeblogSingleSelectionContext)ctx.wsc).number == wrefNumber ) + targetFile = ""; + else + targetFile = targetStdDir + esum.date + "-" + esum.doSinglePage + ".html"; } else if ( ctx.wsc != null && ctx.wsc.sel != null - && ctx.wsc.sel.contains(new Integer(wrefNumberStr)) ) { + && ctx.wsc.sel.contains(wrefNumber) ) { targetFile = ""; } else { targetFile = targetStdDir + wrefYearStr + "-" + wrefMonthStr + ".html"; |