Just replace the two instances of MagicWord::get
with $parser->getMagicWordFactory()->get
in NumberedHeadings.class.php
Extension talk:NumberedHeadings
I would like to add the magic word with a template, to shield my users from to much technicalities, any idea why this seems not to work? while e.g. __TOC__
works?
I guess this may happen because the parsing of the magical word __NUMBEREDHEADINGS__ happens when parsing the template, not the article that uses the template. Could you try to add some headings inside the template and see if they come out autonumbered?
If this is the case, it is probably because the parsing is tied to a parser hook onParserBeforeInternalParse()
(see the source code of the extension at https://github.com/staspika/mediawiki-numberedheadings/blob/master/NumberedHeadings.class.php). Would you like to try to find and suggest a better suited hook? :)
I have the same issue with this plugin. There is an older extension I had been using that suffers from the same problem: Extension:MagicNumberedHeadings
In the Discussion on that plugin, the author recommends hooking <code>InternalParseBeforeLinks</code>.
I tried this in the other extension, and it worked.
And now it's fixed in master branch :) See https://github.com/staspika/mediawiki-numberedheadings