Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
248 jpm 1
<?php
2
// $Id: Delimiter.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 instances of the delimiter
8
* character already embedded in the source text; it extracts them and replaces
9
* them with a delimited token, then renders them as the delimiter itself
10
* when the target format is XHTML.
11
*
12
* @author Paul M. Jones <pmjones@ciaweb.net>
13
*
14
* @package Text_Wiki
15
*
16
*/
17
 
18
class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
19
 
20
    /**
21
    *
22
    * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
23
    * can set the $regex property dynamically (we need to include the
24
    * Text_Wiki $delim character.
25
    *
26
    * @param object &$obj The calling "parent" Text_Wiki object.
27
    *
28
    * @param string $name The token name to use for this rule.
29
    *
30
    */
31
 
32
    function Text_Wiki_Parse_delimiter(&$obj)
33
    {
34
        parent::Text_Wiki_Parse($obj);
35
        $this->regex = '/' . $this->wiki->delim . '/';
36
    }
37
 
38
 
39
    /**
40
    *
41
    * Generates a token entry for the matched text.  Token options are:
42
    *
43
    * 'text' => The full matched text.
44
    *
45
    * @access public
46
    *
47
    * @param array &$matches The array of matches from parse().
48
    *
49
    * @return A delimited token number to be used as a placeholder in
50
    * the source text.
51
    *
52
    */
53
 
54
    function process(&$matches)
55
    {
56
        return $this->wiki->addToken(
57
            $this->rule,
58
            array('text' => $this->wiki->delim)
59
        );
60
    }
61
}
62
?>