Misplaced Pages

Module:Template wrapper/doc: Difference between revisions

Article snapshot taken from[REDACTED] with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Module:Template wrapper Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 17:57, 9 January 2018 editTrappist the monk (talk | contribs)Administrators480,243 edits ce;← Previous edit Revision as of 23:33, 10 February 2018 edit undoJJMC89 (talk | contribs)Edit filter managers, Autopatrolled, Administrators345,170 edits Based on Module:Citation/CS1/Wrapper/doc by Trappist the monkNext edit →
Line 1: Line 1:
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see ]) -->
This module is to be used in cs1|2 wrapper templates to allow those templates to provide 'default' settings and at the same time allow editors to pass additional parameters to the underlying cs1|2 template.
== Usage ==


<code><nowiki>{{#invoke:</nowiki>{{BASEPAGENAME}}|wrap|_template={{var|wrapped template}}}}</code>
This module requires one parameter: {{para|template}}, the name (without namespace) of the template that is wrapped. {{tlx|cite Grove}} wraps {{tlx|cite encyclopedia}} so requires {{para|template|cite encyclopedia}}.


This module is to be used in wrapper templates to allow those templates to provide default parameter values and allow editors to pass additional parameters to the underlying template.
When writing a wrapper template, give this module all of the normally required default parameters necessary to write the citation in its base form. Editors then use the wrapper template as is or may supply additional cs1|2 parameters. Any of the normal cs1|2 parameters supported by the wrapped template may be added to the wrapper template or supplied by editors in article space. When an editor supplies a parameter that has a default value in the wrapper template, the editor-supplied value overrides the default. When it is necessary to 'unset' (make blank) a default parameter, editors may set the parameter value to the special keyword <code>unset</code> which will cause this wrapper module to erase the wrapper template's default value for that parameter. Empty parameters convey no special meaning to cs1|2 templates so this module discards them.


This module requires one parameter: {{para|_template}}, the name (without namespace) of the template that is wrapped.
Certain cs1|2 parameters require the presence of other parameters. For example, {{para|url-access|subscription}} requires {{para|url}}. When a wrapper template does not specify {{para|url}} as a default but appropriate urls, when provided, are subscription-only, the wrapper template should test for the presence of a url and set {{para|url-access}} accordingly:
:<code><nowiki>|url-access={{#if:{{{url|}}}|subscription}}</nowiki></code>


When writing a wrapper template, give this module all of the normally required default parameters necessary to write use the template in its base form. Editors then use the wrapper template as is or may supply additional parameters. Any of the normal parameters supported by the wrapped template may be added to the wrapper template or supplied by editors in article space. When an editor supplies a parameter that has a default value in the wrapper template, the editor-supplied value overrides the default. When it is necessary to remove a default parameter, editors may set the parameter value to the special keyword <code>unset</code> which will cause this wrapper module to erase the wrapper template's default value for that parameter. This module discards empty parameters.
Parameters to be used only by the wrapper should be either positional (<code><nowiki>{{{</nowiki>{{var|n}}}}}</code>) or prefixed with an underscore (<code><nowiki>{{{</nowiki>_{{var|name}}}}}</code>). This module will not pass these types of parameters to the wrapped template.

Parameters to be used only by the wrapper should be either positional ({{param|{{var|n}}}}), prefixed with an underscore ({{param|_{{var|name}}}}), or listed in {{para|_blacklist}} (comma separated). This module will not pass these types of parameters to the wrapped template.

<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->

}}</includeonly>

Revision as of 23:33, 10 February 2018

Usage

{{#invoke:Template wrapper|wrap|_template=wrapped template}}

This module is to be used in wrapper templates to allow those templates to provide default parameter values and allow editors to pass additional parameters to the underlying template.

This module requires one parameter: |_template=, the name (without namespace) of the template that is wrapped.

When writing a wrapper template, give this module all of the normally required default parameters necessary to write use the template in its base form. Editors then use the wrapper template as is or may supply additional parameters. Any of the normal parameters supported by the wrapped template may be added to the wrapper template or supplied by editors in article space. When an editor supplies a parameter that has a default value in the wrapper template, the editor-supplied value overrides the default. When it is necessary to remove a default parameter, editors may set the parameter value to the special keyword unset which will cause this wrapper module to erase the wrapper template's default value for that parameter. This module discards empty parameters.

Parameters to be used only by the wrapper should be either positional ({{{n}}}), prefixed with an underscore ({{{_name}}}), or listed in |_blacklist= (comma separated). This module will not pass these types of parameters to the wrapped template.


Module:Template wrapper/doc: Difference between revisions Add topic