Template:Para/doc: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> == Usage == This template is for giving examples of [[Wikipedia:Template me...") |
No edit summary |
||
Line 1: | Line 1: | ||
{{ | {{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 | This template simply displays a parameter name between a vertical line and an equal sign, as is seen in [[wikt:Wiktionary:Templates|template]] calls. (This is useful in template documentation and in talk page discussions of templates.) | ||
===Parameters=== | |||
This template takes the following parameters: | |||
*{{para|1||''may be empty'' if second parameter is present}}: the name of the parameter | |||
*{{para|2||''optional'' if first parameter is present}}: a corresponding value for the parameter | |||
*{{para|3|opt=1}}: additional usage text | |||
*{{para|req|1}}: indicate that the parameter is required | |||
*{{para|opt|1}}: indicate that the parameter is optional | |||
===Examples=== | ===Examples=== | ||
# | # {{temp|para|name}} | ||
#: | #: Result: {{para|name}} | ||
#:{{para|name}} | # {{temp|para|name|req=1}} | ||
# | #: Result: {{para|name|req=1}} | ||
#: | # {{temp|para|name|opt=1}} | ||
#:{{para|title|<var>book title</var>}} | #: Result: {{para|name|opt=1}} | ||
# | # {{temp|para|opt|1}} | ||
# | #: Result: {{para|opt|1}} | ||
#:{{para||section}} | # {{temp|para|title|<nowiki><var>book title</var></nowiki>}} | ||
#: Result: {{para|title|<var>book title</var>}} | |||
# | # {{temp|para||section}} | ||
#: | #: Result: {{para||section}}. This is useful for referring to values of unnamed parameters; note the empty first parameter in the template call. | ||
# {{temp|para|<nowiki><var>parameter</var></nowiki>|<nowiki><var>value</var></nowiki>}} | |||
#: Result: {{para|<var>parameter</var>|<var>value</var>}} | |||
# {{temp|para|=|foo}} | |||
#: Result: {{para|=|foo}} | |||
# {{temp|para|2||<nowiki>''optional'' if first parameter is present</nowiki>}} | |||
#: Result: {{para|2||''optional'' if first parameter is present}} | |||
When using literal, pre-specified values, simply provide the value (appearance as in example 6). When illustrating hypothetical, variable or user-definable values, use <code><var>value</var></code> (appearance as in example 5), and the same should be done for non-literal, example parameters (as in example 7). | |||
== See also == | == See also == | ||
* [[Template: | * [[Template:tlx]] – for providing examples of entire-template code with included parameters | ||
<noinclude> | <noinclude>[[Category:Templates]][[Category:Template documentation]]</noinclude> | ||
[[Category:Templates]][[Category:Template documentation]]</noinclude> |
Revision as of 11:56, 18 June 2023
This is a documentation subpage for Template:Para. It contains usage information, categories and other content that is not part of the original template page. |
Usage
This template simply displays a parameter name between a vertical line and an equal sign, as is seen in template calls. (This is useful in template documentation and in talk page discussions of templates.)
Parameters
This template takes the following parameters:
|1=
(may be empty if second parameter is present): the name of the parameter|2=
(optional if first parameter is present): a corresponding value for the parameter|3=
(optional): additional usage text|req=1
: indicate that the parameter is required|opt=1
: indicate that the parameter is optional
Examples
{{para|name}}
- Result:
|name=
- Result:
{{para|name|req=1}}
- Result:
|name=
(required)
- Result:
{{para|name|opt=1}}
- Result:
|name=
(optional)
- Result:
{{para|opt|1}}
- Result:
|opt=1
- Result:
{{para|title|<var>book title</var>}}
- Result:
|title=book title
- Result:
{{para||section}}
- Result:
|section
. This is useful for referring to values of unnamed parameters; note the empty first parameter in the template call.
- Result:
{{para|<var>parameter</var>|<var>value</var>}}
- Result:
|parameter=value
- Result:
{{para|=|foo}}
- Result:
|=foo
- Result:
{{para|2||''optional'' if first parameter is present}}
- Result:
|2=
(optional if first parameter is present)
- Result:
When using literal, pre-specified values, simply provide the value (appearance as in example 6). When illustrating hypothetical, variable or user-definable values, use <var>value</var>
(appearance as in example 5), and the same should be done for non-literal, example parameters (as in example 7).
See also
- Template:tlx – for providing examples of entire-template code with included parameters