Mailing List Archive

Starting the sequential numbering of external links at 0
You know how if you put external links as URLs in brackets without any link text, they'll be rendered as [1], [2], etc.? https://www.mediawiki.org/wiki/Help:Links#External_links

How do I start the numbering at [0]? Some programmer types think all numbering systems should start with 0, so it bothers them that it automatically starts with 0. Thanks.
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Re: Starting the sequential numbering of external links at 0 [ In reply to ]
> Some programmer types think all numbering systems should start with 0, so it bothers them that it automatically starts with 0.

Meant to say, it bothers them that it automatically starts with 1.

Anyway, here's what I came up with. Edit clearState() in Parser.php, put:

global $wgOverrideAutonumberOnTitles;
$prefixed = $this->getTitle()->getPrefixedText();
$this->firstCallInit();
$this->resetOutput();
$this->mAutonumber = 0;
if ( isset( $wgOverrideAutonumberOnTitles[$prefixed] ) ) {
$this->mAutonumber = $wgOverrideAutonumberOnTitles[$prefixed];
}

Edit LocalSettings.php, put:

$wgOverrideAutonumberOnTitles = ['ExamplePage' => -1 ];

Then on ExamplePage the numbering will start at 0.
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l