Special:NewFiles - ensure top text is entirely wrapped
authorC. Scott Ananian <cscott@cscott.net>
Thu, 27 Sep 2018 13:24:15 +0000 (09:24 -0400)
committerC. Scott Ananian <cananian@wikimedia.org>
Thu, 27 Sep 2018 14:23:25 +0000 (14:23 +0000)
The template on commons for newimagestext has a <div> wrapper,
and trying to wrap a <p> around a <div> doesn't work: the <p> is
implicitly closed by the start of the <div>.  Use a <div> wrapper
to set the content language and directionality instead, which ensures
that it is valid HTML and will be tidied correctly.

In the process, fix an extra argument (and unnecessary optional argument)
passed to OutputPage::addWikiTextTidy in
Ife33ceed39ed01d4e9af18e9108026f341e9b343.

Bug: T205624
Change-Id: I42d198e6d03afd5b976da741f235c175bfe9f767

includes/specials/SpecialNewimages.php

index 513d14c..e88162e 100644 (file)
@@ -219,16 +219,14 @@ class SpecialNewFiles extends IncludableSpecialPage {
                if ( !$message->isDisabled() ) {
                        $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                        $this->getOutput()->addWikiTextTidy(
-                               Html::rawElement( 'p',
+                               Html::rawElement( 'div',
                                        [
 
                                                'lang' => $contLang->getHtmlCode(),
                                                'dir' => $contLang->getDir()
                                        ],
                                        "\n" . $message->plain() . "\n"
-                               ),
-                               /* $lineStart */ false,
-                               /* $interface */ false
+                               )
                        );
                }
        }