5 * "Pre-filter" the source text.
11 * @author Paul M. Jones <pmjones@php.net>
15 * @version $Id: Prefilter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
21 * "Pre-filter" the source text.
23 * Convert DOS and Mac line endings to Unix, concat lines ending in a
24 * backslash \ with the next line, convert tabs to 4-spaces, add newlines
25 * to the top and end of the source text, compress 3 or more newlines to
32 * @author Paul M. Jones <pmjones@php.net>
36 class Text_Wiki_Parse_Prefilter
extends Text_Wiki_Parse
{
41 * Simple parsing method.
49 // convert DOS line endings
50 $this->wiki
->source
= str_replace("\r\n", "\n",
53 // convert Macintosh line endings
54 $this->wiki
->source
= str_replace("\r", "\n",
57 // concat lines ending in a backslash
58 $this->wiki
->source
= str_replace("\\\n", "",
61 // convert tabs to four-spaces
62 $this->wiki
->source
= str_replace("\t", " ",
65 // add extra newlines at the top and end; this
66 // seems to help many rules.
67 $this->wiki
->source
= "\n" . $this->wiki
->source
. "\n\n";
69 // finally, compress all instances of 3 or more newlines
70 // down to two newlines.
73 $this->wiki
->source
= preg_replace($find, $replace,