Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Template wrapper/doc
(section)
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!
==Parameter details== ===_template=== The only required parameter, {{para|_template}} supplies the name, without namespace, of the working template (the template that is wrapped). If this parameter is omitted, Module:Template wrapper will emit the error message: :<span style="font-size:100%" class="error"><code style="color:inherit; border:inherit; padding:inherit;">|_template=</code> missing or empty</span> ===_alias-map=== {{para|_alias-map}} takes a comma-separated list of wrapper-template parameters that are to be treated as aliases of specified working template canonical parameters. Each mapping element of the list has the form: :<code><{{var|from}}>:<{{var|to}}></code> β where: <code><{{var|from}}></code> is a wrapper parameter name and <code><{{var|to}}></code> is a canonical parameter name In this example, it may be preferable for a wrapper template to use {{para|assessor}} which may be unknown to the working template but the working template may have an equivalent {{para|author}} so in the <code><nowiki>{{#invoke:}}</nowiki></code> we would write: :{{para|_alias-map|assessor:author}} Positional parameters may also be mapped to canonical parameters: :{{para|_alias-map|1:author, 2:title, 3:language}} Enumerated wrapper parameters may be mapped to enumerated canonical parameters using the <code>#</code> enumerator specifier: :{{para|_alias-map|assessor#:author#}} Given the above example, {{para|assessor2}} will map to {{para|author2}}; also, {{para|assessor}} and {{para|assessor1}} will map to {{para|author1}} Multiple wrapper parameters can map to a single canonical parameter: :{{para|_alias-map|1:author, assessor:author}} Wrapper parameters listed in {{para|alias-map}} are not passed to the working template. Mapping positional parameters when {{para|_include-positional|yes}} may give undesirable results. {{para|_alias-map|1:author}} and {{para|_include-positional|yes}} will cause all other positional parameters to be passed to the working template as is: wrapper template <code><nowiki>{{{2}}}</nowiki></code> becomes working template <code><nowiki>{{{2}}}</nowiki></code>, etc; working template will not get <code><nowiki>{{{1}}}</nowiki></code> though it will get {{para|author}}. ===_reuse=== {{para|_reuse}} takes a comma-separated list of canonical parameters that have meaning to both the wrapper template and to the working template In the simplest cases, a canonical parameter passed into the wrapper template overrides a default parameter provided in the wrapper template. Sometimes a wrapper parameter is the same as a canonical parameter and the wrapper template needs to modify the parameter value before it is passed to the working template. In this example, {{para|title}} is both a wrapper parameter and a canonical parameter that the wrapper template needs to modify before passing to the working template. To do this we first write: :{{para|_reuse|title}} then, in the wrapper template's <code><nowiki>{{#invoke:Template wrapper|wrap|_template=...|...}}</nowiki></code> we write: :{{para|title|Modified <nowiki>{{{title}}}</nowiki>}} _reused parameters cannot be overridden. ===_exclude=== {{para|_exclude}} takes a comma-separated list of parameters used by the wrapper template that are not to be passed to the working template. This list applies to all wrapper and canonical parameters (including those canonical parameters that are renamed alias parameters) received from the wrapper template. As an example, a wrapper template might use {{para|id}} to supply a portion of the value assigned to default parameter {{para|url}} so we would write: :{{para|_exclude|id}} then, in the wrapper template's <code><nowiki>{{#invoke:Template wrapper|wrap|_template=...|...}}</nowiki></code> we write: :{{para|url|<nowiki>https://example.com/{{{id}}}</nowiki>}} The modified {{para|url}} value is passed on to working template but {{para|id}} and its value is not. _reused and default parameters cannot be excluded. ===_include-positional=== {{para|_include-positional}} is a boolean parameter that takes only one value: <code>yes</code>; the default (empty, missing) is <code>no</code> (positional parameters normally excluded). When set to <code>yes</code>, Module:Template wrapper will pass all positional parameters to the working template. See also Β§[[#_alias-map|_alias-map]]. ===Overriding default parameters=== Editors may override default parameters by simply setting the default parameter to the desired value in the wrapper template. This module ignores empty parameters (those parameters that are named but which do not have an assigned value). When it is desirable to override a default parameter to no value, use the special keyword <code>unset</code>. Default parameters with this value are passed to the working template as empty (no assigned value) parameters. _reused parameters cannot be <code>unset</code> or overridden.
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)