[pmwiki-users] Custom Markup Expression: how to access quoted parameters

Hans design1 at softflow.uk
Sun Jun 4 11:24:23 CDT 2017

> If I use preg_replace($rpat, $rrep, $params) I can then see only something like
> $GLOBALS["KPV"][$m[1]]

The description in scripts/markupexpr.php says about use of $params:

Note that $params
may contain escaped values representing quoted arguments and
results of other expressions; these values may be un-escaped
by using "preg_replace($rpat, $rrep, $params)".

Then the argument  string can be accessed, but strings in double
quotes are represented by Keep Tokens like "3P"

If I use "PPRE($rpat, $rrep, $params)" I can get the whole string
without Keep Tokens, but actual values. Only problem is: the double
quotes are stripped. So for instance   "abc def" xyz
will become a string "abc def xyz" (without the quotes), and
"abc def" "xyz 123" will become "abc def xyz 123" (without the quotes.

How can the double quotes be preserved, so my custom function can
differentiate between "abc def" and "xyz 123"? I.e. can treat it as
the two distinct terms entered?

And should the description in the script be changed to read:

these values may be un-escaped by using "PPRE($rpat, $rrep, $params)".


More information about the pmwiki-users mailing list