Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
248 jpm 1
<?php
2
// $Id: Newline.php,v 1.1 2005-01-20 19:43:20 jpm Exp $
3
 
4
 
5
/**
6
*
7
* This class implements a Text_Wiki_Parse to mark implied line breaks in the
8
* source text, usually a single carriage return in the middle of a paragraph
9
* or block-quoted text.
10
*
11
* @author Paul M. Jones <pmjones@ciaweb.net>
12
*
13
* @package Text_Wiki
14
*
15
*/
16
 
17
class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
18
 
19
 
20
    /**
21
    *
22
    * The regular expression used to parse the source text and find
23
    * matches conforming to this rule.  Used by the parse() method.
24
    *
25
    * @access public
26
    *
27
    * @var string
28
    *
29
    * @see parse()
30
    *
31
    */
32
 
33
    var $regex = '/([^\n])\n([^\n])/m';
34
 
35
 
36
    /**
37
    *
38
    * Generates a replacement token for the matched text.
39
    *
40
    * @access public
41
    *
42
    * @param array &$matches The array of matches from parse().
43
    *
44
    * @return string A delimited token to be used as a placeholder in
45
    * the source text.
46
    *
47
    */
48
 
49
    function process(&$matches)
50
    {
51
        return $matches[1] .
52
            $this->wiki->addToken($this->rule) .
53
            $matches[2];
54
    }
55
}
56
 
57
?>