Module talk:Disambiguation
Module:Disambiguation is permanently protected from editing because it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit protected}} to notify an administrator to make the requested edit.
|
Plain DISAMBIG magic word
edit@Evad37: I just had a look over this module's code, and it seems to be missing the case when a user specifies a plain __DISAMBIG__
magic word without using a template. I'm not sure how many disambiguation pages actually do this, but it's probably worth putting it in. Best — Mr. Stradivarius ♪ talk ♪ 04:23, 20 October 2020 (UTC)
- About 7 pages according to this search, most of which already have a disambiguation template. But yeah, probably still worth checking for it. - Evad37 [talk] 23:16, 20 October 2020 (UTC)
- Done - Evad37 [talk] 22:47, 25 October 2020 (UTC)
Not working?
edit{{#invoke:Disambiguation|isDisambiguationPage|Abbas Kola}}
→ yes- Abbas Kola is a dab-page
{{#invoke:Disambiguation|isDisambiguationPage|Kamenitsa}}
→ yes- Kamenitsa is a dab-page
{{#invoke:Disambiguation|isDisambiguationPage|List of schools in Ireland}}
→ yes- List of schools in Ireland is a dab-page
— Martin (MSGJ · talk) 22:37, 21 October 2020 (UTC)
- @Evad37: can any improvement be made here? — Martin (MSGJ · talk) 20:05, 25 October 2020 (UTC)
- Fixed, was missing the {{geodis}} and {{schooldis}} templates - Evad37 [talk] 22:47, 25 October 2020 (UTC)
- Thanks! I'll do a bit more testing, then look to implement this module in the class mask template — Martin (MSGJ · talk) 12:46, 26 October 2020 (UTC)
- Fixed, was missing the {{geodis}} and {{schooldis}} templates - Evad37 [talk] 22:47, 25 October 2020 (UTC)
Found another few:
{{#invoke:Disambiguation|isDisambiguationPage|K7}}
→ yes- K7 is a dab-page
{{#invoke:Disambiguation|isDisambiguationPage|2600}}
→ yes- 2600 is a dab-page
{{#invoke:Disambiguation|isDisambiguationPage|Lost Battalion}}
→ yes- Lost Battalion is a dab-page
— Martin (MSGJ · talk) 18:14, 26 October 2020 (UTC)
I tried to add {{mil-unit-dis}} to the module and failed miserably. Please can someone help with this? — Martin (MSGJ · talk) 12:11, 29 October 2020 (UTC)
- Sandbox:
- 2600 -> yes (numberdis)
- K7 -> yes (Letter-Number Combination Disambiguation)
- Lost Battalion -> yes (mil-unit-dis).
- Something to do with the pattern looking for dashes earlier in the list? --Izno (talk) 15:47, 29 October 2020 (UTC)
- (Maybe. Moving mil-unit-dis doesn't fix it. --Izno (talk) 15:50, 29 October 2020 (UTC))
- The dashes need escaping with %, which I have now done — Martin (MSGJ · talk)
Set index article
editA set index article is not a dab page, but I think it might be useful to be able to detect them, whether with this module or a different one — Martin (MSGJ · talk) 18:13, 26 October 2020 (UTC)
{{#invoke:Disambiguation|isDisambiguationPage|War of independence}}
→- War of independence is a set index article
Tracking
editCategory:Disambiguation pages not detected by Module:Disambiguation lists 0 pages which are tagged with {{WikiProject Disambiguation}} but whose subject pages are not detected as being dab pages by this module. They consist of:
- Articles: perhaps they have been converted from dab pages into articles and {{WikiProject Disambiguation}} was not removed
Redirects- moved to separate category Category:Redirects tagged as disambiguation pages- Set index articles: many of these have been tagged with {{WikiProject Disambiguation}}
- Real dab pages, which are not yet being detected
— Martin (MSGJ · talk) 12:04, 27 October 2020 (UTC)
Methodology
editThere are 32 templates in Category:Disambiguation message boxes. Each one may have several redirects (e.g. Template:Place name disambiguation has 7). That is a lot of possibilities to check for, and there is nothing to stop editors creating a new template (or redirect) at any time. Is there any better approach we could take? — Martin (MSGJ · talk) 12:32, 27 October 2020 (UTC)
- We could have a bot update a list of disambiguation templates, I suppose. — Mr. Stradivarius ♪ talk ♪ 12:01, 29 October 2020 (UTC)
- It might also help if I look to see which redirects are not being used much and take them to RfD. By the way, could you help me with the request above? — Martin (MSGJ · talk) 12:12, 29 October 2020 (UTC)
Templates
edit- Template:Disambiguation 196489
- Template:Dmbox 410202
- Template:Airport disambiguation 487
- Template:Biology disambiguation 31
- Template:Call sign disambiguation 2786
- Template:Caselaw disambiguation 55
- Template:Chinese title disambiguation 128
- Template:Disambiguation cleanup 9
- Template:Disamb-cleanup 0
- Template:Cleanup disambig 0
- Template:CleanupDisambig 0
- Template:Dabclean 0
- Template:Dab-cleanup 0
- Template:Disambig-CU 0
- Template:Disambig-cu 0
- Template:Disambig cleanup 0
- Template:Geodis-cleanup 0
- Template:Disambig-cleanup 0
- Template:Disambiguation-cleanup 0
- Template:Disambcleanup 0
- Template:Disambigcleanup 0
- Template:Diaambig-cleanup 0
- Template:Disambig-cleaup 0
- Template:Disambig-cleanip 0
- Template:Disambig-clenup 0
- Template:Disambiguate-cleanup 0
- Template:Dab cleanup 0
- Template:Cleanup disambiguation 0
- Template:Genus disambiguation 569
- Template:Hospital disambiguation 127
- Template:Human name disambiguation 63031
- Template:Human name disambiguation cleanup 1
- Template:Letter disambiguation 0
- Template:Letter-number combination disambiguation 4688
- Template:Mathematical disambiguation 356
- Template:Military unit disambiguation 1298
- Template:Music disambiguation 4
- Template:Number disambiguation 734
- Template:Phonetics disambiguation 5
- Template:Place name disambiguation 38880
- Template:Portal disambiguation 6
- Template:Road disambiguation 853
- Template:Roaddis 141
- Template:School disambiguation 3144
- Template:Species Latin name abbreviation disambiguation 2148
- Template:Species Latin name disambiguation 148
- Template:Station disambiguation 1506
- Template:Synagogue disambiguation 39
- Template:Taxonomic authority disambiguation 0
- Template:Taxonomy disambiguation 129
- Template:Wikipedia disambiguation 158
Template-protected edit request on 1 October 2021
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please change "[Ll]etter%-Number Combination Disambiguation"
to "[Ll]etter%-[Nn]umber [Cc]ombination [Dd]isambiguation"
, so that articles with {{Letter-number combination disambiguation}} are also correctly identified. rchard2scout (talk) 09:20, 1 October 2021 (UTC)
- Done firefly ( t · c ) 09:29, 1 October 2021 (UTC)
Template-protected edit request on 1 October 2021 (2)
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add the following list of templates:
"[Mm]il-unit-disambig", "[Mm]ilitary unit disambiguation", "[Gg]eo-dis", "[Gg]eodisambig", "[Dd]isambig[Gg]eo", "[Dd]isambig[GN]", "[Dd]isambigNm", "[Dd]isambigName", "[Ss]urname", "[Ss]urnames", "[Ss]pecies Latin name disambiguation", "[Ss]peciesLatinNameDisambig", "[Ll]atinNameDisambig", "[Mm]athematical disambiguation", "[Mm]athematics disambiguation", "[Mm]athdab", "[Mm]ath dab", "[Rr]oad disambiguation", "[Rr]oaddis",
And change "[Gg]eodis"
to "[Gg]eod[ai][bs]"
These were found by sampling pages in Category:Disambiguation pages not detected by Module:Disambiguation, and I think they'll cover the majority of pages that are not a set list.
I'm not very proficient in Lua string patterns, so it might be possible to merge some of the items in this list with smarter regexing (which might or might not impact performance, I have no idea). rchard2scout (talk) 10:28, 1 October 2021 (UTC)
- @Rchard2scout Could we expand all templates (Special:ExpandTemplates – which in Lua seems to be frame:preprocess) and just check for
__DISAMBIG__
in the expanded output? If possible, that would be accurate, though at the cost of performance. – SD0001 (talk) 10:40, 1 October 2021 (UTC)- I think that would be even better. It would certainly be cleaner and less likely to break. I have no idea of the performance cost of that. You could just try it (per WP:PERF) if you think it won't cause any huge problems. --rchard2scout (talk) 10:59, 1 October 2021 (UTC)
- I wouldn't be surprised if this broke some transclusions. When wikitext is preprocessed in a Lua module, that counts towards the total Lua execution time for the page. If this time exceeds 10 seconds, then an error is shown and no more Lua modules are processed. If the page being tested happens to be a huge article that takes several seconds to render, then there is a good chance that the original page being rendered will go over the 10-second limit, particularly if it is using Module:Disambiguation multiple times. — Mr. Stradivarius ♪ talk ♪ 11:54, 22 October 2021 (UTC)
- I think that would be even better. It would certainly be cleaner and less likely to break. I have no idea of the performance cost of that. You could just try it (per WP:PERF) if you think it won't cause any huge problems. --rchard2scout (talk) 10:59, 1 October 2021 (UTC)
I have added those requested above — Martin (MSGJ · talk) 12:02, 25 October 2021 (UTC)
Template-protected edit request on 14 April 2022
editThis edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Can "[Hh]ndab"
and "[Gg]iven name"
be added? Similar templates such as "[Hh][Nn][Dd][Ii][Ss]"
and "[Ss]urname"
are included. Michaelwallace22 (talk) 17:37, 14 April 2022 (UTC)
- Given name and surname list pages are not disambiguation pages. older ≠ wiser 17:42, 14 April 2022 (UTC)
- Not done as there is active discussion disputing this request above. If a consensus is reached please reactivate the edit request. — xaosflux Talk 15:50, 21 April 2022 (UTC)
Error
editThe module seems to identify Category:Disambig-Class biography articles as a disambiguation page (see the class rating on Category talk:Disambig-Class biography articles) probably because of the Disambig in the page title. — Martin (MSGJ · talk) 07:37, 21 April 2023 (UTC)
- No, perhaps I'm wrong. The example below shows only the talk page is incorrectly identified — Martin (MSGJ · talk) 07:40, 21 April 2023 (UTC)
{{#invoke:Disambiguation|isDisambiguationPage|Category:Disambig-Class biography articles}}
→
{{#invoke:Disambiguation|isDisambiguationPage|Category talk:Disambig-Class biography articles}}
→
Resolved The module identifies Category talk:Disambig-Class biography articles as a dab page because it contains the template {{WikiProject Disambiguation}}. This could be fixed, but it's a minor issue — Martin (MSGJ · talk) 07:54, 21 April 2023 (UTC)
Performance issues
editI've been doing some work to cut down on the execution speed of this module after Module:Class mask started using it, since it's been heavily impacting the execution time of Talk:World War II (To the point of occasional timeouts). I've implemented a faster version on the sandbox, and it works as expected, cutting down the execution time from ~8.5s to ~3.5s for the above talk page, and still detects pages as expected, but when I tried using mw.ustring
instead of string
to match how the current version works, it kills the performance. 2 Questions:
- How important is using
mw.ustring
here as opposed tostring
? - Why does
mw.ustring
impact the performance so much?
Thanks. Aidan9382 (talk) 11:30, 27 April 2023 (UTC)
- Thanks, that would be fantastic. There are no unicode characters in the strings being checked, so I would guess that ustring is not required here. On question 2, I suppose there are 150,000 characters to check instead of 128? By the way, I did something on Talk:World War II to improve the situation but if you need it for testing then just revert me — Martin (MSGJ · talk) 11:53, 27 April 2023 (UTC)
- The main reason the performance impact from using mw.ustring confuses me is that testing the current live version of the module with and without mw.ustring doesn't seem to change the performance, but for the /sandbox version it does. Judging from a very quick look, it appears it might be an issue with (g)match in specific, since swapping out ustring.match for ustring.find seems to be significantly faster. I don't think it's worth converting from gmatch to some system that avoids using match just to use ustring, so I'll just use string. Thanks for the advice. Aidan9382 (talk) 12:10, 27 April 2023 (UTC)
- 3.5s is still significant and I feel sure there are more efficient methods we could use instead of analysing the whole text of the page. How about using Module:Is instance to check if the page is an instance of Wikimedia disambiguation page (Q4167410)? — Martin (MSGJ · talk) 12:14, 27 April 2023 (UTC)
- 3.5s isn't exactly accurate - thats the process speed of every module there, not just Module:Disambiguation. A more accurate measure of the change is ~6.6s to ~0.5s
- As for implementing Module:Is instance - that probably will work, but that module in specific has only a template entry point, so I'd have to implement a solution into here or modify that module for a module entry point, and I've not used wikidata functions before, so someone else might be better for doing that. Aidan9382 (talk) 12:33, 27 April 2023 (UTC)
- ~6.6s to ~0.5s sounds even more impressive. I'll let you deploy your version first because that is a clear improvement. Then I might experiment with using wikidata and do some comparison tests later. — Martin (MSGJ · talk) 12:40, 27 April 2023 (UTC)
- 3.5s is still significant and I feel sure there are more efficient methods we could use instead of analysing the whole text of the page. How about using Module:Is instance to check if the page is an instance of Wikimedia disambiguation page (Q4167410)? — Martin (MSGJ · talk) 12:14, 27 April 2023 (UTC)
- (edit conflict) Ustring is not required when checking for
__DISAMBIG__
or(disambiguation)
. It does make a difference when checking for the disambiguation template patterns, however. With the normal string library,%s
will match only ASCII space characters (spaces, newlines, carriage returns, tabs, vertical tabs, and I think form feed characters). With ustring, it will match "all characters with General Category "Separator", plus tab, linefeed, carriage return, vertical tab, and form feed". This includes things like non-breaking spaces, zero-width spaces, etc. These kinds of spaces are counted as whitespace by the Mediawiki parser when parsing template syntax, so ignoring them will potentially lead to this module missing disambiguation templates. For example, it would miss{{ disambiguation }}
- note the full-width spaces. The number of such disambiguation template transclusions is probably going to be very small, however. As for question 2, Scribunto calls back into PHP every time you do an operation with mw.ustring. Lua doesn't handle Unicode natively, and the Scribunto developers chose to work around this by using PHP's Unicode libraries. Each time you switch between Lua and PHP there is some cross-process overhead, and this can add up if you use ustring patterns frequently. — Mr. Stradivarius ♪ talk ♪ 12:23, 27 April 2023 (UTC)- Thanks. This sounds roughly like what I suspected in terms of behaviour differences. Do you know if there's a way to implement ustring here without the issue of major overhead (which is mostly coming from the single gmatch call)? I'm not overly familiar with ustring, so I'm not sure if theres anything special possible there. I don't suspect this to be a major issue (I've never personally ran into a template with abnormal whitespace, and don't imagine they're common either) so I may deploy the string version anyways, but having this fixed would still be nice. Aidan9382 (talk) 12:42, 27 April 2023 (UTC)
- I don't think there is a way to make ustring itself faster. There are some things you could tweak in your algorithm, though. At the moment you are finding the names of all the templates on the page, then checking each name to see if it matches one of the patterns. Instead, you could check each pattern each time you found a new template name. If you find a match, then this would mean you wouldn't have to check any of the other templates on the page.
- Thanks. This sounds roughly like what I suspected in terms of behaviour differences. Do you know if there's a way to implement ustring here without the issue of major overhead (which is mostly coming from the single gmatch call)? I'm not overly familiar with ustring, so I'm not sure if theres anything special possible there. I don't suspect this to be a major issue (I've never personally ran into a template with abnormal whitespace, and don't imagine they're common either) so I may deploy the string version anyways, but having this fixed would still be nice. Aidan9382 (talk) 12:42, 27 April 2023 (UTC)
- The main reason the performance impact from using mw.ustring confuses me is that testing the current live version of the module with and without mw.ustring doesn't seem to change the performance, but for the /sandbox version it does. Judging from a very quick look, it appears it might be an issue with (g)match in specific, since swapping out ustring.match for ustring.find seems to be significantly faster. I don't think it's worth converting from gmatch to some system that avoids using match just to use ustring, so I'll just use string. Thanks for the advice. Aidan9382 (talk) 12:10, 27 April 2023 (UTC)
for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do
for _i, v in ipairs(disambigTemplates) do
if string.match(template, "^"..v.."$") then
return true
end
end
end
- In practice, this probably won't make too much difference, however, as disambiguation templates are usually at the end of the page. If you made a custom gmatch function that searches from the end of the string to the start of the string, then this might result in a speed-up. Having said that, the original gmatch is written in C, and the custom one would be in Lua, so if there are no disambiguation templates on a page, there is a good chance that this will be slower. If you do decide to do more work on performance for this module, you should measure everything to find out what works and what doesn't. — Mr. Stradivarius ♪ talk ♪ 02:15, 29 April 2023 (UTC)
Using Wikidata
editIn the sandbox is a version which will look at instance of (P31) to see if the page is a disambiguation page. It isn't foolproof (as there are a few pages not correctly identified) but it might be an efficient thing to check before analysing the content of the page. — Martin (MSGJ · talk) 15:29, 15 May 2023 (UTC)
- Would be interested to see a comparison of speeds of the sandbox vs live. (Not sure how best to test it.) — Martin (MSGJ · talk) 17:44, 15 May 2023 (UTC)
- How I perform speed tests is to fire a template call a bunch of times (Like this), and to compare the "Lua time usage" stat in show preview on both the live and sandbox version. Using an #invoke: with isDisambiguationPage, the time difference (from live to sandbox) appears to be from 0.09s to 0.25s on a non-disambiguation page (Peter Dulley) and 0.07s to 0.11s for a disambiguation page (Example), though timings are a bit give or take due to how much they fluctuate. I didn't think that the sandbox would be slower, so I wonder where most of the time impact is coming from. Aidan9382 (talk) 18:06, 15 May 2023 (UTC)
- Interesting - so no benefit at all then. — Martin (MSGJ · talk) 21:50, 15 May 2023 (UTC)
- How I perform speed tests is to fire a template call a bunch of times (Like this), and to compare the "Lua time usage" stat in show preview on both the live and sandbox version. Using an #invoke: with isDisambiguationPage, the time difference (from live to sandbox) appears to be from 0.09s to 0.25s on a non-disambiguation page (Peter Dulley) and 0.07s to 0.11s for a disambiguation page (Example), though timings are a bit give or take due to how much they fluctuate. I didn't think that the sandbox would be slower, so I wonder where most of the time impact is coming from. Aidan9382 (talk) 18:06, 15 May 2023 (UTC)
False positives for pattern [%w_%s]-%f[%w][Dd]isam[%w]-
editThe pattern [%w_%s]-%f[%w][Dd]isam[%w]-
matches {{italic disambiguation}}, which is not a disambiguation template. (See the comment about fictional character pages here.) This pattern seems overly broad - can it be made more specific? — Mr. Stradivarius ♪ talk ♪ 02:10, 30 August 2023 (UTC)
- Partly fixed: those characters are now Articles with short description. However, they're also still Pages with short description; is that correct? Certes (talk) 10:33, 30 August 2023 (UTC)
- @Mr. Stradivarius: I made an edit for this to the sandbox: [1] which leaves the regex pattern but adds a false positives list that then gets checked against; will wait for someone who is more familiar with the template/Lua to promote. --PresN 12:35, 30 August 2023 (UTC)
- Thanks. Given Lua's limited implementation of regexp, I think an exception list is the best we can do. Certes (talk) 18:07, 30 August 2023 (UTC)
- Okay, I added some more testcases to the test page to cover this and other use cases, and I felt confident enough to promote. Ping me if there are any issues. --PresN 21:32, 30 August 2023 (UTC)
- Thanks. Given Lua's limited implementation of regexp, I think an exception list is the best we can do. Certes (talk) 18:07, 30 August 2023 (UTC)
- @Mr. Stradivarius: I made an edit for this to the sandbox: [1] which leaves the regex pattern but adds a false positives list that then gets checked against; will wait for someone who is more familiar with the template/Lua to promote. --PresN 12:35, 30 August 2023 (UTC)
This and all patterns match templates even within <--HTML comments-->. That causes pages such as Interstate 10 to be categorised as dabs. (Such pages have commented dab templates to fool Popups into providing certain features which are useful there but normally reserved for dabs.) Is it desirable and possible to ignore templates within comments? Certes (talk) 18:15, 31 August 2023 (UTC)
- In terms of possibility, Module:Wikitext Parsing.PrepareText() exists, which cleans the contents of elements like HTML comments and nowiki tags with mw.text.nowiki, preventing them from being picked up as templates, though it does have a slight performance impact. Aidan9382 (talk) 20:06, 31 August 2023 (UTC)
Surnames
editWhy is "[Ss]urnames?"
in the template list, causing isDisambiguationPage()
to return "yes" for a surname? Surname pages are set index articles, not disambiguation pages. Given name articles do not display this behaviour. ({{Hndis}} is correctly included, because full name lists are dabs, though we should really also add its widely used redirect {{Hndab}}.) Certes (talk) 18:06, 30 August 2023 (UTC)
Pages broken
editPresN every page with a WikiProject template seems to be broken as a result of your change, e.g. Talk:Basil Spence, please revert asap. – Isochrone (T) 21:37, 30 August 2023 (UTC)
Original header: Edit request 30 August 2023
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Description of suggested change:
Revert 1173033352. It seems to be breaking headers on many pages, e.g. Talk:Congregation B'nai Jacob (Woodbridge, Connecticut) (may need to purge cache to see the bug). Dylnuge (Talk • Edits) 21:38, 30 August 2023 (UTC)
- This is fixed (and I was one of three simultaneous reports); no need for further action. Closing Dylnuge (Talk • Edits) 21:42, 30 August 2023 (UTC)
Original header: Error
@PresN, at Talk:Washington and Lee University (and several other talk pages I checked), there is an error coming from this module. Your recent edit appears to be the cause. Please revert (I will shortly if I do not hear from you) until the issue can be identified. {{u|Sdkb}} talk 21:39, 30 August 2023 (UTC)
- Reverted, given several identical reports of the issue. {{u|Sdkb}} talk 21:43, 30 August 2023 (UTC)
- I had them as well on almost every talkpage I looked at. Thank you for reverting. Bobherry Talk My Edits 21:44, 30 August 2023 (UTC)
Well, I said to ping me if there were issues, so I got what I deserved. I've fixed the sandbox page, but I'll let someone else push it this time. --PresN 21:47, 30 August 2023 (UTC)
Error 2
editTalk:Carmel Valley Historical Society is giving me
Lua error in Module:Disambiguation at line 40: assign to undeclared variable 'falsePositives'.
Graywalls (talk) 21:46, 30 August 2023 (UTC)
- It varies depending on the diff. Presently, this version has the error, but not the version after it. Graywalls (talk) 21:52, 30 August 2023 (UTC)
- The pages' caches need to be purged. Just wait a bit or use Special:Purge. – Isochrone (T) 21:57, 30 August 2023 (UTC)
I'm seeing it in Template talk:Vichy France, which is occurring after the last undo of the Module:
Lua error in Module:Disambiguation at line 40: assign to undeclared variable 'falsePositives'
|
---|
Lua error in Module:Disambiguation at line 40: assign to undeclared variable 'falsePositives' [C]: in function "error" strict.lua:21: ? Module:Disambiguation:40: in function "init" package.lua:103: in function "require" Module:Pagetype:18: in function "init" package.lua:103: in function "require" Module:WikiProject_banner/sandbox:109: ? (tail call): ? mw.lua:527: ? [C]: ? |
Thanks, Mathglot (talk) 08:02, 1 September 2023 (UTC)
- Never mind; worked after purge. Mathglot (talk) 08:06, 1 September 2023 (UTC)
Test cases updated
editI've updated Module:Disambiguation/testcases to test all the templates in Category:Disambiguation message boxes (minus Template:Dmbox), and all of their redirects. Looking at Module talk:Disambiguation/testcases, there are currently 42 tests failing due to missing Lua patterns for these templates. Would it be a good idea to detect all of these? — Mr. Stradivarius ♪ talk ♪ 15:24, 9 September 2023 (UTC)
Use list of all disambiguation templates and disambiguation template redirects
editI have switched Module:Disambiguation/sandbox to use Module:Disambiguation/templates, a list of all disambiguation templates and their redirects. The list of disambiguation templates is taken from Category:Disambiguation message boxes, minus Template:Dmbox, the same as I used to populate Module:Disambiguation/testcases. The sandbox version passes all the test cases, and should remove the possibility of false positives like {{italic disambiguation}}. It also performs slightly better than the current version, but not so much as to make an appreciable difference. (To parse the content of Paris, the sandbox version takes an average of 0.0035s, but the current version takes an average of 0.0038s.) In the end there were 122 templates/redirects, which was not too unmanageable. The list will need to be maintained as new templates and redirects are added or deleted, but that is not too different from the situation we have now. Would it be OK to roll this change out to the main module? — Mr. Stradivarius ♪ talk ♪ 11:28, 10 September 2023 (UTC)
- Can we not emit some kind of invisible keyword as metadata which we could then search the content of the page for? I'm thinking there must be an easier way to do this. — Martin (MSGJ · talk) 15:05, 10 September 2023 (UTC)
- @MSGJ: That would work if we could access page HTML from Lua, but unfortunately we can't. Without updating MediaWiki in some way, I think listing all the disambiguation templates and their redirects is the cleanest way of implementing this module. — Mr. Stradivarius ♪ talk ♪ 13:06, 11 September 2023 (UTC)
- We are using some system like that in Module:Banner_shell#L-3 where we emit metadata inside a span tag and then pick that up in the banner shell template. That content is passed via a parameter so I suppose it might be different to what getContent() gives us? — Martin (MSGJ · talk) 13:14, 11 September 2023 (UTC)
- @MSGJ: As you say, that trick works because template/module parameters are preprocessed before being passed to the template or module. With getContent, we only have the raw wikitext to work with. We could, in theory, use frame:preprocess() on the wikitext to expand it all, but this is time-consuming; for long pages I assume this would easily reach the 10-second Lua execution limit. — Mr. Stradivarius ♪ talk ♪ 14:11, 11 September 2023 (UTC)
- Fair enough, carry on then :) I was just brain-storming but assumed you would have thought through other options first. — Martin (MSGJ · talk) 14:34, 11 September 2023 (UTC)
- As you are not around, I have deployed the new version — Martin (MSGJ · talk) 18:39, 19 September 2023 (UTC)
- @MSGJ: As you say, that trick works because template/module parameters are preprocessed before being passed to the template or module. With getContent, we only have the raw wikitext to work with. We could, in theory, use frame:preprocess() on the wikitext to expand it all, but this is time-consuming; for long pages I assume this would easily reach the 10-second Lua execution limit. — Mr. Stradivarius ♪ talk ♪ 14:11, 11 September 2023 (UTC)
- We are using some system like that in Module:Banner_shell#L-3 where we emit metadata inside a span tag and then pick that up in the banner shell template. That content is passed via a parameter so I suppose it might be different to what getContent() gives us? — Martin (MSGJ · talk) 13:14, 11 September 2023 (UTC)
- @MSGJ: That would work if we could access page HTML from Lua, but unfortunately we can't. Without updating MediaWiki in some way, I think listing all the disambiguation templates and their redirects is the cleanest way of implementing this module. — Mr. Stradivarius ♪ talk ♪ 13:06, 11 September 2023 (UTC)
Set index articles detected as disambiguation pages
editFor example Advani says it is a set index article but
{{#invoke:Disambiguation|isDisambiguationPage|Advani}}
says "". Personally I'm not even sure what the difference is supposed to be, and that article looks indistinguishable from a dab page. Is there a useful distinction? — Martin (MSGJ · talk) 18:15, 19 September 2023 (UTC)
- Never mind. Its seems the upgrade described above will solve this! — Martin (MSGJ · talk) 18:20, 19 September 2023 (UTC)
Bot for updating template list
editI have written a bot to update Module:Disambiguation/templates. This should save people the trouble of having to update the template list whenever somebody adds, moves or deletes a new disambiguation template or disambiguation template redirect. I have made the source code available here - please take a look and let me know if you have any feedback. Best — Mr. Stradivarius ♪ talk ♪ 15:33, 26 September 2023 (UTC)
- Great job, thank you. All this work for something so simple. We really need someone to work on T71441 — Martin (MSGJ · talk) 08:49, 27 September 2023 (UTC)
- Now submitted for approval at Wikipedia:Bots/Requests for approval/StradBot. — Mr. Stradivarius ♪ talk ♪ 13:59, 27 September 2023 (UTC)
Request update of template list (9 October 2023)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a disambiguation template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 15:13, 9 October 2023 (UTC)
- I can't analyse this diff because they are all in a different order! — Martin (MSGJ · talk) 15:18, 9 October 2023 (UTC)
- Did a quick check, the only difference is an addition (
Hangul title disambiguation
). This ideally shouldn't be an issue in later versions assuming it maintains the same order it did in this change. Aidan9382 (talk) 15:28, 9 October 2023 (UTC)- On the other hand, alphabetical order is probably more logical and the bot definitely shouldn't be removing the comments at the top explaining the purpose of the module. * Pppery * it has begun... 16:40, 9 October 2023 (UTC)
- Not done @MSGJ, Aidan9382, and Pppery: You are right - the bot should preserve the existing format of the module. I have implemented this, and will have the bot make a new edit request below. I have deactivated this one. — Mr. Stradivarius ♪ talk ♪ 14:20, 10 October 2023 (UTC)
- On the other hand, alphabetical order is probably more logical and the bot definitely shouldn't be removing the comments at the top explaining the purpose of the module. * Pppery * it has begun... 16:40, 9 October 2023 (UTC)
- Did a quick check, the only difference is an addition (
Request update of template list (10 October 2023)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a disambiguation template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 14:21, 10 October 2023 (UTC)
- @MSGJ, Aidan9382, and Pppery: The diff isn't as clean as I would have liked due to the different quotation style, but hopefully this is close enough to the existing format. Let me know what you think. — Mr. Stradivarius ♪ talk ♪ 14:28, 10 October 2023 (UTC)
- Much better thanks, and presumably will be much cleaner next time — Martin (MSGJ · talk) 14:38, 10 October 2023 (UTC)
Category contains 0 pages. They are either pages which contain {{WikiProject Disambiguation}} which shouldn't, or they are are not correctly identified by this module. — Martin (MSGJ · talk) 10:41, 17 October 2023 (UTC)
- The way to deal with this is to look through those pages, judge whether the subject page is a disambiguation page, and if so, add the disambiguation template to Category:Disambiguation message boxes. Then StradBot will add the templates and their redirects to an edit request on its next run. — Mr. Stradivarius ♪ talk ♪ 13:32, 17 October 2023 (UTC)
- Hm, I had a brief look through the category, and the pages in it seem to be almost all set index articles, with an occasional regular article. I didn't spot any actual disambiguation pages. There are lots of given name and chemical compound set index articles, so perhaps they could be tackled first? Also, the category should probably be limited to the Talk namespace, as only pages in article space can be disambiguation pages. — Mr. Stradivarius ♪ talk ♪ 13:49, 17 October 2023 (UTC)
- I've added Template:Hurricane season disambiguation to the category. As you say, most of the rest look like SIAs. — Martin (MSGJ · talk) 15:03, 17 October 2023 (UTC)
- Yes, from a very brief look-see, most of these should not have {{WikiProject Disambiguation}}. Perhaps the tag is artifact left over from changing the page from dab to a set index -- or they were added by mistake. older ≠ wiser 15:50, 17 October 2023 (UTC)
Set index articles
editWould there be any comments about creating a similar module (or adding a function to this one) to detect set index articles? I assume a similar method could be used, with a different set of templates. — Martin (MSGJ · talk) 10:51, 17 October 2023 (UTC)
- Would like to pursue this idea. Rather than having to scan and parse the text of an article twice, would it be possible to write a function which would return "disambig" or "sia" if either of those types of template are found on the page? Would the bot be able to keep a list of sia templates up-to-date in the same way as Module:Disambiguation/templates? — Martin (MSGJ · talk) 22:31, 1 December 2023 (UTC)
Request update of template list (19 October 2023)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a disambiguation template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 19 October 2023 (UTC)
- Done — Martin (MSGJ · talk) 07:06, 19 October 2023 (UTC)
Request update of template list (20 December 2023)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a disambiguation template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 20 December 2023 (UTC)
- Done — Martin (MSGJ · talk) 09:39, 20 December 2023 (UTC)
Request update of Module:Disambiguation/templates (20 February 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 15:38, 20 February 2024 (UTC)
- Note: this edit request is a result of me changing the sorting algorithm governing the order that redirects are displayed in (upper case strings should now be sorted in alphabetical order). There is no difference in the templates used, so this would be a purely cosmetic edit. As such, I am deactivating the edit request. Future bot runs will only create new edit requests if the module sandbox changes, so it is fine to leave the main module as it is. — Mr. Stradivarius ♪ talk ♪ 15:49, 20 February 2024 (UTC)
Request update of Module:Disambiguation/templates (21 March 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:46, 21 March 2024 (UTC)
- Done — Martin (MSGJ · talk) 12:29, 21 March 2024 (UTC)
Request update of Module:Disambiguation/templates (10 August 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 10 August 2024 (UTC)
Request update of Module:Disambiguation/templates (16 August 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 16 August 2024 (UTC)
- Done — Martin (MSGJ · talk) 19:18, 18 August 2024 (UTC)
Request update of Module:Disambiguation/templates (19 August 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 19 August 2024 (UTC)
- Done — Martin (MSGJ · talk) 07:15, 19 August 2024 (UTC)
Request update of Module:Disambiguation/templates (16 September 2024)
editThis edit request to Module:Disambiguation/templates has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Bot comment: StradBot has detected that Module:Disambiguation/templates needs to be updated. This is due to a template being added or removed from Category:Disambiguation message boxes, or to a redirect to one of those templates being added or removed. The bot has saved the new page content in Module:Disambiguation/templates/sandbox (diff). Please review this and update the module if necessary. StradBot (talk) 06:45, 16 September 2024 (UTC)
- Done Elli (talk | contribs) 23:20, 26 September 2024 (UTC)