[pmwiki-users] Custom Markup simple problem

Patrick R. Michaud pmichaud at pobox.com
Fri Sep 7 10:28:17 CDT 2007


On Fri, Sep 07, 2007 at 03:58:10PM +0200, Fredrik wrote:
> It might be simple but I can't see what I do wrong. Here is my really advanced function so far...
> 
> <?php if (!defined('PmWiki')) exit();
> 
> Markup('test', 'directives', "/^\(:test[ 	]*(.*?):\)\s*$/e", 
> 	"test('$1')");
> 
> function test($opts) {
> 	$args = ParseArgs($opts);
> 	$out = "!! ". $args['first'] ." ";
> 	$out .= $args['second']. "\n";
> 	$out .= "!! test\n";
> 	return $out;
> }
> 
> ?>
> 
> Disabling the last line beginning with $out makes everything work fine. 
> But using both just shows this as a normal textline and not as 
> headers. Any idea?

If a directive is producing markup that has newlines in it, then
it needs to call PRR() to get the markup engine to re-split the
line.  Otherwise PmWiki still treats the result as being on
a single line.

So, try adding a call to PRR() inside of the test function:

  function test($opts) {
  	$args = ParseArgs($opts);
  	$out = "!! ". $args['first'] ." ";
  	$out .= $args['second']. "\n";
  	$out .= "!! test\n";
        PRR();
  	return $out;
  }

Pm



More information about the pmwiki-users mailing list