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.  * Parses for monospaced inline 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: Tt.php 240474 2007-07-30 13:14:41Z mic $
  16.  *
  17.  */
  18.  
  19. class Text_Wiki_Parse_Tt 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 = '/{{{(.*?)}}}(?!}|{{{)/';
  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.      * monospaced text.  The text itself is encapsulated into a Raw token.
  43.      *
  44.      * @access public
  45.      *
  46.      * @param array &$matches The array of matches from parse().
  47.      *
  48.      * @return string A token to be used as a placeholder
  49.      *  in the source text for the preformatted text.
  50.      *
  51.      */
  52.  
  53.     function process(&$matches)
  54.     {
  55.         // remove the sequence }}}{{{
  56.         $find "/}}}{{{/";
  57.         $replace "";
  58.         $matches[1preg_replace($find$replace$matches[1]);
  59.         
  60.         $start $this->wiki->addToken(
  61.             $this->rule,
  62.             array('type' => 'start')
  63.         );
  64.  
  65.         $raw $this->wiki->addToken(
  66.             'Raw',
  67.             array('text' => $matches[1])
  68.         );
  69.  
  70.         $end $this->wiki->addToken(
  71.             $this->rule,
  72.             array('type' => 'end')
  73.         );
  74.  
  75.         return $start $raw $end;
  76.     }
  77. }
  78. ?>

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