Template:Para/doc: Difference between revisions
m 107 revisions imported from wikipedia:Template:Para/doc |
No edit summary |
||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | ||
== Usage == | == Usage == | ||
This template is for giving examples of | This template is for giving examples of template parameter source code (useful in template documentation and talk page discussions of template code). | ||
It must have at least one or two parameters itself. The first parameter is the name of the example parameter to display (this may be ''empty'', but it must be ''present''). The second (optional) parameter is a value for the first example parameter; or, if the first parameter is empty, the second illustrates an example [[Help:Templates# | It must have at least one or two parameters itself. The first parameter is the name of the example parameter to display (this may be ''empty'', but it must be ''present''). The second (optional) parameter is a value for the first example parameter; or, if the first parameter is empty, the second illustrates an example [[mw:Help:Templates#Anonymous parameters|unnamed parameter]] (which in some cases may serve as a pre-defined parameter that takes no <code>{{!}}{{=}}value</code> after it, e.g. the {{para||section}} in {{tlx|Refimprove|section|SISTER=w}}). | ||
=== Examples === | === Examples === | ||
Line 27: | Line 25: | ||
| For [[Help:Templates#Parameters|unnamed parameters]]; note empty first parameter in the code | | For [[Help:Templates#Parameters|unnamed parameters]]; note empty first parameter in the code | ||
|- | |- | ||
| <code><nowiki>{{para | | <code><nowiki>{{para|parameter|value}}</nowiki></code> | ||
| {{para | | {{para|parameter}}|value}} | ||
| | | | ||
|} | |} | ||
When using literal, pre-specified parameter names and values, simply provide them (as in the first through third examples above). When illustrating hypothetical/example parameter names, or variable or user-definable values, use something like {{tlx|var|parameter}} and/or {{ | When using literal, pre-specified parameter names and values, simply provide them (as in the first through third examples above). When illustrating hypothetical/example parameter names, or variable or user-definable values, use something like {{tlx|var|parameter}} and/or {{tlx|var|value}} (as in the last example above). | ||
== Parameters == | == Parameters == | ||
* {{para|1}} or first unnamed parameter – the parameter name. Give this parameter as explicitly blank and just fill in parameter 2 when you want to show an [[Help:Templates#Parameters|unnamed parameter]] (which, depending on the context, may serve as a valueless parameter name); e.g., {{ | * {{para|1}} or first unnamed parameter – the parameter name. Give this parameter as explicitly blank and just fill in parameter 2 when you want to show an [[Help:Templates#Parameters|unnamed parameter]] (which, depending on the context, may serve as a valueless parameter name); e.g., {{tlx||para||section}} → {{para||section}} | ||
* {{para|2}} or second unnamed parameter – the value name. When the first parameter is given but is blank, the second represents an unnamed parameter's value (or a valueless parameter name), as illustrated above. | * {{para|2}} or second unnamed parameter – the value name. When the first parameter is given but is blank, the second represents an unnamed parameter's value (or a valueless parameter name), as illustrated above. | ||
* {{para|plain|y}} (or any other value besides {{kbd|y}}) – removes the faint border and light-grey background, which may be useful in various situations. The border and text color are set to {{samp|inherit}}, to use the colors of the surrounding text. This parameter cooperates with the two below, in that if either are used, the text will be colorized while the border and background will still be removed. | * {{para|plain|y}} (or any other value besides {{kbd|y}}) – removes the faint border and light-grey background, which may be useful in various situations. The border and text color are set to {{samp|inherit}}, to use the colors of the surrounding text. This parameter cooperates with the two below, in that if either are used, the text will be colorized while the border and background will still be removed. | ||
* {{para|style}} – to apply arbitrary CSS style, for some specialized contextual purpose. Example: {{para|style|background-color: Yellow;}}. Any color, background-color, or border specified here will override those provided by any of the above parameters, regardless of the order in which the parameters are given in the template. As this template uses a {{tag|span|o}} element, only CSS that can apply to inline elements (not block elements) will work. Like the above parameters, it applies to the entire output. | * {{para|style}} – to apply arbitrary CSS style, for some specialized contextual purpose. Example: {{para|style|background-color: Yellow;}}. Any color, background-color, or border specified here will override those provided by any of the above parameters, regardless of the order in which the parameters are given in the template. As this template uses a {{tag|span|o}} element, only CSS that can apply to inline elements (not block elements) will work. Like the above parameters, it applies to the entire output. | ||
** If you want to only style the parameter name and/or the value, just do so directly;<br />e.g.: <code><nowiki>{{para|page | ** If you want to only style the parameter name and/or the value, just do so directly;<br />e.g.: <code><nowiki>{{para|page|'''single''' page number}}</nowiki></code>, <code><nowiki>{{para|page'''''<u>s</u>'''''|page '''range''', or '''multiple''' individual pages, or both}}</nowiki></code><br />gives: {{para|page|'''single''' page number}}, {{para|page'''''<u>s</u>'''''|{{var|page '''range''', or '''multiple''' individual pages, or both}}}} | ||
==TemplateData== | ==TemplateData== | ||
Line 62: | Line 58: | ||
"type": "boolean" | "type": "boolean" | ||
}, | }, | ||
"style": { | "style": { | ||
"description": "Apply arbitrary CSS style, for some specialized contextual purpose.", | "description": "Apply arbitrary CSS style, for some specialized contextual purpose.", | ||
Line 75: | Line 67: | ||
} | } | ||
</templatedata> | </templatedata> | ||
<includeonly> | |||
[[Category:Templates]] | |||
</includeonly> | |||
<includeonly> | |||
[[Category: | |||
Revision as of 19:48, 21 October 2022
Template:Documentation subpage
Usage
This template is for giving examples of template parameter source code (useful in template documentation and talk page discussions of template code).
It must have at least one or two parameters itself. The first parameter is the name of the example parameter to display (this may be empty, but it must be present). The second (optional) parameter is a value for the first example parameter; or, if the first parameter is empty, the second illustrates an example unnamed parameter (which in some cases may serve as a pre-defined parameter that takes no |=value
after it, e.g. the |section
in {{Refimprove|section}}
).
Examples
Code | Result | Notes |
---|---|---|
{{para|name}}
|
|name=
|
|
{{para|title|The Oxford English Dictionary}}
|
|title=The Oxford English Dictionary
|
|
{{para| |section}}
|
|section
|
For unnamed parameters; note empty first parameter in the code |
{{para|parameter|value}}
|
value}} |
When using literal, pre-specified parameter names and values, simply provide them (as in the first through third examples above). When illustrating hypothetical/example parameter names, or variable or user-definable values, use something like {{var|parameter}}
and/or {{var|value}}
(as in the last example above).
Parameters
|1=
or first unnamed parameter – the parameter name. Give this parameter as explicitly blank and just fill in parameter 2 when you want to show an unnamed parameter (which, depending on the context, may serve as a valueless parameter name); e.g.,{{[[Template:|]]|para|section}}
→|section
|2=
or second unnamed parameter – the value name. When the first parameter is given but is blank, the second represents an unnamed parameter's value (or a valueless parameter name), as illustrated above.|plain=y
(or any other value besides Template:Kbd) – removes the faint border and light-grey background, which may be useful in various situations. The border and text color are set to Template:Samp, to use the colors of the surrounding text. This parameter cooperates with the two below, in that if either are used, the text will be colorized while the border and background will still be removed.|style=
– to apply arbitrary CSS style, for some specialized contextual purpose. Example:|style=background-color: Yellow;
. Any color, background-color, or border specified here will override those provided by any of the above parameters, regardless of the order in which the parameters are given in the template. As this template uses a Template:Tag element, only CSS that can apply to inline elements (not block elements) will work. Like the above parameters, it applies to the entire output.- If you want to only style the parameter name and/or the value, just do so directly;
e.g.:{{para|page|'''single''' page number}}
,{{para|page'''''<u>s</u>'''''|page '''range''', or '''multiple''' individual pages, or both}}
gives:|page=single page number
,|pages=Template:Var
- If you want to only style the parameter name and/or the value, just do so directly;
TemplateData
Gives examples of template parameter source code
Parameter | Description | Type | Status | |
---|---|---|---|---|
Parameter name | 1 | The parameter name. Give this parameter as explicitly blank and just fill in parameter 2 when you want to show an unnamed parameter | String | suggested |
Value name | 2 | The value name. When the first parameter is given but is blank, the second represents an unnamed parameter's value (or a valueless parameter name). | String | suggested |
plain | plain | Removes the faint border and light-grey background | Boolean | optional |
style | style | Apply arbitrary CSS style, for some specialized contextual purpose.
| Content | optional |