Jump to content

Template talk:Resolve category redirect

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Tricky cases

[edit]

@BrownHairedGirl: I inserted this in {{Image requested}}, [1] but it is not working as expected to empty Category:Wikipedia requested photographs in Northwest Territories. Please can you help?

So far it is only working on Talk:Back River volcanic complex and four others after null edits on the whole set, plus 5 using WP Canada template, leaving 33 still in the old category.

D'oh! The redirect {{reqphoto}} uses a separate template. All done now.
This "resolve" template is coming in very handy, as noted at CFDWM. – Fayenatic London 10:27, 29 May 2021 (UTC)[reply]

Rcat needed

[edit]

I suggest we need a new Rcat template, like {{R from category navigation}}, for other cases where categories are generated by templates, to notify that the redirect should not be deleted.

"R from autogenerated category"? – Fayenatic London 10:31, 29 May 2021 (UTC)[reply]

Thanks for the ping, @Fayenatic. As usual, I think you are right. There have been several occasions where I used {{R from category navigation}} as the best tag available, even tho that description wasn't strictly true.
It seems to me that a full description of the function of these redirects would be something like "R from a category which has been autogenerated by a category header template which can resolve this category redirect". That's obviously much too verbose for a title, and while I think it might help to include "category header template" in the title, I can't see any way of doing so which is both concise and meaningful.
So I'll go with your proposed title. --BrownHairedGirl (talk) • (contribs) 14:06, 29 May 2021 (UTC)[reply]
@Fayenatic london and BrownHairedGirl: what are some examples?   ~ Tom.Reding (talkdgaf)  12:05, 30 May 2021 (UTC)[reply]
@Tom.Reding: e.g. Category:Establishments in Pondicherry by year. --BrownHairedGirl (talk) • (contribs) 12:26, 30 May 2021 (UTC)[reply]
Category:Wikipedia requested photographs in Northwest Territories, using {{Photo requested}} and {{Image requested}}
Category:Fair use images of movie posters, using {{Non-free poster}}Fayenatic London 07:23, 31 May 2021 (UTC)[reply]
@Fayenatic london and BrownHairedGirl: interesting - I don't know the details why these #Rs have to exist (haven't looked deeper, but might later), but if they and/or others must exist, then {{R from autogenerated category}} or {{R from template-generated category}} seems very appropriate to make.   ~ Tom.Reding (talkdgaf)  11:00, 1 June 2021 (UTC)[reply]
Thanks, Tom. {{R from template-generated category}} is a bit more self-explanatory. The purpose of the Rcat is to avoid deletion of category redirects which appear at first glance to be eligible for deletion as empty, yet are having a necessary effect.
@BrownHairedGirl: do you want to be able to track redirects specifically from category header templates? My examples above are from other types of templates, e.g. file templates/ talk page templates. – Fayenatic London 21:35, 1 June 2021 (UTC)[reply]
@Tom.Reding: these redirects need to exist when a category series changes name. E.g. "Cat:Years in Foo" may include pages "Cat:yyyy in FooBar", before the country's name was changed in 1532 after the Great FooBarian War. So when the cathead templates is used on years before 1532, it will try to parent that cat in "Cat:Years in FooBar". However, it resolves the catredirect from "Cat:Years in FooBar" to "Cat:Years in Foo". That's the type of catredirect to be tagged.
I agree with @Fayenatic that {{R from template-generated category}} is more self-explanatory. No, I don't think we need tie this explicitly to catheads, and if other types of template may use this, we need the more inclusive name. --BrownHairedGirl (talk) • (contribs) 21:56, 1 June 2021 (UTC)[reply]

Resolving redirects with exclamation points in the target's title

[edit]

At Module:Resolve category redirect/sandbox, I made an edit which seems to allow {{resolve category redirect|This category has an exclamation point in the title!}} to be resolved properly. (And before you give me too much credit, all I did was remove ! from the "just return the input" list.)

It seems like the exclamation point was causing issues (see Template:Resolve category redirect#Templates), but allowing the exclamation point seems to be working fine at Template:Resolve category redirect/testcases.

Is there any special reason that ! in the input would cause issues? Maybe something with Lua patterns? If not, are we good to push my sandboxed edit to the live version? I would ping BHG, but she wouldn't be able to respond. Therefore, I will ping Tom.Reding who wrote the code which became this module. HouseBlaster (talk · he/they) 22:40, 6 August 2024 (UTC)[reply]

@HouseBlaster: BHG added that particular exclusion. Looking at edits surrounding that, it looks like this discussion spurred it, but ! was not involved, I don't think, so it might've just been a precaution. So, given the working sandbox testcases, I don't see a problem relaxing the ! restriction, and handling exceptions if/when they come up. I might also try to add resolution of {{Title year}}, etc. in category titles, but later.   ~ Tom.Reding (talkdgaf)  10:42, 7 August 2024 (UTC)[reply]
Awesome. Thank you so much for looking into this :) HouseBlaster (talk · he/they) 12:23, 7 August 2024 (UTC)[reply]

Bug report

[edit]

Looking at the new Category:Wikipedia soft redirected categories which cannot be resolved, it seems like all of the current exceptions are categories which have a valid namespace/interwiki prefix after the category prefix. For instance, Category:Template:IPDB ID different from Wikidata‎ and Category:D:Ream albums‎ (noting that D:Ream albums is a interwiki to Wikidata) are unable to be resolved. Is this something that can be quickly fixed? Or should we just add a note to the documentation that this is a known issue?

It currently affects six categories, so I the problem is not urgent by any stretch of the imagination. (And I don't think those are being resolved anywhere, but it is something that should be documented so people are aware.) Pinging Tom.Reding again, though unless it is a five-second fix it can safely go very low on the to-do list. Best, HouseBlaster (talk · he/they) 02:48, 10 August 2024 (UTC)[reply]

 Fixed & Category:Wikipedia soft redirected categories which cannot be resolved (0) cleared!   ~ Tom.Reding (talkdgaf)  10:12, 10 August 2024 (UTC)[reply]
This fix changed the conditions where {{Resolve category redirect}} would and wouldn't return a category name prefixed with Category:, but I suspect that's already accounted for by mature templates/modules anyway by stripping the prefix regardless, and then replacing it if necessary. I'm monitoring Category:Pages with script errors (516) just in case, which has not blown up.   ~ Tom.Reding (talkdgaf)  10:41, 10 August 2024 (UTC)[reply]
To maintain #Resolving redirects with exclamation points in the target's title, the Category: prefix needed to be pre-stripped anyway before being passed to mw.title.makeTitle(). In terms of consistency, this gives an additional benefit: Category: is never returned.   ~ Tom.Reding (talkdgaf)  11:07, 10 August 2024 (UTC)[reply]
Amazing. Thank you so much :) HouseBlaster (talk · he/they) 11:24, 10 August 2024 (UTC)[reply]
Update: I have moved that category to Category:Wikipedia soft redirected categories which are not resolved correctly, because {{category redirect}} now populates that error category when {{resolve category redirect}} returns any incorrect result, whether because it cannot resolve the target or it is resolved but incorrectly. (This has caught messes like Special:Permalink/503449123.) HouseBlaster (talk • he/they) 18:15, 26 August 2024 (UTC)[reply]

Return 'Category:'-prefixed cat on error

[edit]

Now that the 'Category:' prefix is always stripped from the output, due to #Bug report, there is the option of reinstating 'Category:' whenever the original cat is returned due to an error. I think this is superior to having a true/false flag as a 2nd output parameter, since it is minimally invasive, and there would be no discernible effect on the current ~900k transclusions, but it would still allow calling templates/modules to use the returned value in a more nuanced way if desired (if I were starting from scratch, a true/false flag would be better, but only slightly, and definitely not worth the bother of updating all transclusions now). Leaving this here so myself & others can plan/code accordingly.   ~ Tom.Reding (talkdgaf)  14:27, 26 August 2024 (UTC)[reply]

Looks like this isn't necessary, since all of the existing checks assume that Category: is never returned.   ~ Tom.Reding (talkdgaf)  16:03, 28 August 2024 (UTC)[reply]

New(?) bug report

[edit]

Category:Wikipedia soft redirected categories which are not resolved correctly (0) now contains all cases where {{resolve category redirect}} does not return the expected result (it previously was only looking to see that {{resolve category redirect}} did not return its input). This is revealing that extra text on the category redirect page breaks this template: For instance, Category:Oil (which has a see also link to Category:Oils in addition to its redirect target, Category:Petroleum) {{resolve category redirect|Oil}} gives Petroleum and {{resolve category redirect|Television stations in Mauritius}} gives Television channels in Mauritius. Would you be able to investigate, Tom.Reding? Best, HouseBlaster (talk • he/they) 02:24, 28 August 2024 (UTC)[reply]

 Fixed in the sandbox, see testcases.
More importantly, I've enabled #Return 'Category:'-prefixed cat on error in the sandbox. Does that interfere with {{Category redirect}} at all?   ~ Tom.Reding (talkdgaf)  13:25, 28 August 2024 (UTC)[reply]
Thank you! It will not break {{category redirect}}, but it will break {{category if exists}}, which saves on some computation by taking advantage of the fact that the category prefix is never returned. HouseBlaster (talk • he/they) 14:55, 28 August 2024 (UTC)[reply]
Looking at the {{Category redirect}} & {{Category redirect/core}} code, since {{PAGENAME}} is used in
|target={{#ifeq:{{NAMESPACE:{{{1}}} }}|Category|{{PAGENAME:{{{1}}} }}|{{{1}}} }} &
{{#ifeq:{{resolve category redirect|{{PAGENAME}}}}|{{{target}}},
then the additional Category: would interfere, causing "Category:Oil" to compare with "Oil", for example, and deduce that the #R resolved correctly when it didn't. I made a small change to Template:Category redirect/core/sandbox to correct this, but I guess #Return 'Category:'-prefixed cat on error isn't really needed after all(!), so I'll revert it.   ~ Tom.Reding (talkdgaf)  15:48, 28 August 2024 (UTC)[reply]
PAGENAME is only called in |target= when the input is in the category namespace. The intention behind this is to normalize the input, so {{category redirect|Category:Writers}} and {{category redirect|Writers}} both call the /core with the same |target=Writers. Calling PAGENAME again in the /core causes issues with redirect targets like Category:Template:IPDB ID different from Wikidata, where we would compare IPDB ID different from Wikidata to Template:IPDB ID different from Wikidata. (Or at least, that is what I was trying to do with that code!) HouseBlaster (talk • he/they) 16:09, 28 August 2024 (UTC)[reply]
Ah, yes, best leave that alone then.   ~ Tom.Reding (talkdgaf)  16:13, 28 August 2024 (UTC)[reply]

Category:Wikipedia soft redirected categories which are not resolved correctly (0) down from ~202 to 7! But of those 7, 3 of them don't make sense to me why they're still in that category:

  1. Gabros International players
  2. Populated places in West Kurdufan
  3. Torneo Descentralizado footballers

What they all have in common are Category: in {{{1}}}: {{Category redirect|Category:Peruvian Primera División players‎}}. If it's removed, then they are no longer categorized, but shouldn't that be ignored by {{category redirect}}?   ~ Tom.Reding (talkdgaf)  17:07, 28 August 2024 (UTC)[reply]

Not sure why this would cause an error, but they all had the invisible Unicode character U+200E (which is the left-to-right mark) at the end of the category name. Try copying the entire source code of Special:Permalink/976250975 into this tool and you will see the hidden character. If you copy category names from within parent categories, you copy U+200E a lot (for example, if you copy and paste Wikipedia category-redirect box parameter needs fixing‎ (1 C) from Category:Wikipedia soft redirected categories there is a U+200E between the word fixing and the open parenthesis). I think having these throw an error is a good thing because invisible characters make life much more confusing for future editors. I have corrected the uses. HouseBlaster (talk • he/they) 18:15, 28 August 2024 (UTC)[reply]