[pmwiki-users] Ingredients . . .

Dominique Faure dominique.faure at gmail.com
Tue Feb 7 08:18:51 CST 2006


2006/2/7, Patrick R. Michaud <pmichaud at pobox.com>:
> On Tue, Feb 07, 2006 at 10:38:01AM +0100, Dominique Faure wrote:
> >
> > In my case, I would vote for a 'more-satisfying-than-the-one-I-found
> > way to handle (url|intermap|attachment|pagename)s? in markup
> > parameters. I already have 3 or 4 published recipes which could be
> > improved and already found more in the Cookbook.
>
> What should we name this function?  (Coming up with good function
> and variable names is always the hardest part of programming... :-)
>

ResolveLink ?

My current way of dealing with (url|intermap|attachment)s? is to write
something like:

 # $arg is the reference given in the markup argument
 #
 $f = MakeLink($pagename, $arg, NULL, NULL, '$LinkUrl');
 if(strrpos($f, 'action=approvesites') !== false) return Keep($f);
 #
 # do what you want with $f

The (kludgy) test is here to catch unapproved urls. In this case, the
markup should render as an unapproved link only.

Pagenames have already the FmtPageName/PageExists artillery available.

IMHO, the real benefit of having ingredients in the core would to
avoid binding recipes too tight with specific literal values
('action=approvesites' in the given example), which could evolve on
their own (within the core).

Dom




More information about the pmwiki-users mailing list