Last modified: 2010-05-15 15:38:21 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 T5254, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3254 - Request: Per page setting for numbering headers
Request: Per page setting for numbering headers
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.5.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
: 3256 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-24 14:00 UTC by Hans Voss
Modified: 2010-05-15 15:38 UTC (History)
1 user (show)

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


Attachments

Description Hans Voss 2005-08-24 14:00:43 UTC
I use a Wiki (MW1.5rc1) to store knowledge and as a documentation tool.
I like for some pages to show (automatic) heading/section numbering and (most)
other pages to not show heading numbers. So just setting the
UserPreferences.Misc->Auto-number headings to on is not a real good option.

Would it be possible to include some 'directive/pragma' onto the page (like
__NOTOC__ etc) that would turn-on autonumber for just this page (if possible
with an offset maybe?).
Something like:
__HEADINGNUMBERS__  for entire page
or
{{HEADINGNUMBER}} and {{HEADINGNUMBER|from=5}} for individual headers.

Thanks.
Hans Voss
hans.voss@gmail.com
skype: hans.voss
Comment 1 Antoine "hashar" Musso (WMF) 2005-08-24 14:09:11 UTC
*** Bug 3256 has been marked as a duplicate of this bug. ***
Comment 2 Hans Voss 2005-10-25 18:51:08 UTC
If have created a patch for this to the MW 1.5.0 code myself. Modificatons to
three source (.php) files are required
===========================
includes/Parser.php
===========================
In Parser.php, on line 2456 in the function formatHeadings, just below the line
that says:

$doNumberHeadings = $this->mOptions->getNumberHeadings();

add the following code:

		if (! $doNumberHeadings )
		{
			$doNumberHeadingsObj =& MagicWord::get( MAG_NUMBERHEADINGS );
			if ($doNumberHeadingsObj->matchAndRemove ( $text ) )
			{
				$doNumberHeadings = 1;
			}
		}


===========================
includes/MagicWord.php
===========================
In the list of defines for the keywords, as the last define (below line 57) add
the following code:

define('MAG_NUMBERHEADINGS',            44);

The number 44 is the next in the sequence. If the MediaWiki coders decide to
implement a new MagicWord this number could become invalid and needs to be updated.

===========================
languages/Language.php
===========================
In Language.php the actual keyword needs to be defined. In the list of magic
words definitions (search for __TOC__ to find it. Just below line 196 or there
abouts add the following code:

	MAG_NUMBERHEADINGS       => array( 0,    '__NUMBERHEADINGS__'     ),
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-07-05 20:50:13 UTC

*** This bug has been marked as a duplicate of bug 7832 ***
Comment 4 Purodha Blissenbach 2007-09-06 18:34:27 UTC
There is a MediaWiki Extension now at:

http://www.mediawiki.org/wiki/Extension:MagicNumberedHeadings

supplying __NUMBEREDHEADINGS__ (note the difference!)
doing what is aked for in this bug.

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


Navigation
Links