Last modified: 2011-11-21 09:38:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T31302, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29302 - Add a period after Level-1 numbered headings
Add a period after Level-1 numbered headings
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.15.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-07 20:24 UTC by Eric Armstrong
Modified: 2011-11-21 09:38 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Eric Armstrong 2011-06-07 20:24:06 UTC
THE PROBLEM
-----------
In parser.php, this is generated by default:
   <span class="tocnumber">1</span> ...
We want this
   <span class="tocnumber">1.</span> ...

So we don't have headings like these that appear to give a 
content-count that isn't intended:
  1 Overview
  2 Major Enhancements
  3 Significant Changes
  4 Bugs Fixed
  5 Open Issues

We want this instead, especially when using the __NUMBEREDHEADINGS__ 
extension, so the headings don't mislead readers:
  1. Overview
  2. Major Enhancements
  3. Significant Changes
  4. Bugs Fixed
  5. Open Issues

MY PATCH
--------
In includes/parser/parser.php, I replaced replaced lines 3509..3520
(from comment at the top of the section to the end of the for loop),
with these lines:
                # count number of headlines for each level
                @$sublevelCount[$toclevel]++;    
                    # An array of heading numbers, one per level, where everything
                    #   after 1.2 (for example) is "empty": [1, 2, empty, empty, empty]
                $dot = 0;    # No dot before the first number.
                for( $i = 1; $i <= $toclevel; $i++ ) {
                    if( !empty( $sublevelCount[$i] ) ) {
                        // Add a dot before this non-empty sublevel index
                        // (There's no dot after the last one)
                        if( $dot ) {                    
                            $numbering .= '.';
                        }
                        $numbering .= $wgContLang->formatNum( $sublevelCount[$i] );
                        $dot = 1;
                    }
                }
                if ($toclevel == 1) {
                    # We're at a level one head. Add a dot after it.   
                    $numbering .= '.';
                }
                }
Comment 1 Eric Armstrong 2011-06-07 20:25:57 UTC
The final brace in the code segment I pasted is indented one level too far.
Comment 2 Roan Kattouw 2011-06-07 20:52:26 UTC
Please attach a patch file instead of pasting code and replace instructions into a bug comment.
Comment 3 Brion Vibber 2011-07-13 20:10:39 UTC
I'm not so sure we want this change; inclined towards WONTFIX.
Comment 4 Roan Kattouw 2011-11-20 18:25:55 UTC
(In reply to comment #3)
> I'm not so sure we want this change; inclined towards WONTFIX.
Agreed, WONTFIXing.
Comment 5 Sumana Harihareswara 2011-11-21 09:38:35 UTC
Eric, if you'd like to see how to do this for your own personal view of MediaWiki headings or on a wiki you run, come talk to us in #mediawiki on Freenode IRC to talk about doing it, possibly with a user script or gadget in JavaScript.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links