[pmwiki-users] Re: Conditional Markup enhancement
chr at home.se
chr at home.se
Tue Mar 1 02:39:57 CST 2005
On Mon, 28 Feb 2005, Patrick R. Michaud wrote:
> ParseArgs also understands single and double quotes, thus one
> can have arguments like key="value with spaces".
Sounds very useful, and the only problem is that it will lose argument
order (not that I use it very often, but it might be good to have in some
cases).
> For example, if $x contains
>
> 123 list=none +list -any "apple pie" title="my page" "+plus" +"something"
1 2 3 4 5 6 7 8
> 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'
One solution could be to let each "data item" contain the argument's
position, like this perhaps:
> $args[''] array(array(1=>'123'),
array(5=>'apple pie')
array(7=>'+plus'))
> $args['list'] array(2=>'none')
> $args['+'] array(array(3=>'list'),
array(8=>'something'))
> $args['-'] array(array(4=>'any'))
> $args['title'] array(6=>'my page')
Another solution could be to add an element to $args that contiain an
ordered list of the parameters that is also categorized, e.g.
$args['ordered-parameters'] =
array(array(''=>'123'),
array('list'=>'none'),
array('+'=>'list'),
array('-'=>'any'),
array(''=>'apple pie'),
array('title'=>'my page'),
array(''=>'+plus'),
array('+'=>'something')
)
I'm sure there are many other possibilites.
/Christian
--
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list