Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
248 jpm 1
<?php
2
// $Id: Center.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 find lines marked for centering.
8
* The line must start with "= " (i.e., an equal-sign followed by a space).
9
*
10
* @author Paul M. Jones <pmjones@ciaweb.net>
11
*
12
* @package Text_Wiki
13
*
14
*/
15
 
16
class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
17
 
18
 
19
    /**
20
    *
21
    * The regular expression used to find source text matching this
22
    * rule.
23
    *
24
    * @access public
25
    *
26
    * @var string
27
    *
28
    */
29
 
30
    var $regex = '/\n\= (.*?)\n/';
31
 
32
    /**
33
    *
34
    * Generates a token entry for the matched text.
35
    *
36
    * @access public
37
    *
38
    * @param array &$matches The array of matches from parse().
39
    *
40
    * @return A delimited token number to be used as a placeholder in
41
    * the source text.
42
    *
43
    */
44
 
45
    function process(&$matches)
46
    {
47
        $start = $this->wiki->addToken(
48
            $this->rule,
49
            array('type' => 'start')
50
        );
51
 
52
        $end = $this->wiki->addToken(
53
            $this->rule,
54
            array('type' => 'end')
55
        );
56
 
57
        return "\n" . $start . $matches[1] . $end . "\n";
58
    }
59
}
60
?>