Module talk:pages
Add topicAppearance
Latest comment: 1 month ago by Benwing2 in topic Testcase documentation pages
Testcase documentation pages
[edit]@Benwing2 I noticed that you changed get_pagetype()
so that module testcase documentation pages return "module testcase page" instead of "module documentation page". What was the reason for the change? I ask because it now means that Module:documentation now can't distinguish them from actual testcase pages anymore, which is not ideal. It's possible to get around this by checking the pagename for "/documentation"
or whatever, but the whole point of get_pagetype()
is so that you never need to worry about things like that. Theknightwho (talk) 21:37, 10 December 2024 (UTC)
- @Theknightwho This was done so that they get excluded from CAT:E, as there were several broken testcase pages sitting for weeks in that category. When does Module:documentation need to distinguish the two? If it does, maybe get_pagetype() should return "module testcase documentation page" or something. Benwing2 (talk) 23:39, 10 December 2024 (UTC)
- @Benwing2 Thanks - I'd worked it out shortly before you commented. I noticed that there were issues with sandbox documentation pages as well (not that they matter much), so I've amended
get_pagetype()
so that a template/module page can (theoretically) contain all three (a maximal example might be a "module sandbox testcase documentation page"). I've also addedis_documentation()
,is_sandbox()
andis_testcase_page()
as simple boolean functions, which will probably be more useful than grabbing the raw page type most of the time. By default,is_sandbox()
andis_testcase_page()
will returnfalse
for documentation pages (e.g. a "module testcase documentation page"), but they haveinclude_documentation
flags that override this. This is because documentation pages needed to be treated differently most of the time, but there are situations like hidden categories when it's useful to include them. Theknightwho (talk) 00:42, 11 December 2024 (UTC)- @Benwing2 I've expanded these to take account of various other page types, like JavaScript, CSS and JSON, since they can all have documentation pages and could (at least in theory) have testcases and sandboxes. I've also changed the logic for documentation pages, so that if the page is a wikitext page that has a title ending in "/documentation", it will determine the page type of the associated non-documentation page first, since that could change depending on its content model.
- Given how complex this has become, and the fact that most uses of
get_pagetype()
are to check if the page is of a certain type, I think it makes sense to split out the type checking aspect into another function (probablyhas_pagetype()
). Returning a string of space-separated types, like it does now, is not ideal. Theknightwho (talk) 15:07, 11 December 2024 (UTC)- I agree. Benwing2 (talk) 21:26, 11 December 2024 (UTC)
- @Benwing2 Thanks - I'd worked it out shortly before you commented. I noticed that there were issues with sandbox documentation pages as well (not that they matter much), so I've amended