On Fri, Jan 12, 2007 at 11:14:51AM +0100, [EMAIL PROTECTED] wrote:
> How can I pass a parameter from the markup defintion to a function.
> The following code shows always $1 instead of it's contnet.
>
> Markup("mymu", "inline", "/_mymu_ (.*?) _mymu_/", myFunc('$1') );
>
> function myFunc($inp) {
> // does not prnt $inp, it prints "$1"
> printf("inp=%s \n", $inp);
> }
If you want to execute a function on a pattern, you need to use the
/e option on the pattern, and enclose the code to be executed in quotes.
Also, if $1 might contain quotes or backslashes in it, you'll
want to surround it with PSS(). Thus:
Markup('mymu', 'inline',
'/_mymu_ (.*?) _mymu_/e',
"myFunc(PSS('$1'))");
See http://www.pmwiki.org/wiki/PmWiki/CustomMarkup< especially the
section "Define a markup to call a custom function...".
Pm
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users