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

Source for file tighten.php

Documentation is available at tighten.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available through the world-wide-web at                              |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Paul M. Jones <pmjones@ciaweb.net>                          |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: tighten.php,v 1.2 2004/03/30 16:47:00 pmjones Exp $
  20.  
  21.  
  22. /**
  23. * This rule removes 3+ consecutive newlines from the source text,
  24. * replacing them with 2 newlines instead.
  25. *
  26. @author Paul M. Jones <pmjones@ciaweb.net>
  27. *
  28. @package Text_Wiki
  29. *
  30. */
  31.  
  32.     
  33.     
  34.     /**
  35.     * 
  36.     * Simple parsing method to apply tightening directly to the tokens
  37.     * array.
  38.     *
  39.     * @access public
  40.     * 
  41.     */
  42.     
  43.     function parse()
  44.     {
  45.         // remove all instances of 3 or more newlines, converting
  46.         // to 2 newlines.
  47.         $find "/\n{3,}/m";
  48.         $replace "\n\n";
  49.         $this->_wiki->_source = preg_replace($find$replace,
  50.             $this->_wiki->_source);
  51.     }
  52. }
  53. ?>

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