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

Source for file Preformatted.php

Documentation is available at Preformatted.php

  1. <?php
  2.  
  3. /**
  4.  *
  5.  * Parses for preformatted text.
  6.  *
  7.  * @category Text
  8.  *
  9.  * @package Text_Wiki
  10.  *
  11.  * @author Tomaiuolo Michele <tomamic@yahoo.it>
  12.  *
  13.  * @license LGPL
  14.  *
  15.  * @version $Id: Preformatted.php 240474 2007-07-30 13:14:41Z mic $
  16.  *
  17.  */
  18.  
  19. class Text_Wiki_Parse_Preformatted extends Text_Wiki_Parse {
  20.  
  21.  
  22.     /**
  23.      *
  24.      * The regular expression used to parse the source text and find
  25.      * matches conforming to this rule. Used by the parse() method.
  26.      *
  27.      * @access public
  28.      *
  29.      * @var string 
  30.      *
  31.      * @see parse()
  32.      *
  33.      */
  34.  
  35.     var $regex = '/\n{{{\n(.*)\n}}}\n/Us';
  36.  
  37.     /**
  38.      *
  39.      * Generates a replacement for the matched text. Token options are:
  40.      *
  41.      * 'text' => The preformatted text.
  42.      *
  43.      * @access public
  44.      *
  45.      * @param array &$matches The array of matches from parse().
  46.      *
  47.      * @return string A token to be used as a placeholder
  48.      *  in the source text for the preformatted text.
  49.      *
  50.      */
  51.  
  52.     function process(&$matches)
  53.     {
  54.         // > any line consisting of only indented three closing curly braces
  55.         // > will have one space removed from the indentation
  56.         // > -- http://www.wikicreole.org/wiki/AddNoWikiEscapeProposal
  57.         $find "/\n( *) }}}/";
  58.         $replace "\n$1}}}";
  59.         $matches[1preg_replace($find$replace$matches[1]);
  60.     
  61.         $token $this->wiki->addToken(
  62.             $this->rule,
  63.             array('text' => $matches[1])
  64.         );
  65.         return "\n\n" $token "\n\n";
  66.     }
  67. }
  68. ?>

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