5 * Parses for colorized text.
11 * @author Paul M. Jones <pmjones@php.net>
15 * @version $Id: Colortext.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
21 * Parses for colorized text.
27 * @author Paul M. Jones <pmjones@php.net>
31 class Text_Wiki_Parse_Colortext
extends Text_Wiki_Parse
{
35 * The regular expression used to parse the source text and find
36 * matches conforming to this rule. Used by the parse() method.
46 var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
51 * Generates a replacement for the matched text. Token options are:
53 * 'type' => ['start'|'end'] The starting or ending point of the
54 * emphasized text. The text itself is left in the source.
56 * 'color' => the color indicator
60 * @param array &$matches The array of matches from parse().
62 * @return string A pair of delimited tokens to be used as a
63 * placeholder in the source text surrounding the text to be
68 function process(&$matches)
70 $start = $this->wiki
->addToken(
74 'color' => $matches[1]
78 $end = $this->wiki
->addToken(
82 'color' => $matches[1]
86 return $start . $matches[2] . $end;