[pmwiki-users] silly question about (:if match :)

Patrick R. Michaud pmichaud at pobox.com
Mon Oct 16 15:11:34 CDT 2006


On Mon, Oct 16, 2006 at 08:42:19PM +0200, Wouter Groeneveld wrote:
>    Suppose I have the following pages
> 
>    Cat/SomePage
>    Cat/SomePage_detail1
>    Cat/SomePage_detail2
>    AnotherCat/Page
>    AnotherCat/Page_detail
> 
>    I'd like to create a pagelist directive wich sorts them this way:
> 
>    Cat/
>      SomePage
>         detail1
>         detail2
>    AnoterhCat/
>      Page
>         detail


... there's not currently a way to do pattern or wildcard matching
of pagenames within a pagelist template (e.g., to find names with
or without underscores).

I think this is definitely something that should be added.
However, I need a good name for a "wildcard match" condition
to use as a parameter to (:if:).  The existing 'match' conditional
only works with regular expressions and only against the current pagename.

In fact, here's what we have now:

    (:if name wildcard:)          -- true if the currently displayed page's 
                                     name matches the wildcard
    (:if group wildcard:)         -- true if the currently displayed page's 
                                     group matches the wildcard
    (:if match pattern:)          -- true if the currently displayed page's
                                     name matches the regex pattern
    (:if equal arg1 arg2:)        -- true if arg1 == arg2


What we really ought to have is

    (:if equal arg1 [arg2]:)      -- true if arg1 == arg2
    (:if regex pattern arg1:)   -- true if arg1 matches pattern regex
    (:if ???   wildcard arg1:)  -- true if arg1 matches the given wildcard

but I don't know what to use for the '???' here.  

Then we can see about extending the 'name' and 'group' conditionals to
take a pagename argument, so that they can be used to match on pagenames
other than "the currently displayed page".

Pm




More information about the pmwiki-users mailing list