Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
164 jpm 1
<?php
2
// $Id: Revise.php,v 1.1 2004-11-23 17:24:57 jpm Exp $
3
 
4
 
5
/**
6
*
7
* This class implements a Text_Wiki_Parse to find source text marked for
8
* revision.
9
*
10
* @author Paul M. Jones <pmjones@ciaweb.net>
11
*
12
* @package Text_Wiki
13
*
14
*/
15
 
16
class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
17
 
18
 
19
    /**
20
    *
21
    * The regular expression used to parse the source text and find
22
    * matches conforming to this rule.  Used by the parse() method.
23
    *
24
    * @access public
25
    *
26
    * @var string
27
    *
28
    * @see parse()
29
    *
30
    */
31
 
32
    var $regex = "/\@\@({*?.*}*?)\@\@/U";
33
 
34
 
35
    /**
36
    *
37
    * Config options.
38
    *
39
    * @access public
40
    *
41
    * @var array
42
    *
43
    */
44
 
45
    var $conf = array(
46
        'delmark' => '---',
47
        'insmark' => '+++'
48
    );
49
 
50
 
51
    /**
52
    *
53
    * Generates a replacement for the matched text.  Token options are:
54
    *
55
    * 'type' => ['start'|'end'] The starting or ending point of the
56
    * inserted text.  The text itself is left in the source.
57
    *
58
    * @access public
59
    *
60
    * @param array &$matches The array of matches from parse().
61
    *
62
    * @return string A pair of delimited tokens to be used as a
63
    * placeholder in the source text surrounding the teletype text.
64
    *
65
    */
66
 
67
    function process(&$matches)
68
    {
69
        $output = '';
70
 
71
        $output .= $this->wiki->addToken(
72
            $this->rule, array('type' => 'del_start')
73
        );
74
 
75
        $output .= $matches[1];
76
 
77
        $output .= $this->wiki->addToken(
78
            $this->rule, array('type' => 'del_end')
79
        );
80
 
81
        return $output;
82
    }
83
}
84
?>