| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * Parses for text marked as "raw" (i.e., to be rendered as-is). |
| 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: Raw.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $ |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * |
| 21 | * Parses for text marked as "raw" (i.e., to be rendered as-is). |
| 22 | * |
| 23 | * This class implements a Text_Wiki rule to find sections of the source |
| 24 | * text that are not to be processed by Text_Wiki. These blocks of "raw" |
| 25 | * text will be rendered as they were found. |
| 26 | * |
| 27 | * @category Text |
| 28 | * |
| 29 | * @package Text_Wiki |
| 30 | * |
| 31 | * @author Paul M. Jones <pmjones@php.net> |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | class Text_Wiki_Parse_Raw extends Text_Wiki_Parse { |
| 36 | |
| 37 | |
| 38 | /** |
| 39 | * |
| 40 | * The regular expression used to find source text matching this |
| 41 | * rule. |
| 42 | * |
| 43 | * @access public |
| 44 | * |
| 45 | * @var string |
| 46 | * |
| 47 | */ |
| 48 | |
| 49 | var $regex = "/``(.*)``/U"; |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * |
| 54 | * Generates a token entry for the matched text. Token options are: |
| 55 | * |
| 56 | * 'text' => The full matched text. |
| 57 | * |
| 58 | * @access public |
| 59 | * |
| 60 | * @param array &$matches The array of matches from parse(). |
| 61 | * |
| 62 | * @return A delimited token number to be used as a placeholder in |
| 63 | * the source text. |
| 64 | * |
| 65 | */ |
| 66 | |
| 67 | function process(&$matches) |
| 68 | { |
| 69 | $options = array('text' => $matches[1]); |
| 70 | return $this->wiki->addToken($this->rule, $options); |
| 71 | } |
| 72 | } |
| 73 | ?> |