mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-18 09:40:49 +00:00
Only load RL modules when a <ref> tag is being used
Bug: 55684 Change-Id: I8f7528ef8468bf3fa1c901fd6dc67b5eebc0cbd6
This commit is contained in:
parent
6832d0b4d7
commit
a94c871cd2
20
Cite.php
20
Cite.php
|
@ -18,8 +18,6 @@ if ( ! defined( 'MEDIAWIKI' ) )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$wgHooks['ParserFirstCallInit'][] = 'wfCite';
|
$wgHooks['ParserFirstCallInit'][] = 'wfCite';
|
||||||
$wgHooks['BeforePageDisplay'][] = 'wfCiteBeforePageDisplay';
|
|
||||||
|
|
||||||
|
|
||||||
$wgExtensionCredits['parserhook'][] = array(
|
$wgExtensionCredits['parserhook'][] = array(
|
||||||
'path' => __FILE__,
|
'path' => __FILE__,
|
||||||
|
@ -98,22 +96,4 @@ $wgResourceModules['ext.rtlcite'] = $citeResourceTemplate + array(
|
||||||
'position' => 'top',
|
'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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
|
@ -155,6 +155,7 @@ class Cite {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ref( $str, $argv, $parser ) {
|
function ref( $str, $argv, $parser ) {
|
||||||
|
global $wgCiteEnablePopups;
|
||||||
if ( $this->mInCite ) {
|
if ( $this->mInCite ) {
|
||||||
return htmlspecialchars( "<ref>$str</ref>" );
|
return htmlspecialchars( "<ref>$str</ref>" );
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,6 +163,12 @@ class Cite {
|
||||||
$this->mInCite = true;
|
$this->mInCite = true;
|
||||||
$ret = $this->guardedRef( $str, $argv, $parser );
|
$ret = $this->guardedRef( $str, $argv, $parser );
|
||||||
$this->mInCite = false;
|
$this->mInCite = false;
|
||||||
|
$parserOutput = $parser->getOutput();
|
||||||
|
$parserOutput->addModules( 'ext.cite' );
|
||||||
|
if ( $wgCiteEnablePopups ) {
|
||||||
|
$parserOutput->addModules( 'ext.cite.popups' );
|
||||||
|
}
|
||||||
|
$parserOutput->addModuleStyles( 'ext.rtlcite' );
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue