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

Source for file Bold.php

Documentation is available at Bold.php

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

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