From 8f4bf54583fe9cebfba596473708e0131f60ebb7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 2 Jun 2004 07:43:05 +0000 Subject: [PATCH] Don't put literal , , or into the output. This breaks (X)HTML validation as well as the general rule of rejecting unknown tags by showing them as text. ( is never unknown of course, so it never appears. Just its text remains raw.) --- includes/Parser.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 2bb28ede33..944353ff53 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -214,18 +214,23 @@ class Parser $text = Parser::extractTags("nowiki", $text, $nowiki_content, $uniq_prefix); foreach( $nowiki_content as $marker => $content ){ - //if( $render ){ + if( $render ){ //# use span to mark nowiki areas, note the trailing whitespace in span to avoid collisions with other spans //$nowiki_content[$marker] = ''.wfEscapeHTMLTagsOnly( $content ).""; - //} else { + $nowiki_content[$marker] = $content; + } else { $nowiki_content[$marker] = "$content"; - //} + } } $text = Parser::extractTags("hiero", $text, $hiero_content, $uniq_prefix); foreach( $hiero_content as $marker => $content ){ - if( $render && $GLOBALS['wgUseWikiHiero']){ - $hiero_content[$marker] = WikiHiero( $content, WH_MODE_HTML); + if( $render ) { + if( $GLOBALS['wgUseWikiHiero'] ) { + $hiero_content[$marker] = WikiHiero( $content, WH_MODE_HTML); + } else { + $hiero_content[$marker] = "<hiero>$content</hiero>"; + } } else { $hiero_content[$marker] = "$content"; } @@ -233,8 +238,12 @@ class Parser $text = Parser::extractTags("timeline", $text, $timeline_content, $uniq_prefix); foreach( $timeline_content as $marker => $content ){ - if( $render && $GLOBALS['wgUseTimeline']){ - $timeline_content[$marker] = renderTimeline( $content ); + if( $render ) { + if( $render && $GLOBALS['wgUseTimeline']){ + $timeline_content[$marker] = renderTimeline( $content ); + } else { + $timeline_content[$marker] = "<timeline>$content</timeline>"; + } } else { $timeline_content[$marker] = "$content"; } @@ -246,7 +255,7 @@ class Parser if( $this->mOptions->getUseTeX() ) { $math_content[$marker] = renderMath( $content ); } else { - $math_content[$marker] = "<math>$content<math>"; + $math_content[$marker] = "<math>$content</math>"; } } else { $math_content[$marker] = "$content"; @@ -255,7 +264,7 @@ class Parser $text = Parser::extractTags("pre", $text, $pre_content, $uniq_prefix); foreach( $pre_content as $marker => $content ){ - if( $render ){ + if( $render ) { $pre_content[$marker] = "
" . wfEscapeHTMLTagsOnly( $content ) . "
"; } else { $pre_content[$marker] = "
$content
"; -- 2.20.1