jenkins-bot has submitted this change and it was merged.

Change subject: Article: Add RL modules for the ParserOutput when showing 
CSS/JS page
......................................................................


Article: Add RL modules for the ParserOutput when showing CSS/JS page

It previously added only the page HTML, which meant that ResourceLoader
modules associated with the page and other metadata was lost. This
affected the new way of doing things in SyntaxHighlight (Idf4ad439).

We still do not show categories, language links and other things
on the pages (although internally they behave just like in wikitext)

Also needs a fix in DifferenceEngine because our code sucks so much.

Bug: 64859
Change-Id: I5867985693b27ccc9195fddde8b922e67463e836
---
M includes/Article.php
M includes/diff/DifferenceEngine.php
2 files changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  Daniel Kinzler: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/Article.php b/includes/Article.php
index 2d3240b..04972bc 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -822,8 +822,10 @@
                                'ShowRawCssJs',
                                array( $this->mContentObject, 
$this->getTitle(), $outputPage ) )
                        ) {
+                               // If no legacy hooks ran, display the content 
of the parser output, including RL modules,
+                               // but excluding metadata like categories and 
language links
                                $po = $this->mContentObject->getParserOutput( 
$this->getTitle() );
-                               $outputPage->addHTML( $po->getText() );
+                               $outputPage->addParserOutputContent( $po );
                        }
                }
        }
diff --git a/includes/diff/DifferenceEngine.php 
b/includes/diff/DifferenceEngine.php
index dd3f351..3aad389 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -554,7 +554,7 @@
 
                        // NOTE: only needed for B/C: custom rendering of 
JS/CSS via hook
                        if ( $this->mNewPage->isCssJsSubpage() || 
$this->mNewPage->isCssOrJsPage() ) {
-                               // Stolen from Article::view --AG 2007-10-11
+                               // This needs to be synchronised with 
Article::showCssOrJsPage(), which sucks
                                // Give hooks a chance to customise the output
                                // @todo standardize this crap into one function
                                if ( ContentHandler::runLegacyHooks( 
'ShowRawCssJs', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
@@ -562,8 +562,9 @@
                                        // use the content object's own 
rendering
                                        $cnt = $this->mNewRev->getContent();
                                        $po = $cnt ? $cnt->getParserOutput( 
$this->mNewRev->getTitle(), $this->mNewRev->getId() ) : null;
-                                       $txt = $po ? $po->getText() : '';
-                                       $out->addHTML( $txt );
+                                       if ( $po ) {
+                                               $out->addParserOutputContent( 
$po );
+                                       }
                                }
                        } elseif ( !wfRunHooks( 'ArticleContentViewCustom', 
array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
                                // Handled by extension

-- 
To view, visit https://gerrit.wikimedia.org/r/131502
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5867985693b27ccc9195fddde8b922e67463e836
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to