[pmwiki-users] Markup for Page Text Variables

Peter & Melodye Bowers pbowers at pobox.com
Thu Apr 24 08:14:23 CDT 2008


> Is it possible to either alter markup or create new markup 
> for PTV's. It would
> suit my purposes if I could define a PTV thus:
> PTV (Value)
> {$:PTV} would then display Value?

There is currently a definition of $PageTextVarPatterns like this in
pmwiki.php:

===(snip)===
$PageTextVarPatterns = array(
  'var:'        => '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m',
  '(:var:...:)' => '/(\\(: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\))/s'
  );
===(snip)===

I believe you could just put this line in your config.php and it would work:

$PageTextVarPatterns['var()'] = '/^((\\w[-\\w]*)\\s+\\()([^)]*)(\\))/m';

I assume you've already thought through the ramifications in terms of not
being able to have a close-parenthesis in the value of the variable, etc...

This will allow multi-line values in PTVs as well.

-Peter




More information about the pmwiki-users mailing list