X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoader.php;h=855311667d58b0fca00e6743db278485f93c152d;hp=c11fe5b6187b16cf663f46cd8beef69a1f11b49c;hb=12601ff7d2796752404bfb331fccc41083d31f9f;hpb=999351249b1810385ea2818ec445f784b24b72af diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index c11fe5b618..855311667d 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1100,7 +1100,12 @@ MESSAGE; $strContent = self::filter( $filter, $strContent ); } - $out .= $strContent; + if ( $context->getOnly() === 'scripts' ) { + // Use a linebreak between module scripts (T162719) + $out .= $this->ensureNewline( $strContent ); + } else { + $out .= $strContent; + } } catch ( Exception $e ) { $this->outputErrorAndLog( $e, 'Generating module package failed: {exception}' ); @@ -1128,7 +1133,8 @@ MESSAGE; if ( !$context->getDebug() ) { $stateScript = self::filter( 'minify-js', $stateScript ); } - $out .= $stateScript; + // Use a linebreak between module script and state script (T162719) + $out = $this->ensureNewline( $out ) . $stateScript; } } else { if ( count( $states ) ) { @@ -1140,6 +1146,19 @@ MESSAGE; return $out; } + /** + * Ensure the string is either empty or ends in a line break + * @param string $str + * @return string + */ + private function ensureNewline( $str ) { + $end = substr( $str, -1 ); + if ( $end === false || $end === "\n" ) { + return $str; + } + return $str . "\n"; + } + /** * Get names of modules that use a certain message. *