Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/275141

Change subject: Move wrapping of body text after hook
......................................................................

Move wrapping of body text after hook

The MobileFrontend extension manipulates the bodytext value before
rendering with various transformations via the MobileFormatter but
still needs the content to be wrapped with this important information
relating to language.

Thus apply this after the hook.

This avoids unnecessary logic in I2b2aa15bee73454b1abc238c3413d30cdaa49f2c

Change-Id: I8a9e732d0682af89112869a2b30f61f10f531219
---
M includes/skins/SkinTemplate.php
1 file changed, 19 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/41/275141/1

diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index 1328870..c351d89 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -426,22 +426,6 @@
                $tpl->set( 'sitenotice', $this->getSiteNotice() );
                $tpl->set( 'bottomscripts', $this->bottomScripts() );
                $tpl->set( 'printfooter', $this->printSource() );
-
-               # An ID that includes the actual body text; without categories, 
contentSub, ...
-               $realBodyAttribs = array( 'id' => 'mw-content-text' );
-
-               # Add a mw-content-ltr/rtl class to be able to style based on 
text direction
-               # when the content is different from the UI language, i.e.:
-               # not for special pages or file pages AND only when viewing
-               if ( !in_array( $title->getNamespace(), array( NS_SPECIAL, 
NS_FILE ) ) &&
-                       Action::getActionName( $this ) === 'view' ) {
-                       $pageLang = $title->getPageViewLanguage();
-                       $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
-                       $realBodyAttribs['dir'] = $pageLang->getDir();
-                       $realBodyAttribs['class'] = 'mw-content-' . 
$pageLang->getDir();
-               }
-
-               $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, 
$out->mBodytext );
                $tpl->setRef( 'bodytext', $out->mBodytext );
 
                $language_urls = $this->getLanguages();
@@ -473,6 +457,25 @@
                        wfDebug( __METHOD__ . ": Hook 
SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
                }
 
+               # An ID that includes the actual body text; without categories, 
contentSub, ...
+               $realBodyAttribs = array( 'id' => 'mw-content-text' );
+
+               # Add a mw-content-ltr/rtl class to be able to style based on 
text direction
+               # when the content is different from the UI language, i.e.:
+               # not for special pages or file pages AND only when viewing
+               if ( !in_array( $title->getNamespace(), array( NS_SPECIAL, 
NS_FILE ) ) &&
+                       Action::getActionName( $this ) === 'view' ) {
+                       $pageLang = $title->getPageViewLanguage();
+                       $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
+                       $realBodyAttribs['dir'] = $pageLang->getDir();
+                       $realBodyAttribs['class'] = 'mw-content-' . 
$pageLang->getDir();
+               }
+
+               // Wrap the bodyText with #mw-content-text element
+               // Do this after the hook in case anything has changed
+               $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, 
$out->mBodytext );
+               $tpl->setRef( 'bodytext', $out->mBodytext );
+
                // Set the bodytext to another key so that skins can just 
output it on its own
                // and output printfooter and debughtml separately
                $tpl->set( 'bodycontent', $tpl->data['bodytext'] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a9e732d0682af89112869a2b30f61f10f531219
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to