From 7050a6b7b8fbd1c3f2622d611139a5df801b9f95 Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Fri, 5 Apr 2013 20:20:20 +0200 Subject: Try changing when d:wref refers to the "single page" version of an entry. Prefer single page version except when link is local. --- org/madore/damlengine/TodoWrefAttr.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'org/madore') 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; -- cgit v1.2.3