[pmwiki-devel] Regex and recipe philosphy
Simon
nzskiwi at gmail.com
Sun Jul 14 04:28:34 CDT 2013
Thank you everyone for your helpful feedback and answers.
I have uploaded the first version of the recipe
http://www.pmwiki.org/wiki/Cookbook/NZTopo
(testing it here<http://khandallah.wellington.net.nz/pmwiki/pmwiki.php/Main/WikiSandbox>),
as an inexperienced PHP developer treat me gently!
Let me add to the discussion to say while there is a accepted method of
doing this and thats fine,
that it seems to me that for both security and usability reasons better
definition of markup directive parameters is a good thing.
This is where PmWiki could help out recipe writers to some extent with, for
example, a precursor function to ParseArgs that might say DefineArgs,
allowing regex definition of individual arguments and supporting use of
arguments in any order.
thanks
Simon
On 14 July 2013 01:22, Peter Bowers <pbowers at pobox.com> wrote:
>
> On Fri, Jul 12, 2013 at 11:39 PM, Simon <nzskiwi at gmail.com> wrote:
>
>> most directives accept anything within their scope, then use
>> $arg = ParseArgs($args);
>>
>> Then the arguments defined are processed, and any unexpected arguments
>> are disregarded.
>>
>> So my corollary question is:
>> Is this good practice, or just expedient, given the difficulty (as I
>> perceive it) of defining a parameter list in regex?
>>
>
> Yes, both. It's good practice as well as being expedient. As already
> mentioned ParseArgs() is well-tested, elegant code which saves a developer
> a ton of time. At the same time its ability to handle positional or named
> parameters and to allow parameters to be specified in any order allows
> great flexibility on the part of users entering markup in pages (consider
> how difficult it would be if you had to remember the exact order of each
> parameter in a complex markup such as pagelist).
>
> -Peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20130714/9fd4afe8/attachment.html>
More information about the pmwiki-devel
mailing list