Video Module talk:Check for unknown parameters/Archive 1
Just some ideas
Great and useful. Here are some earlier thoughts.
0. Change name to e.g. module:Parameter check, to cover more wide goals. Definitely do not limit to infoboxes.
The parameter whitelist could be a module:Parameter check/data/Template:Foo page for the Draft:Tlno template (module data page). With that whitelist, some extra options are possible:
-
- 1. Unnamed (positional) parameters could be defined white or black
- 2. Per parameter, an "accept blank input yes/no" switch can be added.
- 3. Per parameter, a more special value check could be performed (numeric, pattern, listcheck).
- 4. Big-issue parameters (black/white) or special interest parameters could have their own category or their own catsort letter.
- 4b. Deprecated parameters can be defined and categorized separate (idea added later).
- 5. Category name automated? Parent cat available (using template name, by "parameter check module" name?)
- Tree suggestion (all are maintenance categories):
- Category:Template foo maintenance categories (could be existing name, any name, host cat for this module outcomes)
- Category:Parameter check categories -- The module's view.
-
- Category:Parameter checks for template foo -- dedicated for & created through module:Parameter check
- -- Has the default checks (forced adding of the word "pages" makes the name awkward. Better not use title word "articles", because that is to be an option for the template editor).
- Category:Foo template parameter 'country' checks -- special checks
- Category:Foo template parameter '1=' checks --spcial checks
-
6. We could add a maintenance tag to the pages, demo Draft:Tlno:
-
Lorem {{do something|latincehck=ipsum}} foo.
-> Lorem ipsum[unknown parameter] foo. Currently in {{convert}}: 12 kilometres ().
7. Note: As always, categorising a wikilabel works out bad. Say the template is used in the {do something} template, which is used like this:
-
[[Mercury (element)|{{do something|Mercury}}]]
. When the category name is expanded into the page including a category name, it shows like this in the article:[[Mercury (element)Mercury blabla foobar]]
. The template could have a "|parametercheck this instance=no
option (the offended page must be edited for this).
8. Options for (easy) ns differentiation please.
9. Catsort could be [[Category: ... |__VALUE__, {{PAGENAME}}]]
-DePiep (talk) 08:04, 25 March 2014 (UTC)
- I like the idea of loading the required parameters from a module data page, rather than using frame args and parent frame args. This option will be much better performance-wise, especially for templates that are called many times on one page. (This is assuming we are loading the data with mw.loadData.) -- Mr. Stradivarius ? talk ? 08:53, 25 March 2014 (UTC)
- Agree. Even more: it allows for unlimited parameter sub-specifications. Each whitelist parameter can have its own check-properties, like "is deprecated", to be used. Also, an "is blacklisted=yes" property can be added for notorious bad parameters). -DePiep (talk) 10:19, 25 March 2014 (UTC)
- feel free to create a more general version as suggested. this was just a first iteration at solving a specific problem. in response to point 7, I modified it to clobber non-whitelisted characters from the VALUE parameter. the list of valid characters could be expanded, and what the clobbered characters are replaced by, but this seems to work for sorting purposes. again, feel free to fork/pilfer/modify this module to create something better. I won't care if it is replaced by something better and deleted. Frietjes (talk) 15:33, 25 March 2014 (UTC)
- Agree. Even more: it allows for unlimited parameter sub-specifications. Each whitelist parameter can have its own check-properties, like "is deprecated", to be used. Also, an "is blacklisted=yes" property can be added for notorious bad parameters). -DePiep (talk) 10:19, 25 March 2014 (UTC)
@Frietjes: maybe you could add something for such cases - when you can use arg1 to arg100 (or now with Lua - even arg1 to argN). So using this module in some template
{{#invoke:check for unknown parameters|check |arg}}
And it accepts all arguments with arg - from 1 to N. OK, you should name somehow it, because currently it would cause some unexpected results. --Edgars2007 (talk/contribs) 14:01, 8 June 2015 (UTC)
- I wonder, how does this module compare to Module:TemplatePar? DePiep? Alakzi (talk) 14:28, 8 June 2015 (UTC)
Maps Module talk:Check for unknown parameters/Archive 1
About Module:TemplatePar
re Alakzi. I have applied Module:TemplatePar in {{Chembox}} and {{Drugbox}} (together causing nearly all the 16000 tranc's then), and from that will make some remarks. I did not a comprehensive comparision.
- TemplatePar (TPar here) only comes in module form, #invoked. I've added after the infobox code like this:
{{#invoke:TemplatePar |check |template=Template:Chembox |all= |opt= IUPACName_hidden= IUPACNames_hidden= Name= ImageAlt= ImageCaption= |cat=Chemical articles with unknown parameter in Chembox |format=0|preview=1|errNS=0
- I did not research, but I imagine it can be invoked from a module too (instead of wikicode template).
- The parameter list smartly has separator "=" (because that can not be part of any param name).
- I guess numbered params can be added like
1= 2= 3= 4=
, that's individually not by range. - TPar has very many options by various parameters. The params do interact which can make building & testing horrible.
- The doc mentions the option of value-testing for a param (not tried), and presence-testing, in the code above applied by
|check=
(it is the parameter being there that is the setting, where one would expect like|check=yes
for readible code. What would do|check=no
?), and other options (counting?).- The parameter list giving hints on what can be done:
--[=[ TemplatePar 2015-02-14 Template parameter utility * assert * check * count * countNotEmpty * downcase() * match * valid * verify() * TemplatePar() ]=]
- Error messaging/categorising can be limited to a list of namespaces.
- Visual effects can be set to handcrafted errormessage with @variables, and to show a message only in Preview view.
- I have not looked at performance (parsing times etc).
- One absolute negative I: when used in a subtemplate, an error does not survive in the top template. That is, in
|Chembox | Name = Foo | Section1 = {{Chembox Identifiers | CASnumber=12345 }} }}
a TPar message raised in sub {Chembox Identifiers} does not take effect in any way (killed along the route). I have not spend time on researching & solving this (though in {{Chembox}}, 80% of the parameters are in subtemplates...).
- In general I like it because it has multiple options and does not require parameter-name tricks. Also the flexibility of messaging & categorising is a useful feature. Although documentation is elaborate, for me it required extra probing to get the intentions ('programmer wrote the /doc situation' - no offense). I got cooperative responses & code changes (it is maintained at dewiki).
- Documentation (en): de:Wikipedia:Lua/Modul/TemplatePar/en/invoke, +more en-language pages.
- As said, this is not a comparision, and I don't know how this Check for unknown parameters would score on those features.
- -DePiep (talk) 22:01, 8 June 2015 (UTC)
- Thank you for the thorough rundown. Alakzi (talk) 23:21, 8 June 2015 (UTC)
- Added its own param list, link to english /doc at dewiki. Minor fizes. -DePiep (talk) 11:42, 9 June 2015 (UTC)
- why is this thread on this talk page? Frietjes (talk) 14:42, 14 June 2015 (UTC)
- It's a reply to [1]. New section, good. -DePiep (talk) 23:00, 14 June 2015 (UTC)
- why is this thread on this talk page? Frietjes (talk) 14:42, 14 June 2015 (UTC)
- Added its own param list, link to english /doc at dewiki. Minor fizes. -DePiep (talk) 11:42, 9 June 2015 (UTC)
- Thank you for the thorough rundown. Alakzi (talk) 23:21, 8 June 2015 (UTC)
Should the ignoreblank parameter apply to the preview message?
As far as I can tell, when there is an unknown but blank parameter in {{infobox person}}, the category is not applied (since |ignoreblank=
is set), but the preview message complains about both populated and blank unknown parameters.
This may be pure personal preference, but I think that the preview message should listen to the |ignoreblank=
parameter, showing red error messages only for populated parameters. Does that make sense to others here? - Jonesey95 (talk) 22:32, 16 March 2016 (UTC)
- the idea was to allow editors to find and clean up blank deprecated parameters, but not elevate them to the point that they are tracked. how about if we add an additional option for say
|ignoreblank=all
or|ignoreblank=preview
or whatever? Frietjes (talk) 00:12, 17 March 2016 (UTC)
Polluting content
Hiding the text with an inline style attribute containing "display: none" (as the usage guidelines encourage) is problematic, because the text is only hidden on visual web browsers. Screen readers and web spiders still treat it as part of the page content. This causes the error text to appear in Google search snippets, as you can see in this screenshot. If you search the web, you can find other examples. --Ori Livneh (talk) 03:30, 24 April 2016 (UTC)
- Hi. In general, if you find a problem with Google's search results, it's best to tell Google. The English Wikipedia does not control Google search results. Google search is a closed-source proprietary search engine, as far as I'm aware, basically a black box.
- At least for me, limiting your search query to site:en.wikipedia.org is a better demonstration of the issue. If there's additional or better markup that can be used here that will signal to Google and other search engines that this text is meant to be stripped or ignored, I think we'd be happy to accommodate, assuming the markup isn't stupidly vendor-specific. Maybe some WAI-ARIA HTML attributes or similar?
- Broadly, why are we using a Scribunto/Lua module to find unknown template parameters? We should probably put this functionality in a MediaWiki extension or in MediaWiki core. Perhaps in TemplateData? I'm reminded of Wikipedia:Database reports/Articles containing invalid template parameters and the horror of learning just how crazy template parameter names can be. --MZMcBride (talk) 05:08, 26 April 2016 (UTC)
- See also, phab:T133504, which contains links to 2 prior VP discussions. Quiddity (WMF) (talk) 20:27, 17 May 2016 (UTC)
- I have removed any hidden text directly generated by this module, and removed any mention of using hidden text in the documentation. this "feature" was really only there to assist with finding the offending parameter without creating visible output in the article. but, since we have the ability to show verbose output in preview-mode only, the hidden comment feature isn't really needed. hopefully the preview-mode feature doesn't go away [2]. Frietjes (talk) 16:59, 17 June 2016 (UTC)
- See also, phab:T133504, which contains links to 2 prior VP discussions. Quiddity (WMF) (talk) 20:27, 17 May 2016 (UTC)
False positive
I am assuming that this module is responsible for the error message reported at Wikipedia:Teahouse/Questions#Infobox error regarding article Kohat, but I cannot see any use of a parameter "1". Can one of the experts explain, please? --David Biddulph (talk) 17:24, 21 June 2016 (UTC)
- There was a parameter in that article that was missing the = sign between the parameter name and its value. I fixed it. Not a bug in the module. The error message could be clearer. - Jonesey95 (talk) 17:33, 21 June 2016 (UTC)
- the error message for numeric parameters should be more informative now. Frietjes (talk) 14:43, 23 June 2016 (UTC)
Checking for only known parameters (or no parameters)?
Is there a way to use this module to check for templates that only use the known (specified) parameters? Or to check if no parameters have been passed to a template? That would be useful for checking if infoboxes are entirely drawn from Wikidata, or if they have any locally defined parameters (e.g., including South Pole Telescope in Category:Articles with infoboxes completely from Wikidata via Template:Infobox telescope). Thanks. Mike Peel (talk) 22:53, 18 December 2016 (UTC)
- Mike Peel, your first question is "to check for templates that only use the known (specified) parameters". yes, this is exactly what this template does. you provide the list of known parameters, and it returns whatever you put in
|unknown=
. your second question is "to check if no parameters have been passed to a template". yes, you can use the following code:{{#if:{{#invoke:check for unknown parameters|check|preview=1|unknown=1}}|<!-- do nothing we found parameters -->|[[Category:Pages using infobox telescope with paramters]]}}
. in other words, wrap the output inside an#if:
to reverse the logic. if you want me to add tracking to a particular template, just tell me the name of the tracking category and what it should track. Frietjes (talk) 14:19, 19 December 2016 (UTC)- That's great, thanks! I was trying something similar to that yesterday but I couldn't get it to work - I think the missing element that you've added to get it working is "safesubst". Thanks for adding it to the template! Mike Peel (talk) 16:09, 19 December 2016 (UTC)
- Mike Peel, the safesubst: was just for debugging so you can see what is happening with
{{subst:infobox telescope
in preview mode. it looks like you tried{{#ifeq:{{{1|}}}|||[[Category:Articles with infoboxes completely from Wikidata]]}}
which is just testing for|1=
. Frietjes (talk) 16:19, 19 December 2016 (UTC)- Hmm, this was the first version of the code I was using. Maybe it was the order that "main other" was being called, then. diff between my version and now. Anyhow, thanks for getting it to work! Thanks. Mike Peel (talk)
- Mike Peel, I am guessing you wanted
#ifeq:
instead of#if:
there? Frietjes (talk) 20:37, 19 December 2016 (UTC)- Aah, that's probably it! Mike Peel (talk) 21:15, 19 December 2016 (UTC)
- Mike Peel, I am guessing you wanted
- Hmm, this was the first version of the code I was using. Maybe it was the order that "main other" was being called, then. diff between my version and now. Anyhow, thanks for getting it to work! Thanks. Mike Peel (talk)
- Mike Peel, the safesubst: was just for debugging so you can see what is happening with
- That's great, thanks! I was trying something similar to that yesterday but I couldn't get it to work - I think the missing element that you've added to get it working is "safesubst". Thanks for adding it to the template! Mike Peel (talk) 16:09, 19 December 2016 (UTC)
Should I Anticipate Challenges if the Parameter is Post-Hoc Added to the Template?
Hello all; I'm an editor from long ago who no longer uses an account or edits regularly, and I pre-dated Lua, so apologies if this is a oft-asked question. The short form of the question is: if, instead of deleting an un-used parameter, I add that parameter to the template, should I anticipate any problems with this module?
More detailed question: I added a parameter, {{{expanded}}}, to Template:Infobox convention center (diff). The parameter was advertised on the template documentation, but for some reason it was not a part of the actual template code. As it had been advertised on the documentation, many pages used it, including, for example, Kansas City Convention Center. I had been trying to fix pages on Category:Pages using infobox convention center with unknown parameters, which is generated with this module, and I noticed that adding the parameter did not take any pages off the list. (And, more specifically, a preview of the pages still generated the error message: Warning: Page using Template:Infobox convention center with unknown parameter "expanded" (this message is shown only in preview).
Now I assume it's just a cache issue; that this will resolve itself, and I will look silly, but in the spirit of ensuring that I didn't make a harmful edit, I thought I'd check here to make sure. Thanks!--216.12.10.118 (talk) 01:16, 1 April 2017 (UTC)
Update: Idiocy confirmed. {{{expanded}}} is no longer generating the message. Sorry!--216.12.10.118 (talk) 01:27, 1 April 2017 (UTC)- The parameter has to be added as a known parameter. -- JJMC89 (T·C) 01:32, 1 April 2017 (UTC)
- Ah I see! I'm glad I checked, then; sorry for making you do the work. I appreciate it, --216.12.10.118 (talk) 01:33, 1 April 2017 (UTC)
- For anyone looking for this same answer in the future, here it is in plain text: The unknown parameter check is typically at the bottom of the template code. If you add a parameter to the template, you also need to add it to the list of valid parameters (typically in alphabetical order) in the unknown parameter check section. That addition will prevent the red error message when you preview a page. - Jonesey95 (talk) 03:53, 1 April 2017 (UTC)
- Ah I see! I'm glad I checked, then; sorry for making you do the work. I appreciate it, --216.12.10.118 (talk) 01:33, 1 April 2017 (UTC)
- The parameter has to be added as a known parameter. -- JJMC89 (T·C) 01:32, 1 April 2017 (UTC)
Restrict to certain namespaces
Apparently there is no namespace selector ("only list pages in ns=x" or "... ns=/=y"). Is there a good practice to add this? -DePiep (talk) 12:53, 30 May 2017 (UTC)
- We usually wrap the category with {{main other}}. See {{Infobox mountain}} for an example. Here's the standard invocation of the module:
{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox mountain with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox mountain]] with unknown parameter "_VALUE_"|ignoreblank=y| (... parameters separated by pipes ...) }}
- Replace the template name with the template you are working with, of course. 12:57, 30 May 2017 (UTC)
"this message is shown only in preview"
The messages generated by this module (such as Warning: Page using Template:Infobox writer with unknown parameter "influenced" (this message is shown only in preview). on Neal Stephenson) are in fact also shown when editing in VisualEditor (e.g. https://en.wikipedia.org/wiki/Neal_Stephenson?veaction=edit). Therefore I suggest to change the wording from "in preview" to "when editing", which is still correct for the wikitext editor. (If this is done, the same change should be applied to the modules/templates found here: [3].) Matma Rex talk 22:42, 5 July 2017 (UTC)
- Visual editor's edit screen appears to be an attempt at previewing what you will see when you publish your changes, so "in preview" is accurate there as well. Some people do not have "Show preview on first edit" selected in their Editing preferences, so "when editing" would not be accurate for them. - Jonesey95 (talk) 23:44, 5 July 2017 (UTC)
- I'm inclined to Jonesey's position. I've marked the edit protected request answered until a consensus is had. --Izno (talk) 12:18, 7 July 2017 (UTC)
Discussion
A relevant discussion has been initiated at Template talk:Infobox#Improvement. You are invited to share your comments. -- Pankaj Jain Capankajsmilyo (talk · contribs · count) 18:21, 26 August 2017 (UTC)
Source of the article : Wikipedia