Index: trunk/phase3/includes/Parser.php |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | |
110 | 110 | /* static */ function extractTags($tag, $text, &$content, $uniq_prefix = ""){ |
111 | 111 | $result = array(); |
112 | | - $rnd = $uniq_prefix . Parser::getRandomString(); |
| 112 | + $rnd = $uniq_prefix . '-' . $tag . Parser::getRandomString(); |
113 | 113 | $content = array( ); |
114 | 114 | $n = 1; |
115 | 115 | $stripped = ""; |
— | — | @@ -178,9 +178,9 @@ |
179 | 179 | $text = Parser::extractTags("pre", $text, $pre_content, $uniq_prefix); |
180 | 180 | foreach( $pre_content as $marker => $content ){ |
181 | 181 | if( $render ){ |
182 | | - $pre_content[$marker] = "\n<pre>" . wfEscapeHTMLTagsOnly( $content ) . "</pre>"; |
| 182 | + $pre_content[$marker] = "<pre>" . wfEscapeHTMLTagsOnly( $content ) . "</pre>"; |
183 | 183 | } else { |
184 | | - $pre_content[$marker] = "\n<pre>$content</pre>"; |
| 184 | + $pre_content[$marker] = "<pre>$content</pre>"; |
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
— | — | @@ -547,8 +547,8 @@ |
548 | 548 | |
549 | 549 | /* private */ function handle3Quotes( &$state, $token ) |
550 | 550 | { |
551 | | - if ( $state["strong"] ) { |
552 | | - if ( $state["em"] && $state["em"] > $state["strong"] ) |
| 551 | + if ( $state["strong"] !== false ) { |
| 552 | + if ( $state["em"] !== false && $state["em"] > $state["strong"] ) |
553 | 553 | { |
554 | 554 | # ''' lala ''lala ''' |
555 | 555 | $s = "</em></strong><em>"; |
— | — | @@ -565,8 +565,8 @@ |
566 | 566 | |
567 | 567 | /* private */ function handle2Quotes( &$state, $token ) |
568 | 568 | { |
569 | | - if ( $state["em"] ) { |
570 | | - if ( $state["strong"] && $state["strong"] > $state["em"] ) |
| 569 | + if ( $state["em"] !== false ) { |
| 570 | + if ( $state["strong"] !== false && $state["strong"] > $state["em"] ) |
571 | 571 | { |
572 | 572 | # ''lala'''lala'' ....''' |
573 | 573 | $s = "</strong></em><strong>"; |
— | — | @@ -584,18 +584,18 @@ |
585 | 585 | /* private */ function handle5Quotes( &$state, $token ) |
586 | 586 | { |
587 | 587 | $s = ""; |
588 | | - if ( $state["em"] && $state["strong"] ) { |
| 588 | + if ( $state["em"] !== false && $state["strong"] ) { |
589 | 589 | if ( $state["em"] < $state["strong"] ) { |
590 | 590 | $s .= "</strong></em>"; |
591 | 591 | } else { |
592 | 592 | $s .= "</em></strong>"; |
593 | 593 | } |
594 | 594 | $state["strong"] = $state["em"] = FALSE; |
595 | | - } elseif ( $state["em"] ) { |
| 595 | + } elseif ( $state["em"] !== false ) { |
596 | 596 | $s .= "</em><strong>"; |
597 | 597 | $state["em"] = FALSE; |
598 | 598 | $state["strong"] = $token["pos"]; |
599 | | - } elseif ( $state["strong"] ) { |
| 599 | + } elseif ( $state["strong"] !== false ) { |
600 | 600 | $s .= "</strong><em>"; |
601 | 601 | $state["strong"] = FALSE; |
602 | 602 | $state["em"] = $token["pos"]; |
— | — | @@ -1027,10 +1027,10 @@ |
1028 | 1028 | } |
1029 | 1029 | if ( 0 == $npl ) { # No prefix--go to paragraph mode |
1030 | 1030 | if ( preg_match( |
1031 | | - "/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<div|<pre)/i", $t ) ) { |
| 1031 | + "/(<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<div)/i", $t ) ) { |
1032 | 1032 | $text .= $this->closeParagraph(); |
1033 | 1033 | $inBlockElem = true; |
1034 | | - } else if ( preg_match("/(<hr|<\\/td)/i", $t ) ) { |
| 1034 | + } else if ( preg_match("/(<hr|<\\/td|".$uniq_prefix."-pre)/i", $t ) ) { |
1035 | 1035 | $text .= $this->closeParagraph(); |
1036 | 1036 | $inBlockElem = false; |
1037 | 1037 | } |
— | — | @@ -1057,7 +1057,7 @@ |
1058 | 1058 | } |
1059 | 1059 | } |
1060 | 1060 | if ( $inBlockElem && |
1061 | | - preg_match( "/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|<\\/p<\\/div|<\\/pre)/i", $t ) ) { |
| 1061 | + preg_match( "/(<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|<\\/p<\\/div)/i", $t ) ) { |
1062 | 1062 | $inBlockElem = false; |
1063 | 1063 | } |
1064 | 1064 | } |