Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<?php
// $Id: Inclure.php,v 1.1 2004-11-26 12:13:28 jpm Exp $


/**
* 
* This class implements a Text_Wiki_Parse to find source text marked as
* an Interwiki link.  See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @package Text_Wiki
*
*/
class Text_Wiki_Parse_Inclure extends Text_Wiki_Parse {
    
    var $regex = '/\{\{inclure page="([A-Za-z0-9_]+)"(?: interwiki="([A-Za-z0-9_]+)"|)\}\}/';
    
    /**
    * 
    * Generates a replacement for the matched standalone interwiki text.
    * Token options are:
    * 
    * 'site' => The key name for the Text_Wiki interwiki array map,
    * usually the name of the interwiki site.
    * 
    * 'page' => The page on the target interwiki to link to.
    * 
    * 'text' => The text to display as the link.
    * 
    * @access public
    *
    * @param array &$matches The array of matches from parse().
    *
    * @return A delimited token to be used as a placeholder in
    * the source text, plus any text priot to the match.
    *
    */
    function process(&$matches)
    {
        $options = array(
            'page' => $matches[1],
            'site' => $matches[2],
            'text' => $matches[0]
        );
        
        return $this->wiki->addToken($this->rule, $options);
    }
    
}
?>