Merge "Wrap auto-numbering for section heading in a classed span (bug 33450)"
authorGWicke <gwicke@wikimedia.org>
Sun, 17 Jun 2012 16:39:27 +0000 (16:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 17 Jun 2012 16:39:28 +0000 (16:39 +0000)
1  2 
includes/parser/Parser.php

@@@ -2859,8 -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 );
                        # Don't number the heading if it is the only one (looks silly)
                        if ( count( $matches[3] ) > 1 && $this->mOptions->getNumberHeadings() ) {
                                # the two are different if the line contains a link
-                               $headline = $numbering . ' ' . $headline;
+                               $headline = Html::element( 'span', array( 'class' => 'mw-headline-number' ), $numbering ) . ' ' . $headline;
                        }
  
                        # Create the anchor for linking from the TOC to the section
  
                $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]]"