[Pmwiki-users] Injecting markup via replacements ?
Patrick R. Michaud
pmichaud
Sun Aug 1 11:24:29 CDT 2004
On Sun, Aug 01, 2004 at 11:40:20AM +0100, Ciaran wrote:
> Hmm, That would explain why nothign was working for me if I was using
> BrowseReplacements! However BrowseDirectives appears to spin out for
> me : (
> Is the following line meaningful ?
> $BrowseDirectives['/\\[\\[\\$Testing(?:(?:\\s)+((?:.)*))*\\]\\]/e'] =
> "Testing('$1');";
>
> Where Testing is a function that returns a markup string ?
Well, the regexp seems a bit hard to parse. Try I rewriting it as:
$BrowseDirectives['/\\[\\[\\$Testing\\s+(.*?)\\]\\]/e'] =
"Testing('$1');";
Note that you need the '?' in the part you want to match (minimal match),
otherwise .* will match everything up to the *last* ]] in the markup,
and not just the next one it finds.
If you want the \\s+ to be optional (i.e., someone can write [[$Testing]],
then use:
$BrowseDirectives['/\\[\\[\\$Testing(\\s+(.*?))?\\]\\]/e'] =
"Testing('$2');";
Pm
More information about the pmwiki-users
mailing list