Remove various double empty newlines
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 3b49ccf..eaecedd 100644 (file)
@@ -91,8 +91,10 @@ class Parser {
        # at least one character of a host name (embeds EXT_LINK_URL_CLASS)
        const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])';
        # RegExp to make image URLs (embeds IPv6 part of EXT_LINK_ADDR)
+       // @codingStandardsIgnoreStart Generic.Files.LineLength
        const EXT_IMAGE_REGEX = '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}]+)
                \\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu';
+       // @codingStandardsIgnoreEnd
 
        # Regular expression for a non-newline space
        const SPACE_NOT_NL = '(?:\t|&nbsp;|&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})';
@@ -1338,6 +1340,7 @@ class Parser {
 
                if ( MWTidy::isEnabled() && $this->mOptions->getTidy() ) {
                        $text = MWTidy::tidy( $text );
+                       $this->mOutput->addModuleStyles( MWTidy::getModuleStyles() );
                } else {
                        # attempt to sanitize at least some nesting problems
                        # (bug #2702 and quite a few others)
@@ -3385,6 +3388,8 @@ class Parser {
         * Warn the user when a parser limitation is reached
         * Will warn at most once the user per limitation type
         *
+        * The results are shown during preview and run through the Parser (See EditPage.php)
+        *
         * @param string $limitationType Should be one of:
         *   'expensive-parserfunction' (corresponding messages:
         *       'expensive-parserfunction-warning',
@@ -3407,8 +3412,10 @@ class Parser {
         */
        public function limitationWarn( $limitationType, $current = '', $max = '' ) {
                # does no harm if $current and $max are present but are unnecessary for the message
+               # Not doing ->inLanguage( $this->mOptions->getUserLangObj() ), since this is shown
+               # only during preview, and that would split the parser cache unnecessarily.
                $warning = wfMessage( "$limitationType-warning" )->numParams( $current, $max )
-                       ->inLanguage( $this->mOptions->getUserLangObj() )->text();
+                       ->text();
                $this->mOutput->addWarning( $warning );
                $this->addTrackingCategory( "$limitationType-category" );
        }
@@ -3745,7 +3752,6 @@ class Parser {
        public function callParserFunction( $frame, $function, array $args = array() ) {
                global $wgContLang;
 
-
                # Case sensitive functions
                if ( isset( $this->mFunctionSynonyms[1][$function] ) ) {
                        $function = $this->mFunctionSynonyms[1][$function];
@@ -5757,7 +5763,6 @@ class Parser {
                        throw new MWException( __METHOD__ .
                                " can only be called when actually parsing something" );
                }
-               $this->mOutput->setCacheTime( -1 ); // old style, for compatibility
                $this->mOutput->updateCacheExpiry( 0 ); // new style, for consistency
        }