This module is within the scope ofWikiProject Templates, a group dedicated to improving the maintenance of Wikipedia'stemplates. If you would like to participate, please visit the project page, where you can join thediscussion and see a list of open tasks.TemplatesWikipedia:WikiProject TemplatesTemplate:WikiProject TemplatesTemplates
Done. Also addedrequire ('strict') which will catch other globals. Keep an eye onCategory:Pages with script errors to see if the addition reveals other globals.
What is it that I'm missing? If the problem is caused by something that happens inModule:WikiProject banner, that is where the fix should be applied. Adding miscellaneous one-off patches to this module is not a good idea. When you switch to the default category, you know that the preferred category does not exist so why link to it? Link to the preferred category only when it exists.
I haven't taken any real time to study the code (it has taken me more time to write this than I spent looking at the code) butModule:Check for unknown parameters line 113 appears to return a concatenated string of unknown parameters (apparently without delimiters). If there are no unknowns then thetable.concat(res) returns an empty string. So, it looks likep._check(args,pargs) returns:
nil when either ofargs andpargs is not a table
empty string when there are no unknown parameters
some sort of list of unknown parameters
If this is true then you should be checking the returned value fromrequire('Module:Check for unknown parameters')._check(parameters,parent_args) before you fiddle about with categories.
Yes that works. Unfortunately it means that I need to call the module twice: the second time after deciding which category to use. But this will only happen if there are any unknown parameters so will not affect performance unduly. — Martin(MSGJ · talk)09:06, 5 September 2024 (UTC)[reply]
Add comments to your code. When you are crushed by a steamroller while jaywalking Main Street, whoever comes after you to maintain that module can then know why you did what you did.