[pmwiki-users] Markup Expression parameters

Petko Yotov 5ko at 5ko.fr
Mon Sep 28 16:31:21 CDT 2015

On 2015-09-28 12:59, Hans Bracker wrote:
> Trying to write a markup expression, I am having trouble getting the
> whole unaltered string from a PTV into my ME function.
> Only strings in double quotes do not get altered (but the double
> quotes get stripped, which I guess is okay).
> Otherwise PmWiki uses KeepTokens (if $params is used)
> and strips single quotes.
> I used both $params and $args to capture the string,
> with similar results.
> OTOH displaying  a PTV does not change anything.

In Markup expressions quoted strings are considered parameters; moreover 
there may be nested expressions which complicates things.

> as M.E.: {(fixptv {$:Music1})}

When markup expressions are processed, PmWiki actually sees here:
   {(fixptv Classical, "Rhythm & Blues", "Rock'n'Roll")}

i.e. at that point the PTV is already expanded to its value; then the 
markup expression function parses and escapes the parameters to allow 
nested expressions and processes the string as many times as there are 
nested expressions.

If your value contains parentheses like "(pop)rock" this will be 
considered another Markup expression and will be further escaped.

To get the unaltered value of the variable, maybe you could write this 
like {(fixptv $:Music1)} without the internal set of braces. Then your 
function can call PageTextVar() to get the value.


Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades

More information about the pmwiki-users mailing list