(Translated by https://www.hiragana.jp/)
⚓ T187808 Complete switch of toc styling from id #toc to class .toc
Page MenuHomePhabricator

Complete switch of toc styling from id #toc to class .toc
Closed, ResolvedPublic

Description

The TOC styling statements have been doubled up as #toc, .toc statements since 2005 (I checked, the parser has been emitting both since 2005 as well).

Time to get rid of this duplication

Event Timeline

Change 412953 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/core@master] Remove #toc style definitions

https://gerrit.wikimedia.org/r/412953

According to mwgrep #toc is only used on 479 site css/js files :)

@Fomafix 5:11 PM
Patch Set 1:
There are still several usages of id="toc" in the wiki content. Example search on dewiki: https://de.wikipedia.org/w/index.php?title=Spezial:Suche&profile=all&search=insource%3A%2Fid%3D"toc"%2F&fulltext=1

@Esanders 5:19 PM
Patch Set 1:
A lot of those are on historical pages, but we might need a deprecation warning so any current templates can be fixed...

For example, on de.wiki there was only one active template using id=toc, which I've now fixed: https://de.wikipedia.org/wiki/Vorlage:Basketball_Positionen

Quite a few have id=toc AND class=toc, but yes, quite a few. Seems doable with an AWB run though.

I've looked into this a little bit, but almost all of these cases still use tables (which the proper toc does no longer), or they have layouts that can be provided by maintained ToC templates, or they should be using wikitable class or completely different structures.

I think therefore that sending in a bot is not really needed, and we should point people at how to fix the problems. Also, when the styling is lost, the page isn't off significantly worse than before in most cases, see screenshot.

Screen Shot 2018-02-21 at 11.34.54.png (278×1 px, 48 KB)

Screen Shot 2018-02-21 at 11.35.23.png (276×1 px, 48 KB)

TheDJ triaged this task as Lowest priority.

When and if this gets merged we should probably mention it to the communities:
"The deprecated #toc and #toctitle ids have been removed. If your wiki was still using these for fake Tables of Content (TOC) then these might lose their styling. They can be replaced with .toc and .toctitle classes where appropriate"

Change 412953 merged by jenkins-bot:
[mediawiki/core@master] Remove #toc and #toctitle style definitions

https://gerrit.wikimedia.org/r/412953

According to mwgrep #toc is only used on 479 site css/js files :)

Note that using #toc to target the node from JavaScript is not problematic. We still declare both, and I don't see why we'd want to change that. Those can still be consumed by JS and by url fragments without issue.

The clean up is mainly about consuming both where one suffices. E.g. in selectors that generically target any TOC. For which the class suffices.

Change 420226 had a related patch set uploaded (by Krinkle; owner: VolkerE):
[mediawiki/skins/Vector@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420226

Change 420266 had a related patch set uploaded (by Krinkle; owner: VolkerE):
[mediawiki/skins/MinervaNeue@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420266

Change 420269 had a related patch set uploaded (by Krinkle; owner: VolkerE):
[mediawiki/extensions/WikidataPageBanner@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420269

Change 420266 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420266

IIUC this has now been merged, and will arrive next week. I've added an entry to next Monday's Tech/News.

When and if this gets merged we should probably mention it to the communities:
"The deprecated #toc and #toctitle ids have been removed. If your wiki was still using these for fake Tables of Content (TOC) then these might lose their styling. They can be replaced with .toc and .toctitle classes where appropriate"

Thank you for providing wording!

Change 420269 merged by jenkins-bot:
[mediawiki/extensions/WikidataPageBanner@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420269

Change 420226 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Replace #toc selector by .toc

https://gerrit.wikimedia.org/r/420226

TheDJ removed a project: Patch-For-Review.

calling this closed.