Last modified: 2010-05-15 15:38:21 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
*** Bug 3256 has been marked as a duplicate of this bug. ***
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__' ),
*** This bug has been marked as a duplicate of bug 7832 ***
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.