[Mediawiki-l] Numbered Headings

trueskew trueskew at gmail.com
Thu Apr 21 20:34:13 UTC 2011


The problem is that when the ParserAfterStrip() hook gets called, only the
text of the page is available, the template hasn't been expanded yet. Only
one hook is available (at least in MW 1.16) that allows a change to the
header option before it's too late after all templates have been processed,
and that's InternalParseBeforeLinks(). To get MagicNumberedHeadings to work,
edit MagicNumberedHeadings.php and make these changes:

... around line 52
- $wgHooks['ParserBeforeInternalParse'][] =
'MagicNumberedHeadingsParserBeforeInternalParse';
+ $wgHooks['InternalParseBeforeLinks'][] =
'MagicNumberedHeadingsInternalParseBeforeLinks';

... around line 90
- function MagicNumberedHeadingsParserBeforeInternalParse($parser, $text,
$stripState)
+ function MagicNumberedHeadingsInternalParseBeforeLinks($parser, $text,
$stripState)

This applies to a few other extensions I happened across while learning this
stuff, so if you're searching for "why doesn't it work in a template"
problems, take a look here too. 

> -----Original Message-----
> From: trueskew [mailto:trueskew at gmail.com] 
> Sent: Thursday, April 21, 2011 9:31 AM
> To: 'MediaWiki announcements and site admin list'
> Subject: RE: [Mediawiki-l] Numbered Headings
> 
> Actually I take that back a little bit.  I was hoping to let 
> my users check a box to include numbering in their articles, 
> but the magic word doesn't work in a template.  Someone 
> pointed that out on the discussion page in 2008, but I guess 
> no one cared enough to fix it.  If one of you pros can see 
> that the hooks it's using would allow it to work in 
> templates, it would be a great fix.  In the mean time, I'm 
> trying to figure it out and if I get it I'll post the 
> solution (here and on the discussion page).
> 
> Thanks.
> - skew
> 
> > -----Original Message-----
> > From: trueskew [mailto:trueskew at gmail.com]
> > Sent: Thursday, April 21, 2011 8:19 AM
> > To: 'MediaWiki announcements and site admin list'
> > Subject: RE: [Mediawiki-l] Numbered Headings
> > 
> > Now it's good day.  Thanks Dan, that worked great.
> > 
> > > -----Original Message-----
> > > From: mediawiki-l-bounces at lists.wikimedia.org
> > > [mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf
> > Of Daniel
> > > Barrett
> > > Sent: Thursday, April 21, 2011 8:11 AM
> > > To: MediaWiki announcements and site admin list
> > > Subject: Re: [Mediawiki-l] Numbered Headings
> > > 
> > > http://www.mediawiki.org/wiki/Extension:MagicNumberedHeadings
> > > 
> > > 
> > > DanB
> > > 
> > > _______________________________________________
> > > MediaWiki-l mailing list
> > > MediaWiki-l at lists.wikimedia.org
> > > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l




More information about the MediaWiki-l mailing list