[pmwiki-users] PVT' question

Knut Alboldt pmwiki at alboldt.de
Wed Feb 27 14:18:37 CST 2008


> Perhaps, but would it not be simpler to define a new
> PageTextVariable pattern and markup to match?
> After all the concept for PTVs is to have certain string patterns
> automatically recognised as a PTV pattern, so a 'value' part of the
> string can be shown by using a 'name' part.
> 
> How about using a triad: label:name:value
> 
> Here is a possible definition for a
> label |name: value pattern, and a matching markup, which will
> display the label only. The label has to start with a letter or
> digit ,or : for a definition list label, but then can contain anything
> apart from the pipe, which separates it from the following ptv name.
> After the : follows the value.
> 
> $PageTextVarPatterns['label|var:'] =
>         '/^(.*?\\|(\\w[-\\w]*):[ \\t]?)(.*)($)/m';
> 
> Markup('label:var:', '<split',
>         '/^((:*\\s*[\\w].*?)\\|(\\w[-\\w]*):[ \\t]?)(.*)($)/m', '$2 :$4');
> 
> Example:
> 
> 25 February |20080225: US to set 'binding' climate goals
> 
> displays as
> 
> 25 February: US to set 'binding' climate goals
> 
> and PTV {$:20080225} displays as
> 
> US to set 'binding' climate goals
> 
> 
> :25 February |20080225: US to set 'binding' climate goals
> 
> displays as
> 
> 25 February
>       US to set 'binding' climate goals
> 
> 
> 
>   ~Hans

That's real great ! I like that & I'll try that

Thank's a lot, Peter & Hans

Knut



More information about the pmwiki-users mailing list