[pmwiki-users] Conditional Markup enhancement

Patrick R. Michaud pmichaud at pobox.com
Mon Feb 28 16:26:52 CST 2005


On Mon, Feb 28, 2005 at 10:51:55PM +0100, Dominique Faure wrote:
> Hi,
> 
> I just published the 
> http://www.pmwiki.org/wiki/Cookbook/ConditionalExtensions recipe, and 
> before improving it, I wanted to know, if something near 
> http://www.pmwiki.org/wiki/Cookbook/GettingMarkupArguments would be 
> available in pmwiki.php.

Yes, I've just prototyped it into the current pmwiki.org code where it's
currently running to process the (:pagelist:) and (:searchresults:) markup.

The version I have isn't identical to the way that GettingMarkupArguments
works because GettingMarkupArguments wouldn't really work for
pagelist and searchresults.  The version I have is called using

    $arg = ParseArgs($x);

where $x is the string with arguments to be processed.  The $arg
variable is populated as follows:

  - arguments of the form key=value or key:value are returned
    in $arg['key']
  - arguments of the form +value or -value are return as arrays
    in $arg['+'] and $arg['-']
  - all other arguments are returned as an array in $arg['']

ParseArgs also understands single and double quotes, thus one 
can have arguments like key="value with spaces".

For example, if $x contains

    123 list=none +list -any "apple pie" title="my page" "+plus" +"something"

then after executing $args=ParseArgs($x), $args will be:

    $args['']        array('123', 'apple pie', '+plus')
    $args['list']    'none'
    $args['+']       array('list', 'something')
    $args['-']       array('any')
    $args['title']   'my page'

This will be available in the next release (and I'll hurry the release
of beta24 so people can start using this).  Comments and suggestions welcome.

Pm



More information about the pmwiki-users mailing list