equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /** |
|
4 * |
|
5 * Parses for centered lines of text. |
|
6 * |
|
7 * @category Text |
|
8 * |
|
9 * @package Text_Wiki |
|
10 * |
|
11 * @author Paul M. Jones <pmjones@php.net> |
|
12 * |
|
13 * @license LGPL |
|
14 * |
|
15 * @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ |
|
16 * |
|
17 */ |
|
18 |
|
19 /** |
|
20 * |
|
21 * Parses for centered lines of text. |
|
22 * |
|
23 * This class implements a Text_Wiki_Parse to find lines marked for centering. |
|
24 * The line must start with "= " (i.e., an equal-sign followed by a space). |
|
25 * |
|
26 * @category Text |
|
27 * |
|
28 * @package Text_Wiki |
|
29 * |
|
30 * @author Paul M. Jones <pmjones@php.net> |
|
31 * |
|
32 */ |
|
33 |
|
34 class Text_Wiki_Parse_Center extends Text_Wiki_Parse { |
|
35 |
|
36 |
|
37 /** |
|
38 * |
|
39 * The regular expression used to find source text matching this |
|
40 * rule. |
|
41 * |
|
42 * @access public |
|
43 * |
|
44 * @var string |
|
45 * |
|
46 */ |
|
47 |
|
48 var $regex = '/\n\= (.*?)\n/'; |
|
49 |
|
50 /** |
|
51 * |
|
52 * Generates a token entry for the matched text. |
|
53 * |
|
54 * @access public |
|
55 * |
|
56 * @param array &$matches The array of matches from parse(). |
|
57 * |
|
58 * @return A delimited token number to be used as a placeholder in |
|
59 * the source text. |
|
60 * |
|
61 */ |
|
62 |
|
63 function process(&$matches) |
|
64 { |
|
65 $start = $this->wiki->addToken( |
|
66 $this->rule, |
|
67 array('type' => 'start') |
|
68 ); |
|
69 |
|
70 $end = $this->wiki->addToken( |
|
71 $this->rule, |
|
72 array('type' => 'end') |
|
73 ); |
|
74 |
|
75 return "\n" . $start . $matches[1] . $end . "\n"; |
|
76 } |
|
77 } |
|
78 ?> |