Release diogenes-0.9.22
[diogenes.git] / include / Text / Wiki / Parse / Default / Newline.php
CommitLineData
6855525e
JL
1<?php
2
3/**
4*
5* Parses for implied line breaks indicated by newlines.
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: Newline.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
16*
17*/
18
19/**
20*
21* Parses for implied line breaks indicated by newlines.
22*
23* This class implements a Text_Wiki_Parse to mark implied line breaks in the
24* source text, usually a single carriage return in the middle of a paragraph
25* or block-quoted text.
26*
27* @category Text
28*
29* @package Text_Wiki
30*
31* @author Paul M. Jones <pmjones@php.net>
32*
33*/
34
35class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
36
37
38 /**
39 *
40 * The regular expression used to parse the source text and find
41 * matches conforming to this rule. Used by the parse() method.
42 *
43 * @access public
44 *
45 * @var string
46 *
47 * @see parse()
48 *
49 */
50
51 var $regex = '/([^\n])\n([^\n])/m';
52
53
54 /**
55 *
56 * Generates a replacement token for the matched text.
57 *
58 * @access public
59 *
60 * @param array &$matches The array of matches from parse().
61 *
62 * @return string A delimited token to be used as a placeholder in
63 * the source text.
64 *
65 */
66
67 function process(&$matches)
68 {
69 return $matches[1] .
70 $this->wiki->addToken($this->rule) .
71 $matches[2];
72 }
73}
74
75?>