<div>Hi Peter,</div><div><br></div><div>Thank you for your reply.</div><div>Until now, I can't make first (a) suggestion work (neither yyyy neither yyyy-mm)</div><div>I have to say that what I called Date (maybe a bad idea ?) is the yyyy year of the publication, not a yyyy-mm-dd formated date ; basically something like :</div>
<div>Date : 2003</div><div>or, (when multiple editions*)</div><div>Date : 1996, 2003, 2009</div><div>As there is no Date in form of : Date : 2003-01 I'm not sure I will get successfull using something like : if="date 1993-01..$:Date-01" (I deleted the space after ..).</div>
<div><br></div><div>(c) works and is clearer than mine.</div><div><br></div><div>I'm also in trouble with (b) greateq and numcomp (parse error, unexpected T_CASE ; for numcomp).</div><div><br></div><div>Of course, I may have done some errors while testing (a) and (c).</div>
<div><br></div><div><div>*Does anyone know how to extract the first 4 signs from a ptv, as in : </div><div>Date : 1896, 1932, 1966</div><div>{(substr "{=$:Date}" 0 4)} failed in following pagelist I test to select pages where 4 first types from Date are > 1993 (for example, Date : 1995, 2005) :</div>
<div>(:pagelist trail=Argot.BibliographieDesDictionnaires fmt=#titredate {(substr {=$:Date} 0 4)}=199[3-9],20[0-9][0-9] count=10:)</div></div><div><br></div><div>Thank you !</div><br><div class="gmail_quote">2009/10/29 Peter Bowers <span dir="ltr"><<a href="mailto:pbowers@pobox.com">pbowers@pobox.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Thu, Oct 29, 2009 at 6:49 PM, ABClf <<a href="mailto:languefrancaise@gmail.com">languefrancaise@gmail.com</a>> wrote:<br>
> Hello the list,<br>
> My question today is about using range, or > or < with pagelist.<br>
> My purpose is to list pages where $:Date is >=1993<br>
<br>
</div>I don't think this capability is built into pmwiki. Here are some<br>
possible alternatives...<br>
<br>
(a) Use the if="date 1993-01.. $:Date-01"<br>
<br>
I'm not sure if appending that -01is necessary or whether it will even<br>
work -- just an idea<br>
<br>
(b) Create your own conditional operator<br>
<br>
if="greateq $:Date 1993"<br>
<br>
See <a href="http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples" target="_blank">http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples</a> --<br>
I've taken a shot at modifying the "equal" condition below (no<br>
promises -- just a quick shot):<br>
<br>
$Conditions['greateq'] = 'GreaterEqualArgs($condparm) == 0';<br>
function GreaterEqualArgs($arg) {<br>
$arg = ParseArgs($arg); return (@$arg[''][0] >= @$arg[''][1]);<br>
}<br>
<br>
[1]<br>
<br>
(c) It's not ideal, but you can use character classes to make your<br>
wildcards a lot easier to maintain<br>
<div class="im"><br>
(:pagelist trail=Argot.BibliographieDesDictionnaires fmt=#title<br>
</div>$:Date=199[3-9],20[0-9][0-9]:)<br>
<br>
Hope that helps! (Note that these are just ideas to point you in<br>
possible directions - no testing whatsoever..)<br>
<br>
-Peter<br>
<br>
<br>
[1] This idea could be very easily generalized to allow for any binary<br>
numerical comparison...<br>
<br>
if="numcomp $:Date >= 1993"<br>
<br>
$Conditions['numcomp'] = 'NumericCompareArgs($condparm) == 0';<br>
function NumericCompareArgs($arg) {<br>
$arg = ParseArgs($arg);<br>
# Would be nice to check $arg[''][1] here using in_array() and give<br>
an error message<br>
# Would be nice to check for existence and numericalness of [0] and<br>
[2] and error nicely<br>
switch (@$arg[''][1]) {<br>
case '>': return (@$arg[''][0] > @$arg[''][2])<br>
case '>=': return (@$arg[''][0] >= @$arg[''][2])<br>
case '<': return (@$arg[''][0] < @$arg[''][2])<br>
case '<=': return (@$arg[''][0] <= @$arg[''][2])<br>
case '!=': return (@$arg[''][0] != @$arg[''][2])<br>
default: return (@$arg[''][0] == @$arg[''][2]);<br>
}<br>
}<br>
<br>
Of course it could be done much more simply with eval() but then you<br>
have all kinds of security implications and you end up with even more<br>
code to deal with that...<br>
<br>
No testing whatsoever on any of this code. You're on your own for that...<br>
</blockquote></div><br><br clear="all"><br>-- <br>---------------------------------------<br>| A | de la langue française<br>| B | <a href="http://www.languefrancaise.net/">http://www.languefrancaise.net/</a><br>| C | <a href="mailto:languefrancaise@gmail.com">languefrancaise@gmail.com</a><br>
---------------------------------------<br>