Remove untidy wrapper from ImagePage::makeMetadataTable()
authorC. Scott Ananian <cscott@cscott.net>
Wed, 17 Oct 2018 14:47:35 +0000 (10:47 -0400)
committerC. Scott Ananian <cananian@wikimedia.org>
Mon, 22 Oct 2018 16:45:50 +0000 (16:45 +0000)
Replace a fragile <div> wrapper with the robust
OutputPage::wrapWikiTextAsInterface() wrapper.

Bug: T205624
Change-Id: I0a1ba0da6af97f0233afdd8ba7202abed0998419

includes/page/ImagePage.php

index c879a88..c933c15 100644 (file)
@@ -187,7 +187,10 @@ class ImagePage extends Article {
                                'h2',
                                [ 'id' => 'metadata' ],
                                        $this->getContext()->msg( 'metadata' )->text() ) . "\n" );
-                       $out->addWikiTextAsInterface( $this->makeMetadataTable( $formattedMetadata ) );
+                       $out->wrapWikiTextAsInterface(
+                               'mw-imagepage-section-metadata',
+                               $this->makeMetadataTable( $formattedMetadata )
+                       );
                        $out->addModules( [ 'mediawiki.action.view.metadata' ] );
                }
 
@@ -246,8 +249,7 @@ class ImagePage extends Article {
         * @return string The metadata table. This is treated as Wikitext (!)
         */
        protected function makeMetadataTable( $metadata ) {
-               $r = "<div class=\"mw-imagepage-section-metadata\">";
-               $r .= $this->getContext()->msg( 'metadata-help' )->plain();
+               $r = $this->getContext()->msg( 'metadata-help' )->plain();
                // Intial state is collapsed
                // see filepage.css and mediawiki.action.view.metadata module.
                $r .= "<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
@@ -264,7 +266,7 @@ class ImagePage extends Article {
                                );
                        }
                }
-               $r .= "</table>\n</div>\n";
+               $r .= "</table>\n";
                return $r;
        }