diff options
author | David A. Madore <david@alioth.(none)> | 2013-04-05 20:20:20 +0200 |
---|---|---|
committer | David A. Madore <david@alioth.(none)> | 2013-04-05 20:20:20 +0200 |
commit | 7050a6b7b8fbd1c3f2622d611139a5df801b9f95 (patch) | |
tree | 3b0152ef7a2f59fa8f3c94af0cdcf00c999d6f15 | |
parent | ff18369ec0ed685744b065cacd63878cbb8246dc (diff) | |
download | damlengine-7050a6b7b8fbd1c3f2622d611139a5df801b9f95.tar.gz damlengine-7050a6b7b8fbd1c3f2622d611139a5df801b9f95.tar.bz2 damlengine-7050a6b7b8fbd1c3f2622d611139a5df801b9f95.zip |
Try changing when d:wref refers to the "single page" version of an entry.
Prefer single page version except when link is local.
-rw-r--r-- | org/madore/damlengine/TodoWrefAttr.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java index 9f33406..95583e4 100644 --- a/org/madore/damlengine/TodoWrefAttr.java +++ b/org/madore/damlengine/TodoWrefAttr.java @@ -33,10 +33,12 @@ public class TodoWrefAttr extends TodoAttr { String wrefNumberStr = wrefMatcher.group(4); String wrefSupplementStr = wrefMatcher.group(5); String targetFile = ""; + boolean isLocal = false; if ( ctx.wsc != null && ctx.wsc.sel != null - && ctx.wsc.sel.contains(new Integer(wrefNumberStr)) ) + && ctx.wsc.sel.contains(new Integer(wrefNumberStr)) ) { + isLocal = true; targetFile = ""; - else + } else targetFile = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/")) + wrefYearStr + "-" + wrefMonthStr + ".html"; String targetFragment = "d." + wrefYearStr + "-" + wrefMonthStr @@ -53,11 +55,12 @@ public class TodoWrefAttr extends TodoAttr { .equals(esum.date)) ) throw new IllegalArgumentException("date mismatch for reference to entry "+wrefNumberStr); if ( esum.doSinglePage != null - && ! wrefSupplementStr.equals("") + && ! ( wrefSupplementStr.equals("") + && isLocal ) // 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. :-\ - && ! ( ctx.wsc instanceof Context.WeblogSingleSelectionContext ) ) { + && ! ( caller instanceof TodoWXrefAttr ) ) { targetFile = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/")) + esum.date + "-" + esum.doSinglePage + ".html"; target = targetFile + "#" + targetFragment; |