Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | /** |
518 | 518 | * Process the wikitext for the ?preload= feature. (bug 5210) |
519 | 519 | * |
520 | | - * <noinclude>, <includeonly> etc. are parsed as for template transclusion, |
| 520 | + * <noinclude>, <includeonly> etc. are parsed as for template transclusion, |
521 | 521 | * comments, templates, arguments, tags hooks and parser functions are untouched. |
522 | 522 | */ |
523 | 523 | public function getPreloadText( $text, $title, $options ) { |
— | — | @@ -524,7 +524,7 @@ |
525 | 525 | $this->clearState(); |
526 | 526 | $this->setOutputType( self::OT_PLAIN ); |
527 | 527 | $this->mOptions = $options; |
528 | | - $this->setTitle( $title ); |
| 528 | + $this->setTitle( $title ); |
529 | 529 | |
530 | 530 | $flags = PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES; |
531 | 531 | $dom = $this->preprocessToDom( $text, self::PTD_FOR_INCLUSION ); |
— | — | @@ -1163,12 +1163,12 @@ |
1164 | 1164 | } |
1165 | 1165 | # Count the number of occurrences of bold and italics mark-ups. |
1166 | 1166 | # We are not counting sequences of five apostrophes. |
1167 | | - if ( strlen( $arr[$i] ) == 2 ) { |
| 1167 | + if ( strlen( $arr[$i] ) == 2 ) { |
1168 | 1168 | $numitalics++; |
1169 | | - } elseif ( strlen( $arr[$i] ) == 3 ) { |
| 1169 | + } elseif ( strlen( $arr[$i] ) == 3 ) { |
1170 | 1170 | $numbold++; |
1171 | | - } elseif ( strlen( $arr[$i] ) == 5 ) { |
1172 | | - $numitalics++; |
| 1171 | + } elseif ( strlen( $arr[$i] ) == 5 ) { |
| 1172 | + $numitalics++; |
1173 | 1173 | $numbold++; |
1174 | 1174 | } |
1175 | 1175 | } |
— | — | @@ -1193,7 +1193,7 @@ |
1194 | 1194 | $firstspace = $i; |
1195 | 1195 | } |
1196 | 1196 | } elseif ( $x2 === ' ') { |
1197 | | - if ( $firstsingleletterword == -1 ) { |
| 1197 | + if ( $firstsingleletterword == -1 ) { |
1198 | 1198 | $firstsingleletterword = $i; |
1199 | 1199 | } |
1200 | 1200 | } else { |
— | — | @@ -1613,10 +1613,10 @@ |
1614 | 1614 | # [[Image:Foo.jpg|[http://example.com desc]]] <- having three ] in a row fucks up, |
1615 | 1615 | # the real problem is with the $e1 regex |
1616 | 1616 | # See bug 1300. |
1617 | | - # |
| 1617 | + # |
1618 | 1618 | # Still some problems for cases where the ] is meant to be outside punctuation, |
1619 | 1619 | # and no image is in sight. See bug 2095. |
1620 | | - # |
| 1620 | + # |
1621 | 1621 | if ( $text !== '' && |
1622 | 1622 | substr( $m[3], 0, 1 ) === ']' && |
1623 | 1623 | strpos( $text, '[' ) !== false |
— | — | @@ -1827,7 +1827,7 @@ |
1828 | 1828 | wfProfileIn( __METHOD__."-always_known" ); |
1829 | 1829 | # Some titles, such as valid special pages or files in foreign repos, should |
1830 | 1830 | # be shown as bluelinks even though they're not included in the page table |
1831 | | - # |
| 1831 | + # |
1832 | 1832 | # FIXME: isAlwaysKnown() can be expensive for file links; we should really do |
1833 | 1833 | # batch file existence checks for NS_FILE and NS_MEDIA |
1834 | 1834 | if ( $iw == '' && $nt->isAlwaysKnown() ) { |
— | — | @@ -1928,18 +1928,18 @@ |
1929 | 1929 | /** |
1930 | 1930 | * getCommon() returns the length of the longest common substring |
1931 | 1931 | * of both arguments, starting at the beginning of both. |
1932 | | - * @private |
1933 | | - */ |
| 1932 | + * @private |
| 1933 | + */ |
1934 | 1934 | function getCommon( $st1, $st2 ) { |
1935 | 1935 | $fl = strlen( $st1 ); |
1936 | 1936 | $shorter = strlen( $st2 ); |
1937 | | - if ( $fl < $shorter ) { |
1938 | | - $shorter = $fl; |
| 1937 | + if ( $fl < $shorter ) { |
| 1938 | + $shorter = $fl; |
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | for ( $i = 0; $i < $shorter; ++$i ) { |
1942 | | - if ( $st1{$i} != $st2{$i} ) { |
1943 | | - break; |
| 1942 | + if ( $st1{$i} != $st2{$i} ) { |
| 1943 | + break; |
1944 | 1944 | } |
1945 | 1945 | } |
1946 | 1946 | return $i; |
— | — | @@ -1947,22 +1947,22 @@ |
1948 | 1948 | /** |
1949 | 1949 | * These next three functions open, continue, and close the list |
1950 | 1950 | * element appropriate to the prefix character passed into them. |
1951 | | - * @private |
| 1951 | + * @private |
1952 | 1952 | */ |
1953 | 1953 | function openList( $char ) { |
1954 | 1954 | $result = $this->closeParagraph(); |
1955 | 1955 | |
1956 | | - if ( '*' === $char ) { |
1957 | | - $result .= '<ul><li>'; |
1958 | | - } elseif ( '#' === $char ) { |
1959 | | - $result .= '<ol><li>'; |
1960 | | - } elseif ( ':' === $char ) { |
1961 | | - $result .= '<dl><dd>'; |
| 1956 | + if ( '*' === $char ) { |
| 1957 | + $result .= '<ul><li>'; |
| 1958 | + } elseif ( '#' === $char ) { |
| 1959 | + $result .= '<ol><li>'; |
| 1960 | + } elseif ( ':' === $char ) { |
| 1961 | + $result .= '<dl><dd>'; |
1962 | 1962 | } elseif ( ';' === $char ) { |
1963 | 1963 | $result .= '<dl><dt>'; |
1964 | 1964 | $this->mDTopen = true; |
1965 | | - } else { |
1966 | | - $result = '<!-- ERR 1 -->'; |
| 1965 | + } else { |
| 1966 | + $result = '<!-- ERR 1 -->'; |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | return $result; |
— | — | @@ -1974,12 +1974,12 @@ |
1975 | 1975 | * @private |
1976 | 1976 | */ |
1977 | 1977 | function nextItem( $char ) { |
1978 | | - if ( '*' === $char || '#' === $char ) { |
1979 | | - return '</li><li>'; |
| 1978 | + if ( '*' === $char || '#' === $char ) { |
| 1979 | + return '</li><li>'; |
1980 | 1980 | } elseif ( ':' === $char || ';' === $char ) { |
1981 | 1981 | $close = '</dd>'; |
1982 | | - if ( $this->mDTopen ) { |
1983 | | - $close = '</dt>'; |
| 1982 | + if ( $this->mDTopen ) { |
| 1983 | + $close = '</dt>'; |
1984 | 1984 | } |
1985 | 1985 | if ( ';' === $char ) { |
1986 | 1986 | $this->mDTopen = true; |
— | — | @@ -1998,10 +1998,10 @@ |
1999 | 1999 | * @private |
2000 | 2000 | */ |
2001 | 2001 | function closeList( $char ) { |
2002 | | - if ( '*' === $char ) { |
2003 | | - $text = '</li></ul>'; |
2004 | | - } elseif ( '#' === $char ) { |
2005 | | - $text = '</li></ol>'; |
| 2002 | + if ( '*' === $char ) { |
| 2003 | + $text = '</li></ul>'; |
| 2004 | + } elseif ( '#' === $char ) { |
| 2005 | + $text = '</li></ol>'; |
2006 | 2006 | } elseif ( ':' === $char ) { |
2007 | 2007 | if ( $this->mDTopen ) { |
2008 | 2008 | $this->mDTopen = false; |
— | — | @@ -2009,8 +2009,8 @@ |
2010 | 2010 | } else { |
2011 | 2011 | $text = '</dd></dl>'; |
2012 | 2012 | } |
2013 | | - } else { |
2014 | | - return '<!-- ERR 3 -->'; |
| 2013 | + } else { |
| 2014 | + return '<!-- ERR 3 -->'; |
2015 | 2015 | } |
2016 | 2016 | return $text."\n"; |
2017 | 2017 | } |
— | — | @@ -2029,7 +2029,7 @@ |
2030 | 2030 | # Parsing through the text line by line. The main thing |
2031 | 2031 | # happening here is handling of block-level elements p, pre, |
2032 | 2032 | # and making lists from lines starting with * # : etc. |
2033 | | - # |
| 2033 | + # |
2034 | 2034 | $textLines = StringUtils::explode( "\n", $text ); |
2035 | 2035 | |
2036 | 2036 | $lastPrefix = $output = ''; |
— | — | @@ -2680,7 +2680,7 @@ |
2681 | 2681 | } |
2682 | 2682 | |
2683 | 2683 | /** |
2684 | | - * initialise the magic variables (like CURRENTMONTHNAME) and substitution modifiers |
| 2684 | + * initialise the magic variables (like CURRENTMONTHNAME) and substitution modifiers |
2685 | 2685 | * |
2686 | 2686 | * @private |
2687 | 2687 | */ |
— | — | @@ -2804,14 +2804,14 @@ |
2805 | 2805 | * Will warn at most once the user per limitation type |
2806 | 2806 | * |
2807 | 2807 | * @param string $limitationType, should be one of: |
2808 | | - * 'expensive-parserfunction' (corresponding messages: |
2809 | | - * 'expensive-parserfunction-warning', |
| 2808 | + * 'expensive-parserfunction' (corresponding messages: |
| 2809 | + * 'expensive-parserfunction-warning', |
2810 | 2810 | * 'expensive-parserfunction-category') |
2811 | | - * 'post-expand-template-argument' (corresponding messages: |
2812 | | - * 'post-expand-template-argument-warning', |
| 2811 | + * 'post-expand-template-argument' (corresponding messages: |
| 2812 | + * 'post-expand-template-argument-warning', |
2813 | 2813 | * 'post-expand-template-argument-category') |
2814 | | - * 'post-expand-template-inclusion' (corresponding messages: |
2815 | | - * 'post-expand-template-inclusion-warning', |
| 2814 | + * 'post-expand-template-inclusion' (corresponding messages: |
| 2815 | + * 'post-expand-template-inclusion-warning', |
2816 | 2816 | * 'post-expand-template-inclusion-category') |
2817 | 2817 | * @params int $current, $max When an explicit limit has been |
2818 | 2818 | * exceeded, provide the values (optional) |
— | — | @@ -3016,8 +3016,8 @@ |
3017 | 3017 | $limit = $this->mOptions->getMaxTemplateDepth(); |
3018 | 3018 | if ( $frame->depth >= $limit ) { |
3019 | 3019 | $found = true; |
3020 | | - $text = '<span class="error">' |
3021 | | - . wfMsgForContent( 'parser-template-recursion-depth-warning', $limit ) |
| 3020 | + $text = '<span class="error">' |
| 3021 | + . wfMsgForContent( 'parser-template-recursion-depth-warning', $limit ) |
3022 | 3022 | . '</span>'; |
3023 | 3023 | } |
3024 | 3024 | } |
— | — | @@ -3027,9 +3027,9 @@ |
3028 | 3028 | if ( !$found && $title ) { |
3029 | 3029 | wfProfileIn( __METHOD__ . '-loadtpl' ); |
3030 | 3030 | if ( !$title->isExternal() ) { |
3031 | | - if ( $title->getNamespace() == NS_SPECIAL |
3032 | | - && $this->mOptions->getAllowSpecialInclusion() |
3033 | | - && $this->ot['html'] ) |
| 3031 | + if ( $title->getNamespace() == NS_SPECIAL |
| 3032 | + && $this->mOptions->getAllowSpecialInclusion() |
| 3033 | + && $this->ot['html'] ) |
3034 | 3034 | { |
3035 | 3035 | $text = SpecialPage::capturePath( $title ); |
3036 | 3036 | if ( is_string( $text ) ) { |
— | — | @@ -3119,7 +3119,7 @@ |
3120 | 3120 | # Escape nowiki-style return values |
3121 | 3121 | $text = wfEscapeWikiText( $text ); |
3122 | 3122 | } elseif ( is_string( $text ) |
3123 | | - && !$piece['lineStart'] |
| 3123 | + && !$piece['lineStart'] |
3124 | 3124 | && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) ) |
3125 | 3125 | { |
3126 | 3126 | # Bug 529: if the template begins with a table or block-level |
— | — | @@ -3507,7 +3507,7 @@ |
3508 | 3508 | $this->addTrackingCategory( 'hidden-category-category' ); |
3509 | 3509 | } |
3510 | 3510 | # (bug 8068) Allow control over whether robots index a page. |
3511 | | - # |
| 3511 | + # |
3512 | 3512 | # FIXME (bug 14899): __INDEX__ always overrides __NOINDEX__ here! This |
3513 | 3513 | # is not desirable, the last one on the page should win. |
3514 | 3514 | if ( isset( $this->mDoubleUnderscores['noindex'] ) && $this->mTitle->canUseNoindex() ) { |
— | — | @@ -3741,7 +3741,7 @@ |
3742 | 3742 | if ( $wgHtml5 && $wgExperimentalHtmlIds ) { |
3743 | 3743 | # For reverse compatibility, provide an id that's |
3744 | 3744 | # HTML4-compatible, like we used to. |
3745 | | - # |
| 3745 | + # |
3746 | 3746 | # It may be worth noting, academically, that it's possible for |
3747 | 3747 | # the legacy anchor to conflict with a non-legacy headline |
3748 | 3748 | # anchor on the page. In this case likely the "correct" thing |
— | — | @@ -4704,13 +4704,13 @@ |
4705 | 4705 | # came to also set the caption, ordinary text after the image -- which |
4706 | 4706 | # makes no sense, because that just repeats the text multiple times in |
4707 | 4707 | # screen readers. It *also* came to set the title attribute. |
4708 | | - # |
| 4708 | + # |
4709 | 4709 | # Now that we have an alt attribute, we should not set the alt text to |
4710 | 4710 | # equal the caption: that's worse than useless, it just repeats the |
4711 | 4711 | # text. This is the framed/thumbnail case. If there's no caption, we |
4712 | 4712 | # use the unnamed parameter for alt text as well, just for the time be- |
4713 | 4713 | # ing, if the unnamed param is set and the alt param is not. |
4714 | | - # |
| 4714 | + # |
4715 | 4715 | # For the future, we need to figure out if we want to tweak this more, |
4716 | 4716 | # e.g., introducing a title= parameter for the title; ignoring the un- |
4717 | 4717 | # named parameter entirely for images without a caption; adding an ex- |
— | — | @@ -4807,8 +4807,8 @@ |
4808 | 4808 | /**#@+ |
4809 | 4809 | * Accessor |
4810 | 4810 | */ |
4811 | | - function getTags() { |
4812 | | - return array_merge( array_keys( $this->mTransparentTagHooks ), array_keys( $this->mTagHooks ) ); |
| 4811 | + function getTags() { |
| 4812 | + return array_merge( array_keys( $this->mTransparentTagHooks ), array_keys( $this->mTagHooks ) ); |
4813 | 4813 | } |
4814 | 4814 | /**#@-*/ |
4815 | 4815 | |
— | — | @@ -4971,7 +4971,7 @@ |
4972 | 4972 | |
4973 | 4973 | # The cryptic '' timezone parameter tells to use the site-default |
4974 | 4974 | # timezone offset instead of the user settings. |
4975 | | - # |
| 4975 | + # |
4976 | 4976 | # Since this value will be saved into the parser cache, served |
4977 | 4977 | # to other users, and potentially even used inside links and such, |
4978 | 4978 | # it needs to be consistent for all visitors. |
— | — | @@ -5018,7 +5018,7 @@ |
5019 | 5019 | if ( $this->mDefaultSort !== false ) { |
5020 | 5020 | return $this->mDefaultSort; |
5021 | 5021 | } elseif ( $this->mTitle->getNamespace() == NS_CATEGORY || |
5022 | | - !$wgCategoryPrefixedDefaultSortkey ) |
| 5022 | + !$wgCategoryPrefixedDefaultSortkey ) |
5023 | 5023 | { |
5024 | 5024 | return $this->mTitle->getText(); |
5025 | 5025 | } else { |
— | — | @@ -5159,8 +5159,8 @@ |
5160 | 5160 | # data in an array. |
5161 | 5161 | $stripState = new StripState; |
5162 | 5162 | $pos = 0; |
5163 | | - while ( ( $start_pos = strpos( $text, $this->mUniqPrefix, $pos ) ) |
5164 | | - && ( $end_pos = strpos( $text, self::MARKER_SUFFIX, $pos ) ) ) |
| 5163 | + while ( ( $start_pos = strpos( $text, $this->mUniqPrefix, $pos ) ) |
| 5164 | + && ( $end_pos = strpos( $text, self::MARKER_SUFFIX, $pos ) ) ) |
5165 | 5165 | { |
5166 | 5166 | $end_pos += strlen( self::MARKER_SUFFIX ); |
5167 | 5167 | $marker = substr( $text, $start_pos, $end_pos-$start_pos ); |