Module talk:TemplatePar
Appearance
Bug?
Just discovering module:TemplatePar. module:TemplatePar/doc led me to dewiki. So I reported a bug? there: [1] de:Wikipedia_Diskussion:Lua/Modul/TemplatePar#Setting_check_parameters_adds_a_.220.22_to_the_result_.28en.29. -DePiep (talk) 19:34, 14 February 2015 (UTC)
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)
- Thank you for the thorough rundown. Alakzi (talk) 23:21, 8 June 2015 (UTC)