Merge "(bug 21660) "Pipe trick" full width commas (with test!)"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index fa98dbf..091e495 100644 (file)
@@ -2859,7 +2859,8 @@ class Parser {
                                $value = $pageLang->formatNum( SiteStats::edits() );
                                break;
                        case 'numberofviews':
-                               $value = $pageLang->formatNum( SiteStats::views() );
+                               global $wgDisableCounters;
+                               $value = !$wgDisableCounters ? $pageLang->formatNum( SiteStats::views() ) : '';
                                break;
                        case 'currenttimestamp':
                                $value = wfTimestamp( TS_MW, $ts );
@@ -3390,10 +3391,8 @@ class Parser {
                }
 
                # Replace raw HTML by a placeholder
-               # Add a blank line preceding, to prevent it from mucking up
-               # immediately preceding headings
                if ( $isHTML ) {
-                       $text = "\n\n" . $this->insertStripItem( $text );
+                       $text = $this->insertStripItem( $text );
                } elseif ( $nowiki && ( $this->ot['html'] || $this->ot['pre'] ) ) {
                        # Escape nowiki-style return values
                        $text = wfEscapeWikiText( $text );
@@ -4403,7 +4402,7 @@ class Parser {
 
                $p1 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\))\\|]]/";           # [[ns:page (context)|]]
                $p4 = "/\[\[(:?$nc+:|:|)($tc+?)( ?($tc+))\\|]]/";           # [[ns:page(context)|]]
-               $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\)|)($tc+|)\\|]]/"; # [[ns:page (context), context|]]
+               $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\)|)((?:, |,)$tc+|)\\|]]/"; # [[ns:page (context), context|]]
                $p2 = "/\[\[\\|($tc+)]]/";                                      # [[|page]]
 
                # try $p1 first, to turn "[[A, B (C)|]]" into "[[A, B (C)|A, B]]"