Misplaced Pages

Module:Template wrapper/doc

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

This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 17:57, 9 January 2018 (ce;). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 17:57, 9 January 2018 by Trappist the monk (talk | contribs) (ce;)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
This is a documentation subpage for Module:Template wrapper.
It may contain usage information, categories and other content that is not part of the original module page.

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.

This module requires one parameter: |template=, the name (without namespace) of the template that is wrapped. {{cite Grove}} wraps {{cite encyclopedia}} so requires |template=cite encyclopedia.

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 unset 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.

Certain cs1|2 parameters require the presence of other parameters. For example, |url-access=subscription requires |url=. When a wrapper template does not specify |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 |url-access= accordingly:

|url-access={{#if:{{{url|}}}|subscription}}

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

Module:Template wrapper/doc Add topic