Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file delimiter.php

Documentation is available at delimiter.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available through the world-wide-web at                              |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Paul M. Jones <pmjones@ciaweb.net>                          |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: delimiter.php,v 1.3 2004/01/31 15:52:08 pmjones Exp $
  20.  
  21.  
  22. /**
  23. * This class implements a Text_Wiki_Rule to find instances of the delimiter
  24. * character already embedded in the source text; it extracts them and replaces
  25. * them with a delimited token, then renders them as the delimiter itself
  26. * when the target format is XHTML.
  27. *
  28. @author Paul M. Jones <pmjones@ciaweb.net>
  29. *
  30. @package Text_Wiki
  31. *
  32. */
  33.  
  34.     
  35.     /**
  36.     * 
  37.     * Constructor.  Overrides the Text_Wiki_Rule constructor so that we
  38.     * can set the $regex property dynamically (we need to include the
  39.     * Text_Wiki $delim character.
  40.     * 
  41.     * @param object &$obj The calling "parent" Text_Wiki object.
  42.     * 
  43.     * @param string $name The token name to use for this rule.
  44.     * 
  45.     */
  46.     
  47.     function Text_Wiki_Rule_delimiter(&$obj$name)
  48.     {
  49.         parent::Text_Wiki_Rule($obj$name);
  50.         $this->regex = '/' $this->_wiki->delim . '/';
  51.     }
  52.     
  53.     
  54.     /**
  55.     * 
  56.     * Generates a token entry for the matched text.  Token options are:
  57.     * 
  58.     * 'text' => The full matched text.
  59.     * 
  60.     * @access public
  61.     *
  62.     * @param array &$matches The array of matches from parse().
  63.     *
  64.     * @return delimited token number to be used as a placeholder in
  65.     *  the source text.
  66.     *
  67.     */
  68.     
  69.     function process(&$matches)
  70.     {    
  71.         return $this->addToken();
  72.     }
  73.     
  74.     
  75.     /**
  76.     * 
  77.     * Renders a token into text matching the requested format.
  78.     * 
  79.     * @access public
  80.     * 
  81.     * @param array $options The "options" portion of the token (second
  82.     *  element).
  83.     * 
  84.     * @return string The text rendered from the token options.
  85.     * 
  86.     */
  87.     
  88.     function renderXhtml($options)
  89.     {
  90.         return $this->_wiki->delim;
  91.     }
  92. }
  93. ?>

Documentation generated on Mon, 11 Mar 2019 10:14:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.