Template talk:Parameter names example

(Redirected from Template talk:Parameter names example/testcases)
Latest comment: 6 years ago by Funandtrvl in topic Without parameters

Template invocations

edit

@Sardanaphalus: I've got the template invocation code working. Try adding |_code=yes to see the results. At the moment it just uses a standard MediaWiki <pre>...</pre> tag with line-wrapping enabled. But most documentation pages will want to have different formatting. What formatting options would you like to see? Also, I tried quite hard, but if named parameters are used, it is impossible to preserve the order that they were passed to the template. So in this case, the parameter names are sorted alphabetically. (The alternative is being sorted at random.) — Mr. Stradivarius ♪ talk ♪ 14:49, 29 August 2014 (UTC)Reply

  • Thanks for your prompt work – I've added a second version of the main-template test on the testcases page that uses the sandbox version with |_code=yes. Hopefully, per Jackmcbarn below, it'll be possible to list the parameters as supplied when {{Parameter names example}} is called. Also, hopefully, it'll be possible to include the parameters' values (as at present) for the sake of e.g. an "Examples" section on a /doc page, but suppress them for a "Syntax"/"Parameters" section..? Ideally, I suppose, it would be possible to suppress the appearance of text that would be parsed as values but not e.g. the comments that can appear in these sections:
{{Template
| parameter_one =
| parameter_two =      <!--Use {{blah|X|Y|Z}} here-->
| parameter_three =
| parameter_four =     <!--Omit if this or that-->
(etc)
I'm wondering, though, whether this'd be too awkward/cumbersome to achieve (or for people to use) to be worthwhile.
As regards formatting, I'm intrigued to see (data6 in the testcases example) that template calls within values seem to be {{subst:}}ituted automatically – is this easy to prevent? Otherwise, the option of where to place the code relative to the template (above, to the left/right, below) comes to mind – with, perhaps, a default to-the-left if the template detects "[I/i]nfobox" or "[S/s]idebar" in the template's path or (if used) in _template..?
Thanks again for your work, Sardanaphalus (talk) 10:17, 31 August 2014 (UTC)Reply

Raw parameters

edit

@Mr. Stradivarius: I noticed the recent problem with parameter name order. Note that I submitted gerrit:156442 a few days ago. Should it be accepted, it will allow an easy fix for that problem. Jackmcbarn (talk) 15:42, 29 August 2014 (UTC)Reply

@Jackmcbarn: That would be useful, yes. Thing is, I seem to remember that the order was preserved for pairs(frame.args) back when Scribunto was first introduced. But I never wrote any code that relied on that behaviour, so at this stage I'm not really sure whether I was imagining that or not. That's why I tried so hard this time round, anyway. :) — Mr. Stradivarius ♪ talk ♪ 16:12, 29 August 2014 (UTC)Reply

Without parameters

edit

Can I use this template to reflect all parameters, without defining each one manually? Capankajsmilyo (talk) 17:30, 3 April 2018 (UTC)Reply

No, I think you have to list the ones that you want to show, because some of the parameters, if there is a conversion equation linked to it, don't show correctly. Funandtrvl (talk) 20:07, 17 April 2018 (UTC)Reply