StarCitizenTools / mediawiki-extensions-TabberNeue

A MediaWiki extension that allows wiki to create tabs.
https://www.mediawiki.org/wiki/Extension:TabberNeue
GNU General Public License v3.0
13 stars 15 forks source link

Anchor conflicts after JS rewrite #133

Closed Fyren closed 4 months ago

Fyren commented 4 months ago

The JS rewrite changed the anchors to just use the tab name: https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue/blob/d4fd1d2f6ee486223fc41805fd87604e3340050a/modules/ext.tabberNeue/ext.tabberNeue.js#L480

Before it used to append a count: https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue/blob/9f44a9079d89a6815faa30fab9aafabb8e292972/modules/ext.tabberNeue.legacy/ext.tabberNeue.legacy.js#L137

The old behavior meant it (accidentally?) made the anchor likely to be unique on the page. Now, if a tab name matches another tab name or a section name on a page, links to that anchor might go awry.

alistair3149 commented 4 months ago

Do you have a live demo of the issue? We switch to a more comprehensive method to check for uniqueness, where it'll only increase the count if it has been previously used.

Hmm it might have a conflict with existing ToC header though, I'll probably prepend a prefix to it.

Fyren commented 4 months ago

If a header/section on the page uses the same name as a tab name, it'll happen since it only cares about uniqueness across tab names. So like == foo == and |-|foo=.

alistair3149 commented 4 months ago

Fixed by d150b9e