Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module talk:Check for unknown parameters

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Module:Check for unknown parameters ispermanentlyprotected from editing because it is aheavily 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 byconsensus, editors may use {{edit protected}} to notify an administrator to make the requested edit.

This module was considered formerging on2019 December 30. The result of thediscussion was "no consensus".
This is thetalk page for discussing improvements to theCheck for unknown parameters module.
Archives:1Auto-archiving period:3 months 
This module does not require a rating on Wikipedia'scontent assessment scale.
It is of interest to the followingWikiProjects:
WikiProject iconTemplates
WikiProject iconThis 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

Protected edit request on 29 August 2024

[edit]
Thisedit request has been answered. Set the|answered= parameter tono to reactivate your request.

OnModule:Check_for_unknown_parameters#L-94, please replace the undefined variablepreview withpreview_text. That expression is always going to evaluate to true and so will never reach the third expression.AwesomeAasim17:57, 29 August 2024 (UTC)[reply]

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.
Trappist the monk (talk)18:08, 29 August 2024 (UTC)[reply]

Suggested enhancement

[edit]
See also:Module_talk:WikiProject banner

We are using this module onModule:WikiProject banner. We first check ifCategory:Pages using WikiProject PROJECT with unknown parameters exists and if not, then we useCategory:WikiProject templates with unknown parameters instead. The problem is that this is causing thousands of links to non-existent categories to be recorded, which can be seen inSpecial:WantedPages. My suggestion is as follows. The module can accept an additional argument calledfallback which is a category which will be used if the one specified inunknown does not exist. In this way we can check existence of that category only when unknown parameters are discovered, not in every single case. — Martin(MSGJ · talk)14:19, 4 September 2024 (UTC)[reply]

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.
Trappist the monk (talk)15:35, 4 September 2024 (UTC)[reply]
I'll try and explain better. Or you can look at the code at aroundModule:WikiProject banner#L-831. We have to check existence before calling this module. Checking existence adds a link to the page. Therefore every transclusion of{{WikiProject Lepidoptera}} is generating a link toCategory:Pages using WikiProject Lepidoptera with unknown parameters which is not so good. I would prefer to only check if the category exists if there are some unknown parameters. That check can only happen in this module. Or perhaps you have a better idea — Martin(MSGJ · talk)21:02, 4 September 2024 (UTC)[reply]
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.
Trappist the monk (talk)22:22, 4 September 2024 (UTC)[reply]
Great, thanks. I'll look into that — Martin(MSGJ · talk)08:55, 5 September 2024 (UTC)[reply]
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.
Trappist the monk (talk)11:48, 5 September 2024 (UTC)[reply]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module_talk:Check_for_unknown_parameters&oldid=1277820820"

[8]ページ先頭

©2009-2025 Movatter.jp