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