Legoktm has uploaded a new change for review.

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


Change subject: Only load RL modules when a <ref> tag is being used
......................................................................

Only load RL modules when a <ref> tag is being used

Bug: 55684
Change-Id: I8f7528ef8468bf3fa1c901fd6dc67b5eebc0cbd6
---
M Cite.php
M Cite_body.php
2 files changed, 7 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/17/89617/1

diff --git a/Cite.php b/Cite.php
index 4b2f70f..045bb8c 100644
--- a/Cite.php
+++ b/Cite.php
@@ -18,8 +18,6 @@
  */
 
 $wgHooks['ParserFirstCallInit'][] = 'wfCite';
-$wgHooks['BeforePageDisplay'][] = 'wfCiteBeforePageDisplay';
-
 
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
@@ -97,23 +95,5 @@
        'styles' => 'ext.rtlcite.css',
        'position' => 'top',
 );
-
-/**
- * @param $out OutputPage
- * @param $sk Skin
- * @return bool
- */
-function wfCiteBeforePageDisplay( $out, &$sk ) {
-       global $wgCiteEnablePopups;
-
-       $out->addModules( 'ext.cite' );
-       if ( $wgCiteEnablePopups ) {
-               $out->addModules( 'ext.cite.popups' );
-       }
-
-       /* RTL support quick-fix module */
-       $out->addModuleStyles( 'ext.rtlcite' );
-       return true;
-}
 
 /**#@-*/
diff --git a/Cite_body.php b/Cite_body.php
index 3c462c6..48c4207 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -155,6 +155,7 @@
         * @return string
         */
        function ref( $str, $argv, $parser ) {
+               global $wgCiteEnablePopups;
                if ( $this->mInCite ) {
                        return htmlspecialchars( "<ref>$str</ref>" );
                } else {
@@ -162,6 +163,12 @@
                        $this->mInCite = true;
                        $ret = $this->guardedRef( $str, $argv, $parser );
                        $this->mInCite = false;
+                       $parserOutput = $parser->getOutput();
+                       $parserOutput->addModules( 'ext.cite' );
+                       if ( $wgCiteEnablePopups ) {
+                               $parserOutput->addModules( 'ext.cite.popups' );
+                       }
+                       $parserOutput->addModuleStyles( 'ext.rtlcite' );
                        return $ret;
                }
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f7528ef8468bf3fa1c901fd6dc67b5eebc0cbd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

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

Reply via email to