From 08e09ce35e83fb7fb2859c414287bada4c718e16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 26 Mar 2006 02:38:01 +0000 Subject: [PATCH] * Patch by Ivan Krstic to fix a parser test case --- includes/Parser.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 00dfae2808..a846fc80f5 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -473,11 +473,9 @@ class Parser } # Comments - if($stripcomments) { - $text = Parser::extractTags(STRIP_COMMENTS, $text, $comment_content, $uniq_prefix); - foreach( $comment_content as $marker => $content ){ - $comment_content[$marker] = ''; - } + $text = Parser::extractTags(STRIP_COMMENTS, $text, $comment_content, $uniq_prefix); + foreach( $comment_content as $marker => $content ){ + $comment_content[$marker] = ''; } # Extensions @@ -501,6 +499,16 @@ class Parser } } + # Unstrip comments unless explicitly told otherwise. + # (The comments are always stripped prior to this point, so as to + # not invoke any extension tags / parser hooks contained within + # a comment.) + if ( !$stripcomments ) { + $tempstate = array( 'comment' => $comment_content ); + $text = $this->unstrip( $text, $tempstate ); + $comment_content = array(); + } + # Merge state with the pre-existing state, if there is one if ( $state ) { $state['html'] = $state['html'] + $html_content; -- 2.20.1