Page MenuHomePhabricator

Conditional formatting in tables
Open, Needs TriagePublic

Description

The tables in Wikipedia does not allow Conditional Formatting as of now. It would be really helpful if a conditional formatting feature like in MS Excel is introduced for wikitables. This would reduce the requirement of repeating templates like {{party shading/Republican}} and {{party shading/Democratic}} over and over again, vastly reducing the size of the article. It will also reduce the chance of committing mistakes when manually edited, which sometimes do happen due to the vast number of cells which may require editing.
For example, in tables such as the one in https://en.wikipedia.org/wiki/Cook_Partisan_Voting_Index#By_congressional_district we have to use the party shading templates at least 870 times, (the complete article has 81,057 bytes). Much of that bytes, time, and effort put into making the list could simply be saved if we can use conditional formatting. A smaller article will also make it easier to load in places of low internet connectivity.
Similarly, in articles such as https://en.wikipedia.org/wiki/Template:Biden_confirmations we can fix the colors for Yea, Nay, and No Vote beforehand to reduce the chance of committing mistakes and again reducing the size of the article.
Thanks!

Event Timeline

VisualEditor support would be the last step of implementing this – first we'd have to invent a wikitext syntax for it, and implement support for it in the parser. (Probably something similar to the data-sort-type attributes used for table sorting, rather than a completely custom syntax.) I think this would be a big task.

I think some of the potential benefits (reducing the chance of committing mistakes and the size) can instead be achieved today using TemplateStyles. You'd still have to mark each table cell manually, but you could at least centralize the definitions of colors/backgrounds to use.