list_state) { case LIST_NONE: break; case LIST_UNORDERED: $ltag = "\n"; break; case LIST_ORDERED: $ltag = "\n"; break; case LIST_DEFINITION: $ltag = "\n"; break; } $this->list_state = LIST_NONE; switch ($state) { case STATE_PARAGRAPH: return "$ltag

\n"; break; case STATE_BLOCKQUOTE: return "$ltag\n"; break; case STATE_PREFORM: return "$ltag\n"; break; case STATE_NOTIKI: return "$ltag\n"; break; } } function do_replace( $line, $mark, $tag ) { // do the regex thingy for things like bold, italic etc // $mark is the magic character, and $tag the HTML tag to insert // BODGE: replace inline $mark characters in places where we want them ignored // they will be put back after main substitutue, stops problems with eg, and/or $bodge = chr(1); $line = eregi_replace( '([[:alnum:]])'.$mark.'([[:alnum:]])', '\\1'.$bodge.'\\2',$line ); $regex = '(^| |[(.,])'.$mark.'([^'.$mark.']*)'.$mark.'([^[:alnum:]])'; $replace = '\\1<'.$tag.'>\\2\\3'; $line = eregi_replace( $regex, $replace, $line ); // BODGE: back we go $line = eregi_replace( $bodge, $mark, $line ); return $line; } function do_replace_sub( $line, $mark, $tag ) { // do regex for subscript and superscript (slightly different) // $mark is the magic character and $tag the HTML tag to insert $regex = $mark.'([^'.$mark.']*)'.$mark; $replace = '<'.$tag.'>\\1'; return eregi_replace( $regex, $replace, $line ); } function do_list( $line ) { // handle line with list character on it // get magic character and then delete it from the line $listchar = $line{0}; $line = eregi_replace( "^[*#;:] ", "", $line ); // if not in "list mode" then we need to drop the appropriate start tag $tag = ""; if ($this->list_state == LIST_NONE) { switch ($listchar) { case '*': $tag = "