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

Source for file Tt.php

Documentation is available at Tt.php

  1. <?php
  2.  
  3. /**
  4. * 
  5. * Find source text marked for teletype (monospace).
  6. * 
  7. * Defined by text surrounded by two curly braces. On parsing, the text
  8. * itself is left in place, but the starting and ending instances of
  9. * curly braces are replaced with tokens.
  10. * 
  11. * Token options are:
  12. * 
  13. * 'type' => ['start'|'end'] The starting or ending point of the
  14. * teletype text.  The text itself is left in the source.
  15. * 
  16. * 
  17. * $Id: Tt.php,v 1.2 2004/09/25 19:05:13 pmjones Exp $
  18. * 
  19. * @author Paul M. Jones <pmjones@ciaweb.net>
  20. *
  21. * @package Text_Wiki
  22. *
  23. */
  24.  
  25.     
  26.     
  27.     /**
  28.     * 
  29.     * The regular expression used to parse the source text.
  30.     * 
  31.     * @access public
  32.     * 
  33.     * @var string 
  34.     * 
  35.     * @see parse()
  36.     * 
  37.     */
  38.     
  39.     var $regex = "/{{({*?.*}*?)}}/U";
  40.     
  41.     
  42.     /**
  43.     * 
  44.     * Generates a replacement for the matched text.
  45.     * 
  46.     * @access public
  47.     *
  48.     * @param array &$matches The array of matches from parse().
  49.     *
  50.     * @return string A pair of delimited tokens to be used as a
  51.     *  placeholder in the source text surrounding the teletype text.
  52.     *
  53.     */
  54.     
  55.     function process(&$matches)
  56.     {
  57.         $start = $this->wiki->addToken(
  58.             $this->rule, array('type' => 'start')
  59.         );
  60.         
  61.         $end = $this->wiki->addToken(
  62.             $this->rule, array('type' => 'end')
  63.         );
  64.         
  65.         return $start . $matches[1] . $end;
  66.     }
  67. }
  68. ?>

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