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

Source for file Italic.php

Documentation is available at Italic.php

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

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