From: Gabriel Wicke Date: Wed, 7 Apr 2004 17:56:13 +0000 (+0000) Subject: * doTokenizedParser doesn't assume leading text token anymore, 0 !== false X-Git-Tag: 1.3.0beta1~561 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=e592d588c40ea8e6ff82eea2fecfba3eca162996;p=lhc%2Fweb%2Fwiklou.git * doTokenizedParser doesn't assume leading text token anymore, 0 !== false * pre nesting problem fixed by matching against $uniq_prefix . '-' . $tag, marker changed to this format. If stripped areas shouldn't be nested in p's, add those tags to the $inBlockElem = false; regex in doBlockLevels --- diff --git a/includes/Parser.php b/includes/Parser.php index d1c3d53b66..49bb50a095 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -108,7 +108,7 @@ class Parser /* static */ function extractTags($tag, $text, &$content, $uniq_prefix = ""){ $result = array(); - $rnd = $uniq_prefix . Parser::getRandomString(); + $rnd = $uniq_prefix . '-' . $tag . Parser::getRandomString(); $content = array( ); $n = 1; $stripped = ""; @@ -178,9 +178,9 @@ class Parser $text = Parser::extractTags("pre", $text, $pre_content, $uniq_prefix); foreach( $pre_content as $marker => $content ){ if( $render ){ - $pre_content[$marker] = "\n
" . wfEscapeHTMLTagsOnly( $content ) . "
"; + $pre_content[$marker] = "
" . wfEscapeHTMLTagsOnly( $content ) . "
"; } else { - $pre_content[$marker] = "\n
$content
"; + $pre_content[$marker] = "
$content
"; } } @@ -547,8 +547,8 @@ class Parser /* private */ function handle3Quotes( &$state, $token ) { - if ( $state["strong"] ) { - if ( $state["em"] && $state["em"] > $state["strong"] ) + if ( $state["strong"] !== false ) { + if ( $state["em"] !== false && $state["em"] > $state["strong"] ) { # ''' lala ''lala ''' $s = ""; @@ -565,8 +565,8 @@ class Parser /* private */ function handle2Quotes( &$state, $token ) { - if ( $state["em"] ) { - if ( $state["strong"] && $state["strong"] > $state["em"] ) + if ( $state["em"] !== false ) { + if ( $state["strong"] !== false && $state["strong"] > $state["em"] ) { # ''lala'''lala'' ....''' $s = ""; @@ -584,18 +584,18 @@ class Parser /* private */ function handle5Quotes( &$state, $token ) { $s = ""; - if ( $state["em"] && $state["strong"] ) { + if ( $state["em"] !== false && $state["strong"] ) { if ( $state["em"] < $state["strong"] ) { $s .= ""; } else { $s .= ""; } $state["strong"] = $state["em"] = FALSE; - } elseif ( $state["em"] ) { + } elseif ( $state["em"] !== false ) { $s .= ""; $state["em"] = FALSE; $state["strong"] = $token["pos"]; - } elseif ( $state["strong"] ) { + } elseif ( $state["strong"] !== false ) { $s .= ""; $state["strong"] = FALSE; $state["em"] = $token["pos"]; @@ -1027,10 +1027,10 @@ class Parser } if ( 0 == $npl ) { # No prefix--go to paragraph mode if ( preg_match( - "/(closeParagraph(); $inBlockElem = true; - } else if ( preg_match("/(closeParagraph(); $inBlockElem = false; } @@ -1057,7 +1057,7 @@ class Parser } } if ( $inBlockElem && - preg_match( "/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|<\\/p<\\/div|<\\/pre)/i", $t ) ) { + preg_match( "/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|<\\/p<\\/div)/i", $t ) ) { $inBlockElem = false; } }