cvs: pear /Text_Wiki/Text/Wiki/Parse/Tiki Plugin.php

From: Date: Sat, 01 Oct 2005 15:51:22 +0000
Subject: cvs: pear /Text_Wiki/Text/Wiki/Parse/Tiki Plugin.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35206@lists.php.net to get a copy of this message
toggg Sat Oct 1 11:51:22 2005 EDT Modified files: /pear/Text_Wiki/Text/Wiki/Parse/Tiki Plugin.php Log: As Plugin may introduce some more markup, raw and preformated had to be done in the same "round" http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php?r1=1.5&r2=1.6&ty=u Index: pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php diff -u pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php:1.5 pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php:1.6 --- pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php:1.5 Fri Sep 30 16:11:47 2005 +++ pear/Text_Wiki/Text/Wiki/Parse/Tiki/Plugin.php Sat Oct 1 11:51:22 2005 @@ -11,7 +11,7 @@ * @author Justin Patrin <papercrane@reversefold.com> * @author Paul M. Jones <pmjones@php.net> * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Plugin.php,v 1.5 2005/09/30 20:11:47 toggg Exp $ + * @version CVS: $Id: Plugin.php,v 1.6 2005/10/01 15:51:22 toggg Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -38,9 +38,9 @@ * @var string */ var $conf = array ( - 'file_prefix' => 'wikiplugin_', - 'file_extension' => '.php', - 'file_path' => 'lib/wiki-plugins/' + 'file_prefix' => 'wikiplugin_', + 'file_extension' => '.php', + 'file_path' => 'lib/wiki-plugins/' ); /** @@ -62,9 +62,10 @@ * */ - //var $regex = '/^({([A-Z]+?)\((.+)?\)})((.+)({\2}))?(\s|$)/Umsi'; - var $regex = '/\{([A-Z]+?)\((.*?)\)}((?:(?R)|.)*?)\{\1}/msi'; - + // var $regex = '/\{([A-Z]+?)\((.*?)\)}((?:(?R)|.)*?)\{\1}/msi'; + var $regex = '#(?:\{([A-Z]+?)\((.*?)\)}|(~pp~)|(~np~)|(&lt;pre&gt;)) + ((?:(?R)|.)*?) + (?(1)\{\1})(?(3)~/pp~)(?(4)~/np~)(?(5)&lt;/pre&gt;)#mixs'; /** * @@ -83,6 +84,17 @@ function process(&$matches) { + // preparsed area + if (isset($matches[3]) || isset($matches[5])) { + return $this->wiki->addToken('Preformatted', + array('text' => $matches[6])); + } + // non parsed area + if (isset($matches[4])) { + return $this->wiki->addToken('Raw', + array('text' => $matches[6])); + } + // plugin $func = $this->getConf('file_prefix') . strtolower($matches[1]); if (!function_exists($func)) { $file = $func . $this->getConf('file_extension'); @@ -100,7 +112,7 @@ } // are there additional attribute arguments? - preg_match_all($this->regexArgs, $matches[2], $args, PREG_PATTERN_ORDER); + preg_match_all($this->regexArgs, $matches[2], $args, PREG_PATTERN_ORDER); $attr = array(); foreach ($args[1] as $i=>$name) { if ($args[2][$i]{0} == '"' || $args[2][$i]{0} == "'") { @@ -111,7 +123,7 @@ } // executes the plugin with data and pameters then recursive re-parse for nested or produced plugins - $res = $func($matches[3], $attr); + $res = $func($matches[6], $attr); return preg_replace_callback( $this->regex, array(&$this, 'process'),

« previous php.pear.cvs (#35206) next »