MediaWiki talk:Gadget-HotCat.js/local defaults
Protected edit request on 31 January 2015
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Could someone please update the code to exclude the Draft and Draft talk namespaces, per the discussion at Wikipedia talk:HotCat#Disable HotCat in Draft namespace? Thanks! GoingBatty (talk) 15:41, 31 January 2015 (UTC)
- Not done: please establish a consensus for this alteration before using the
{{edit protected}}
template. GoingBatty, I'm closing this request temporarily pending more discussion on the linked page where I have opposed the change. I'll be more than happy to reinstate the request if there is consensus after my concern has been addressed. —{{U|Technical 13}} (e • t • c)
16:06, 31 January 2015 (UTC)
Interface-protected edit request on 14 May 2020
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
When categorizing a userbox template, gadget HotCat incorrectly removes {{nocat|}} from {{{nocat|}}}, confusing a transclusion of template {{nocat}} with usage of a named parameter {{{nocat|}}}, which leaves |nocat={}
in transclusion of {{userbox}}. Examples: Special:Diff/900767578, Special:Diff/956639287. To fix this, please change line 3 from:
HotCat.uncat_regexp = /\{\{\s*([Uu]ncat(egori[sz]ed)?|[Nn]ocat|[Nn]eedscategory|[Cc]ategori[sz]e)[^}]*\}\}/g ;
to
HotCat.uncat_regexp = /(?=[^{]|^)\{\{\s*([Uu]ncat(egori[sz]ed)?|[Nn]ocat|[Nn]eedscategory|[Cc]ategori[sz]e)[^}]*\}\}/g ;
which will disallow removing {{nocat}}
from {{{nocat|}}}
. This was reported at Village pump and Wikipedia talk:HotCat. I've tested the regular expression at regex101.com. —andrybak (talk) 16:13, 14 May 2020 (UTC)
- Andrybak, the regex doesn't work when there are spaces or other characters preceding the template. A proper regex would require negative look-behinds but that isn't available on ES5 javascript and I couldn't hack together one that works with spaces. Galobtter (pingó mió) 05:53, 15 May 2020 (UTC)
- Galobtter, what if we removed the space with the template transclusion? It's unlikely to be useful after removing the template transclusion. And it's almost never happens in practice:
- The regex would be:
HotCat.uncat_regexp = /((?=[^{]|^)| )\{\{\s*([Uu]ncat(egori[sz]ed)?|[Nn]ocat|[Nn]eedscategory|[Cc]ategori[sz]e)[^}]*\}\}/g ;
- Regex test. While checking searches, I've noticed that Template:Needscategory doesn't exist and isn't used. It could probably safely removed from the regex. —andrybak (talk) 08:58, 15 May 2020 (UTC)
- Done Reasonable. Galobtter (pingó mió) 04:49, 16 May 2020 (UTC)
- Galobtter, I did some test edits, and this change seems to break removal of these tags: Special:Diff/956979593. I've also switched the test to ECMAScript: https://regex101.com/r/8hX6lT/5 (menu "Flavor" on the left), but it seems to work fine there. I might be doing something incorrectly. —andrybak (talk) 10:58, 16 May 2020 (UTC)
- Andrybak, I think I fixed it Galobtter (pingó mió) 18:24, 16 May 2020 (UTC)
- Galobtter, thanks. Looks good now: Special:Diff/957046108, Special:Diff/957046191. —andrybak (talk) 18:27, 16 May 2020 (UTC)
- Andrybak, I think I fixed it Galobtter (pingó mió) 18:24, 16 May 2020 (UTC)
- Galobtter, I did some test edits, and this change seems to break removal of these tags: Special:Diff/956979593. I've also switched the test to ECMAScript: https://regex101.com/r/8hX6lT/5 (menu "Flavor" on the left), but it seems to work fine there. I might be doing something incorrectly. —andrybak (talk) 10:58, 16 May 2020 (UTC)