wikimedia-gadgets / twinkle

The English Wikipedia twinkle javascript helper
http://en.wikipedia.org/wiki/Wikipedia:Twinkle
Other
135 stars 148 forks source link

xfd: detect {{userbox}} in wikicode and suggest MFD, even if template #1516

Open NovemLinguae opened 2 years ago

NovemLinguae commented 2 years ago

Requested by Whpq at https://en.wikipedia.org/wiki/Wikipedia_talk:Twinkle#Userbox_was_listed_at_TFD_instead_of_MFD

Current behavior is to only detect userboxes if the page title starts with Template:User. If that is detected, it defaults to MFD (the proper XFD venue for userboxes), and selecting TFD displays a warning.

But there are some userboxes in template namespace that do not begin with Template:User. The best way to detect these is likely to pull the wikicode and search for {{Userbox.

https://github.com/wikimedia-gadgets/twinkle/blob/fc2a36595688b22d47f7f0b652475c0a4007fd5f/modules/twinklexfd.js#L166-L172

https://github.com/wikimedia-gadgets/twinkle/blob/fc2a36595688b22d47f7f0b652475c0a4007fd5f/modules/twinklexfd.js#L244-L250

image

TheTVExpert commented 2 years ago

It might be easier to check for the wikipediauserbox class which comes from the userbox template.

NovemLinguae commented 1 year ago

This came up again today. Catching this early would prevent editors having to re-list at MFD, or editors having their TFDs become confusing and off-topic due to arguments about whether the TFD is valid.

Re-endorsing.

P.S. Today's example ( https://en.wikipedia.org/wiki/Template:Under18 ) does contain the wikipediauserbox class that TheTVExpert mentioned.