[pmwiki-users] experimental - pagelist conditionals

Patrick R. Michaud pmichaud at pobox.com
Wed May 2 11:47:32 CDT 2007


On Wed, May 02, 2007 at 06:35:16PM +0200, christian.ridderstrom at gmail.com wrote:
> On Wed, 2 May 2007, Patrick R. Michaud wrote:
> >Yes... and it's not necessary to use the {(substr ...)} .
> >The date converter will search any string for the first
> >date-looking-thing that it finds (see below).  So, even
> >for a page named "News-yyyy-mm-dd" one can do
> >
> >   (:if date 2007-05-01..2007-05-31 {*$Name}:)
> 
> I believe this gives an affirmative answer to my question if 
> "Meeting2007-05-31" would match the above. Nice :-)

Correct.  Anything that has the yyyy-mm-dd format
somewhere in the string (or the other formats I listed) 
can be parsed as a date.

> >The date converter understands the following formats:
> >
> >-  A string starting with '@' and a sequence of digits is treated
> >  as a unix timestamp
> 
> Hmm... I'd assumed the source of the string to be a page name (I wasn't 
> thinking about page variables). 

Dates could come from a lot of places -- page names, page variables,
page text variables, input forms, etc.  So, this gives us a way
to work with them all.

> Anyway, can a page name contain a '@'?

Page names cannot contain a '@', but I suspect it's not common
to have a Unix timestamp in the middle of a pagename.  For page names
that are themselves unix timestamps, one can always do something like
the following to include the leading '@':

    (:if date 2007-05-01..2007-05-31 @{*$Name} :)

If we need anything more than that, there are a bunch of ways
for us to be able to get there.  :-)

Pm



More information about the pmwiki-users mailing list