[pmwiki-users] PageTextVariable: own "automatic variable" format

Patrick R. Michaud pmichaud at pobox.com
Tue Mar 20 08:59:09 CDT 2007


On Tue, Mar 20, 2007 at 02:50:09PM +0100, Knut Alboldt wrote:
> ... it doesn't seems to work like I exspected it:
> 
> used:
> $PageTextVarPatterns['var::'] =  '/^([-a-zA-Z_ ]+)\\s*::[ \\t]?(.*)$/m';
> 
> 
> varname1:: value1
> Referenz: : value1
> (I don't want the second colon in the reference)

I'm not sure what you're wanting here.  You want the colons to
be able to have spaces between them?  Then the pattern becomes

  $PageTextVarPatterns['var::'] = 
    '/^([-a-zA-Z_ ]+)\\s*:\\s*:[ \\t]?(.*)$/m';

> varname 1b:value1b
> Referenz: {$:varname 1b}
> (blanks in varnames => vraname is notrecognized)
>
> varname-1c:	value1c
> Referenz: {$:varname-1c}
> (hyphen in varnames => vraname is notrecognized)

PmWiki's {$var} markup doesn't recognize spaces or hyphens
in variable names...  so in order for that to work we'd also 
have to redefine the {$var} markup.

  $PageTextVarPatterns['var::'] = 
    '/^\\s*([-a-zA-Z_ ]+)\\s*:\\s*:[ \\t]?(.*)$/m';

  # {$var} substitutions
  Markup('{$var}', '>$[phrase]',
    '/\\{(\\*|!?[-\\w.\\/\\x80-\\xff]*)(\\$:?\\w[-\\w ]*)\\}/e',
    "PRR(PVSE(PageVar(\$pagename, '$2', '$1')))");


> varname_1d:	value1d
> Referenz: : value1d
> (works, but same like varname1: double colon)

I think this goes back to my first item of adding the \s* between
the two colons.

Pm



More information about the pmwiki-users mailing list