From 5b15f489d9793afdfe5dde2a2934c975b61567bd Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Fri, 10 Oct 2014 17:37:54 +0200 Subject: Add the principle of a d:wrefcat="@single" type. --- org/madore/damlengine/TodoWrefAttr.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'org') diff --git a/org/madore/damlengine/TodoWrefAttr.java b/org/madore/damlengine/TodoWrefAttr.java index aeb8bb2..428000a 100644 --- a/org/madore/damlengine/TodoWrefAttr.java +++ b/org/madore/damlengine/TodoWrefAttr.java @@ -54,7 +54,8 @@ 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 && ! wrefCat.equals("@month") ) { + if ( wrefCat != null && ! wrefCat.equals("@month") + && ! wrefCat.equals("@single") ) { if ( esum.catSet == null || ! esum.catSet.contains(wrefCat) ) throw new IllegalArgumentException("reference to entry "+wrefNumberStr+" in wrong category "+wrefCat); } @@ -62,7 +63,7 @@ public class TodoWrefAttr extends TodoAttr { // Choose file portion of link target if ( esum != null && esum.doSinglePage != null && ! wrefSupplementStr.equals("") ) { // Linking to a _fragment_ of an entry that has a single page. - if ( wrefCat != null ) + if ( wrefCat != null && ! wrefCat.equals("@single") ) System.err.println("warning: ignoring d:wrefcat attribute!"); if ( ctx.wsc != null && ctx.wsc.sel != null && ctx.wsc instanceof Context.WeblogSingleSelectionContext @@ -74,7 +75,8 @@ public class TodoWrefAttr extends TodoAttr { && ctx.wsc.sel.contains(wrefNumber) ) { // Linking to an entry already present on this page. targetFile = ""; - } else if ( wrefCat != null && ! wrefCat.equals("@month") ) { + } else if ( wrefCat != null && ! wrefCat.equals("@month") + && ! wrefCat.equals("@single") ) { // Linking to an entry in a designated category. targetFile = targetStdDir + wrefCat + ".html"; } else { @@ -83,7 +85,7 @@ public class TodoWrefAttr extends TodoAttr { if ( esum != null && esum.doSinglePage != null // Note to self: remember we could be called from d:wxref // because of link on "older entries". - && ( wrefCat == null || ! wrefCat.equals("@month") ) ) { + && ( wrefCat == null || wrefCat.equals("@single") ) ) { targetFile = targetStdDir + esum.date + "-" + esum.doSinglePage + ".html"; } } -- cgit v1.2.3