Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Tales from Chyria
Search
Editing
Module talk:Check for unknown parameters
From Tales from Chyria
Namespaces
Module
Discussion
More
More
Page actions
Read
Edit source
New topic
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Permanently protected}} {{oldtfdfull|date= 2019 December 30 |result=no consensus |disc=Module:Check for deprecated parameters|merge=self}} {{talk header}} {{WikiProject banner shell| {{WikiProject Templates|module_for_template_maintenance=y}} }} {{User:MiszaBot/config | algo=old(90d) | archive=Module talk:Check for unknown parameters/Archive %(counter)d | counter=1 | maxarchivesize=900K | archiveheader={{aan}} | minthreadsleft=2 | minthreadstoarchive=1 }} == Protected edit request on 29 August 2024 == {{edit fully-protected|Module:Check for unknown parameters|answered=yes}} On [[Module:Check_for_unknown_parameters#L-94]], please replace the undefined variable <code>preview</code> with <code>preview_text</code>. That expression is always going to evaluate to true and so will never reach the third expression. [[User:Awesome Aasim|Awesome]] [[User_talk:Awesome Aasim|Aasim]] 17:57, 29 August 2024 (UTC) :Done. Also added <syntaxhighlight lang="wikitext" inline="1">require ('strict')</syntaxhighlight> which will catch other globals. Keep an eye on {{cl|Pages with script errors}} to see if the addition reveals other globals. :鈥擺[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 18:08, 29 August 2024 (UTC) == Suggested enhancement == {{see also|Module_talk:WikiProject banner}} We are using this module on [[Module:WikiProject banner]]. We first check if [[:Category:Pages using WikiProject PROJECT with unknown parameters]] exists and if not, then we use [[:Category: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 in [[Special:WantedPages]]. My suggestion is as follows. The module can accept an additional argument called <code>fallback</code> which is a category which will be used if the one specified in <code>unknown</code> 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 <small>([[User:MSGJ|MSGJ]] 路 [[User talk:MSGJ|talk]])</small> 14:19, 4 September 2024 (UTC) :What is it that I'm missing? If the problem is caused by something that happens in [[Module: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. :鈥擺[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 15:35, 4 September 2024 (UTC) ::I'll try and explain better. Or you can look at the code at around [[Module: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 {{tl|WikiProject Lepidoptera}} is generating a link to [[:Category: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 <small>([[User:MSGJ|MSGJ]] 路 [[User talk:MSGJ|talk]])</small> 21:02, 4 September 2024 (UTC) :::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) but [[Module:Check_for_unknown_parameters#L-113|Module:Check for unknown parameters line 113]] appears to return a concatenated string of unknown parameters (apparently without delimiters). If there are no unknowns then the <syntaxhighlight lang="lua" inline="1">table.concat(res)</syntaxhighlight> returns an empty string. So, it looks like <syntaxhighlight lang="lua" inline="1">p._check(args, pargs)</syntaxhighlight> returns: ::::<code>nil</code> when either of <code>args</code> and <code>pargs</code> is not a table ::::<code>''empty string''</code> 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 from <syntaxhighlight lang="lua" inline="1">require('Module:Check for unknown parameters')._check(parameters, parent_args)</syntaxhighlight> before you fiddle about with categories. :::鈥擺[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 22:22, 4 September 2024 (UTC) ::::Great, thanks. I'll look into that — Martin <small>([[User:MSGJ|MSGJ]] 路 [[User talk:MSGJ|talk]])</small> 08:55, 5 September 2024 (UTC) ::::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 <small>([[User:MSGJ|MSGJ]] 路 [[User talk:MSGJ|talk]])</small> 09:06, 5 September 2024 (UTC) :::::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. :::::鈥擺[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 11:48, 5 September 2024 (UTC)
Summary:
Please note that all contributions to Tales from Chyria may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Chyria Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
User:MiszaBot/config
(
edit
)
Template:Cl
(
edit
)
Template:Edit fully-protected
(
edit
)
Template:Oldtfdfull
(
edit
)
Template:Permanently protected
(
edit
)
Template:See also
(
edit
)
Template:Talk header
(
edit
)
Template:Template link
(
edit
)
Template:Tl
(
edit
)
Template:WikiProject banner shell
(
edit
)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs