New to bots on Wikipedia? Read these primers!
Operator: William Avery ( talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 18:08, Friday, September 2, 2022 ( UTC)
Function overview: A template, {{ plain row headers}}, will be placed immediately before every table that currently uses "plain row headers" styling. The name of the CSS class used to achieve the plain row headers styling will be changed from "plainrowheaders" to "plain-row-headers". If a table has the "plainrowheaders" CSS class, but contains no row headers to be thus styled, the "plainrowheaders" CSS class will be removed from the table.
For background to this, and the motivation, see Wikipedia:TemplateStyles.
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python
Source code available: pywikibot script plainrowheaders.py
Links to relevant discussions (where appropriate):
For background see:
Edit period(s): Total edit time will be in the region of 9 days(~ 125,000 articles ÷ 600 edits per minute ÷ 24 hours a day), but will occur over a longer period than that. My plan is to concentrate on individual, heavily affected, subject areas in turn. Music, films, TV, theatre, sports, lists of historic buildings and species are areas where much data is tabulated in articles. I intend to do trials in each area before running batches of ~10,000 articles. This should also help shorten any period of watchlist disruption for individual editors down to a day or two.
After the initial processing, there will need to be further runs on a smaller scale, as editors will still be using the current construct, and pages may have been deep reverted for reasons unrelated to this processing.
Estimated number of pages affected: 125,000 per this search. Obviously there are very few pages with the {{ plain row headers}} template in place as yet.
Namespace(s): Mainspace/Articles
Exclusion compliant: Yes, per pywikibot
Function details:
Each table in the page is processed. This only applies to tables started with {|
, not templates that output tables.
If the class attribute of the table contains the class name "plainrowheaders", that classname is replaced with "plain-row-headers".
If the table's class attribute now contains "plain-row-headers", several successive steps are taken to discover whether the table in fact makes use of the class, and therefore requires the {{ plain row headers}} template.
!scope=row{{Some template|
may also be present. mwparserfromhell doesn't see the attribute because there is no following pipe. A regular expression can detect these, and output a warning with the name of the template. (Usually the template should be being invoked with a parameter such as "rowheader=true", rather than used in such a fashion.)Each table using plain row header styling should be preceded by its own {{ plain row headers}}, so the processing keeps track of whether such a template has been encountered since the last table. It assumes hat any such template is the one that belongs to the current table.
If no table header cells with scope=row were found or the "wikitable" class name is not among the table's classes, the "plain-row-headers" class is not producing any effect, and is removed from the table. Otherwise, if none is present, the styling template {{ plain row headers}} is inserted before the table.
Care has been taken to ensure that if the processing is run for a second time on a page that has already been processed, it makes no changes.
To simplify checking, no standard fixes or cosmetic code changes are included.
Test edits have been carried out in the bot's userspace. e.g. here and here.
Division of work into batches
I use my own extension of the pywikibot.pagegenerators module, which can generate lists of pages to be processed from a custom database table, in this case prh_batch. I can populate this table using prh_batch.py. The search needs to be divided into slices because there is a limit of 10,000 on results. Once the list of pages is in the database table I can run queries against the enwiki_p database replica to assign them to Wikiprojects.
Given the documented caveat that the ability to affect page content outside the template should not be relied on, [1] I do not think this task should proceed. — JJMC89 ( T· C) 01:19, 3 September 2022 (UTC) reply
The wider community was notified and nothing of interest was discussed. In other discussion from the content transform team members, the HTML emitted does not make this an issue.to the documentation of the template. Absolute crickets on the task of interest ( phab:T176272) where I made clear what I intended. When I reviewed the background of why that caveat is there, it was more of a "wait and see" than the wording implies on that template. See the revision after the one you linked to (why did you add it as a permalink excluding that revision?) which points to phab:T155813#3037085 and related discussion.
Against, You can realize your idea simple and fast with CSS formula (as global.css for this local wikipedia or in the software WikiMedia):
thscope="row" {
font-weight: normal;
}
✍️ Dušan Kreheľ ( talk) 10:47, 28 September 2022 (UTC) reply
{{ BAG assistance needed}} User:Izno, who requested this task, has expressed a concern on the noticeboard at the length of time that this request has gone without attention from a BAG member, and a willingness to provide any further input required here. I am therefore requesting BAG assistance. William Avery ( talk) 18:17, 24 October 2022 (UTC) reply
References
Styles included by a template can currently affect content on the page outside of the content generated by that template, but this ability may be removed in the future and should not be relied upon.
Needs wider discussion. Per WP:BOTREQUIRE#4, please show broader consensus to perform this task and perform this task by bot at large scale. I do not see any immediate discussion that involves uninvolved editors expressing support or opposition to this task. I see a lot of technical details, work steps, todo lists, and work progress notifications, etc. concentrated on technical pages. Being (as far as I know) the first time a bot is "implementing" TemplateStyles this way places this BRFA as a precedent and puts an even larger onus on BAG to establish a clear consensus for the task. I see general support for enabling and careful use of TemplateStyles as a whole. I see general support for making a guideline. Since then it has been expanded to discuss a case like this with tables, although I don't see any direct discussion. It has also been expanded to include even more workflow for conversion, which is again a "how to" rather than "should". So, as far as I can locate previous discussions I can link to and understand the intent here, this task takes it several steps further from previous explicit consensus - it (1) styles outside its template (i.e. not "only style the associated template's output"), (2) styles tables (i.e. not "a specific template or group of templates"), (3) does this on a case-by-case basis (i.e. only tables that are manually and specifically classes "plainrowheaders") and (4) automates the process (i.e. currently, only this BRFA itself, which besides the proposer and implementer has 2 editors opposing based on arguments with sufficient merit to consider). I'm sure I'm grossly oversimplifying, but that's kind of the point - consensus should be clear and I shouldn't need to dig this deep to understand if the task is appropriate during WP:BOTAPPROVAL. — HELLKNOWZ ∣ TALK 19:38, 24 October 2022 (UTC) reply
<table>s
then
MediaWiki:Common.css would be the correct home for it (which is where the relevant CSS lives today, and in
MediaWiki:Mobile.css, but I think that is an artifact of when plainrowheaders was added vice when TemplateStyles was added and not any other reason). Regarding item 4 in that list, it is infeasible to do the change relevant to this BRFA any other way (well, I could do it in AWB but it would take a while and be more likely to cause errors). Regarding 2 editors opposing based on arguments with sufficient merit to consider, the latter editor's comment has 0 relevance in that it's basically like "you can put it in Common.css"... which is where it is today and which is sufficiently answered by MediaWiki talk:Common.css/to do#description.
@ William Avery: Marking this {{ BotOnHold}}, as it's been 7 months since you've posted here. GoingBatty ( talk) 03:25, 28 May 2023 (UTC) Request Expired. Nine months since the operator has edited Wikipedia. No prejudice against re-opening if/when they return. Primefac ( talk) 10:05, 28 June 2023 (UTC) reply