Search code examples
mediawikimediawiki-templates

pass parameter to nested template


I'm trying to set up a page in our wiki which covers certain parameters of a specific operator in our software. Every parameter in the software can be of a certain type, like "Menu" or "Toggle".

So I thought I'll create 2 Templates. First is called "Parameter", second is called "Menu".

The Parameter template looks like this:

'''{{{label}}}''' <code>{{{name}}}</code> - {{{summary}}}

{{{items}}}

And the Menu template looks like this:

* {{{label}}} <code>{{{name}}}</code> - {{{summary}}}

The content for my page would look like this:

{{Parameter
|type=menu
|label=Interpolation
|name=interp
|items=
{{
{{menu|name=nointerp|label=No Interpolation|summary=Use the value of the nearest sample.}}
|{{menu|name=linear|label=Linear|summary=Use linear interpolation between samples when the interval is lengthened. Averages all samples near the new sample when the interval is shortened.}}
|{{menu|name=cubic|label=Cubic|summary=Cubically interpolates between samples, for smoother curves than Linear. This method is not recommended for channels with sharp changes.}}
|{{menu|name=edge|label=Pulse Preserve|summary=A linear interpolation that recognizes single sample pulses and preserves their height and one sample width. A pulse is a non-zero value preceded and followed by zero-value samples.}}
}}
|summary=The interpolation method to use when resampling.}}

This almost works but I get extra characters like "{" and "|" rendered on the actual page.

My Question I guess is: Is it possible to pass parameters to "sub-templates" the way that I am doing this?

Thank you very much


Solution

  • Note that this will result in the menus being passed as parameters items, 1, 2 and 3. I think what you want is passing them all as the items parameter, in which case you need to remove the outer | marks.