[pmwiki-devel] multi-line pagetext variables

Hans design5 at softflow.co.uk
Sun Apr 15 12:37:16 CDT 2007


I understand that (:name : value :) can be used for holding a
multi-line text variable, like

(:name :
some text

first line
second line\\
third line

more text
:)

When I use {$:name} it displays perfectly.
When I use PageTextVar($pagename, 'name'); from within a markup
function (function called by a markup directive) I loose the line
breaks and vertical space.
When I extract the PTVs with pattern matching as PageTextVar does
I have the same problem of lost line breaks.
This is despite the markup rule is set to '<textvar:'

I seem to be able to compensate by doing a preg_replace
on the array of PTVs:

 foreach($args as $k => $v) {
      $args[$k] = preg_replace('/\\n/','<br/>',$args[$k]);
      $args[$k] = preg_replace('/\\\\/','',$args[$k]);
 }


Is this normal? I am likely overlooking something.
Is there a better way of handling multi-line PTV values within
functions?

  
 Hans




More information about the pmwiki-devel mailing list