X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMessage.php;h=826d55bfbc4e6da8e25f552909708d5699949a83;hb=f4471830752b5f33750fdd3abdc532e679bbf969;hp=31fbb07733dce592f5b0843328140e7b5dbfa2df;hpb=67c63613de88d4919d232118e18fd91424697a0d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 31fbb07733..826d55bfbc 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -659,10 +659,7 @@ class Message { # Maybe transform using the full parser if ( $this->format === 'parse' ) { $string = $this->parseText( $string ); - $m = array(); - if ( preg_match( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { - $string = $m[1]; - } + $string = Parser::stripOuterParagraph( $string ); } elseif ( $this->format === 'block-parse' ) { $string = $this->parseText( $string ); } elseif ( $this->format === 'text' ) { @@ -960,7 +957,14 @@ class Message { * @return string Wikitext parsed into HTML. */ protected function parseText( $string ) { - $out = MessageCache::singleton()->parse( $string, $this->title, /*linestart*/true, $this->interface, $this->language ); + $out = MessageCache::singleton()->parse( + $string, + $this->title, + /*linestart*/true, + $this->interface, + $this->language + ); + return $out instanceof ParserOutput ? $out->getText() : $out; } @@ -974,7 +978,12 @@ class Message { * @return string Wikitext with {{-constructs replaced with their values. */ protected function transformText( $string ) { - return MessageCache::singleton()->transform( $string, $this->interface, $this->language, $this->title ); + return MessageCache::singleton()->transform( + $string, + $this->interface, + $this->language, + $this->title + ); } /**