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

Source for file Emphasis.php

Documentation is available at Emphasis.php

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

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