[pmwiki-users] Help for designing a new ptv pattern <<< my new multiline ptv pattern >>>

Hans Bracker design at softflow.co.uk
Sun Jan 18 04:56:08 CST 2015

> For complete information, can you explain how your code let ptv
> visible, as compared to the original code which makes ptv invisible ?

The  definition of a new PTV pattern via $PageTextVarPatterns does not
make the text in the wiki page invisible.
The standard PmWiki hidden PTV pattern of (:ptvname : value :) is made
hidden via a special markup definition in scripts/stdmarkup.php

I was playing with your suggestion for a pattern for

<<< (myvar) text
and text. >>>

and got this:

Markup('<<<var', '<split', '/<<<\\s*?\\((\\w[-\\w]*) *\\)(.*?)>>>/s', '$2' );
$PageTextVarPatterns['<<<var...>>>'] = '/(<<<\\s*?\\(*(\\w[-\\w]*) *\\)(?!\\))\\s?)(.*?)(>>>)/s';

It defines a new PTV pattern, and a markup which hides the <<< (myvar)
part and the >>> end  part,  just  leaving  the PTV value visible. Not
part and the >>> sure if you wanted it that way.
It  also  allows  no or several spaces before the bracket with th ePTV
name, and spaces after the PTV name and the closing round bracket.
Spaces could include line breaks as well, so this is legitimate:
(myvar )
and text.

maybe  this  is  too  wide  a  definition. I did not check if it might
interfere with other markup.
Note  the  Markup  definition is set for '<split' in th emarkup table,
meaning  before  line  splitting  is  done, as it needs to get several
lines, using th e/s modifier in the pattern.


More information about the pmwiki-users mailing list