5 * Parses for bold text.
11 * @author Paul M. Jones <pmjones@php.net>
15 * @version $Id: Bold.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
21 * Parses for bold text.
23 * This class implements a Text_Wiki_Rule to find source text marked for
24 * strong emphasis (bold) as defined by text surrounded by three
25 * single-quotes. On parsing, the text itself is left in place, but the
26 * starting and ending instances of three single-quotes are replaced with
33 * @author Paul M. Jones <pmjones@php.net>
37 class Text_Wiki_Parse_Bold
extends Text_Wiki_Parse
{
42 * The regular expression used to parse the source text and find
43 * matches conforming to this rule. Used by the parse() method.
53 var $regex = "/'''(()|[^'].*)'''/U";
58 * Generates a replacement for the matched text. Token options are:
60 * 'type' => ['start'|'end'] The starting or ending point of the
61 * emphasized text. The text itself is left in the source.
65 * @param array &$matches The array of matches from parse().
67 * @return A pair of delimited tokens to be used as a placeholder in
68 * the source text surrounding the text to be emphasized.
72 function process(&$matches)
74 $start = $this->wiki
->addToken($this->rule
, array('type' => 'start'));
75 $end = $this->wiki
->addToken($this->rule
, array('type' => 'end'));
76 return $start . $matches[1] . $end;