5 * Parses for strongly-emphasized text.
11 * @author Paul M. Jones <pmjones@php.net>
15 * @version $Id: Strong.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
22 * Parses for strongly-emphasized text.
24 * This class implements a Text_Wiki_Parse to find source text marked for
25 * strong emphasis (bold) as defined by text surrounded by three
26 * single-quotes. On parsing, the text itself is left in place, but the
27 * starting and ending instances of three single-quotes are replaced with
34 * @author Paul M. Jones <pmjones@php.net>
38 class Text_Wiki_Parse_Strong
extends Text_Wiki_Parse
{
43 * The regular expression used to parse the source text and find
44 * matches conforming to this rule. Used by the parse() method.
55 // var $regex = "/\*\*(.*?)\*\*/";
58 // var $regex = "/\*\*(()|[^\n]*)\*\*/U";
59 var $regex = "/\*\*(()|.*)\*\*/U";
63 * Generates a replacement for the matched text. Token options are:
65 * 'type' => ['start'|'end'] The starting or ending point of the
66 * emphasized text. The text itself is left in the source.
70 * @param array &$matches The array of matches from parse().
72 * @return A pair of delimited tokens to be used as a placeholder in
73 * the source text surrounding the text to be emphasized.
77 function process(&$matches)
79 $start = $this->wiki
->addToken(
80 $this->rule
, array('type' => 'start')
83 $end = $this->wiki
->addToken(
84 $this->rule
, array('type' => 'end')
87 return $start . $matches[1] . $end;