Template:Para/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "{{Documentation subpage}} __NOTOC__ ==Usage== {{tlf|'''para'''}} is designed for giving examples of template parameter code, e.g. for use in template documentation or instruct...")
 
(Updated the info.)
 
(6 intermediate revisions by the same user not shown)
Line 5: Line 5:


==Parameters==
==Parameters==
There are 4 parameters, of which 2 are unnamed and 2 are named. All four parameters are optional.
There are 5 parameters, of which 2 are unnamed and 3 are named. All five parameters are optional.


===Syntax===
===Syntax===
The template's syntax is
The template's syntax is
* {{tlc|para|''parameter'' |''value'' |equal{{=}}yes |plain{{=}}yes }}
* {{tlc|para|''parameter'' |''value'' |serif{{=}}yes |equal{{=}}yes |plain{{=}}yes }}


By default, the two toggle parameters, {{code|equal}} and {{code|plain}}, are not used. They can only be invoked by explicitly setting them to the value {{samp|''yes''}}. Any other value will keep them switched off.
By default, the three toggle parameters, {{para|serif}}, {{para|equal}} and {{para|plain}}, are not used. They can only be invoked by explicitly setting them to the value {{samp|''yes''}}. Any other value will keep them switched off.


===Optional parameters===
===Optional parameters===
Line 22: Line 22:
*# ''with text'': shows the entered text as the parameter name;
*# ''with text'': shows the entered text as the parameter name;
*# ''empty'': (by entering two vertical lines; '''NB!''' This is not the same as simply skipping the parameter; see the examples) shows the value, if entered, as if for an unnamed parameter; or
*# ''empty'': (by entering two vertical lines; '''NB!''' This is not the same as simply skipping the parameter; see the examples) shows the value, if entered, as if for an unnamed parameter; or
*# ''with {{tn|!}}'': gives the illusion of empty parameter input (see the examples), will show any entered text as a parameter name. Can be used with either of the two ways described above.
*# ''with {{code|&124;}}'': gives the illusion of empty parameter input (see the examples), will show any entered text as a parameter name. Can be used with either of the two ways described above.
* Can be wiki-formatted.
* Can be wiki-formatted.
* Must be placed '''before''' the 2nd unnamed parameter.
* Must be placed '''before''' the 2nd unnamed parameter.
Line 35: Line 35:
;Notes
;Notes
* This parameter can be used in three ways:
* This parameter can be used in three ways:
*# ''{{code|1}} filled in'': shows the parameter value after the parameter name, and following an equals sign;
*# ''1st parameter filled in'': shows the parameter value after the parameter name, and following an equals sign;
*# ''{{code|1}} empty'': (see above) shows the value without a preceding equals sign, as if for an unnamed parameter; or
*# ''1st parameter empty'': (see above) shows the value without a preceding equals sign, as if for an unnamed parameter; or
*# ''skipped'': only the parameter name will be displayed (if entered).
*# ''skipped'': only the parameter name will be displayed (if entered).
* Can be wiki-formatted, with one exception: italic output is preset, and cannot be changed.
* Can be wiki-formatted, with one exception: italic output is preset, and cannot be changed.
Line 43: Line 43:
;Usage
;Usage
* {{tlc|para|1|<big>'''2'''</big>}}
* {{tlc|para|1|<big>'''2'''</big>}}
====serif====
;<big>Value output in serif font</big>
You can override the default output styling for the ''parameter value'' parameter ({{para|2}}), by using this parameter. The output will style the output using {{tlf|varserif}}, instead of the default meta-template, {{tlf|var}}.
By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value {{samp|''yes''}}. Any other value will keep it switched off.
;Notes
* This parameter only affects the look of parameter {{code|2}} (the ''parameter value'').
;Usage
* {{tlc|para|1|2|<big>'''serif'''{{=}}''yes''</big>}}


====equal====
====equal====
Line 51: Line 63:


;Notes
;Notes
* This parameter only works when the parameter name ({{code|1}}) is entered '''without being followed by a parameter value''' (i.e. not entering anything for the ''parameter value'' parameter, {{code|2}}).
* This parameter only works when the parameter name ({{code|1}}) is entered '''without being followed by a parameter value''' (i.e. not entering anything for the ''parameter value'' parameter, {{para|2}}).
* If the ''parameter value'' parameter ({{code|2}}) is defined, it will have precedence over {{code|equal}}.
* If the ''parameter value'' parameter ({{code|2}}) is defined, it will have precedence over {{para|equal}}.


;Usage
;Usage
Line 59: Line 71:
====plain====
====plain====
;<big>Plain text styling</big>
;<big>Plain text styling</big>
You can override the default output styling by using this parameter. The output will inherit the CSS value for {{code|background-color}} and set {{code|border}} to {{samp|none}}.
You can override the default output styling, by using this parameter. The output will inherit the CSS value for {{code|background-color}} and set {{code|border}} to {{samp|none}}.


By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value {{samp|''yes''}}. Any other value will keep it switched off.
By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value {{samp|''yes''}}. Any other value will keep it switched off.
Line 67: Line 79:


==Examples==
==Examples==
For some reason, the output
{| class="wikitable" style="background-color: white;"
{| class="wikitable" style="background-color: white;"
|-
|-
! Case !! What you type !! What you see
! Case !! What you type !! What you see
|-
| No parameters || {{tlc|para}} || {{para}}
|-
|-
| Basic use || {{tlc|para|parameter|value}} || {{para|parameter|value}}
| Basic use || {{tlc|para|parameter|value}} || {{para|parameter|value}}
Line 76: Line 89:
| Only parameter || {{tlc|para|parameter}} || {{para|parameter}}
| Only parameter || {{tlc|para|parameter}} || {{para|parameter}}
|-
|-
| {{code|equal}} || {{tlc|para|parameter|equal{{=}}yes}} || {{para|parameter|equal=yes}}
| Only value || {{tlc|para||value}} || {{para||value}}
|-
| {{para|serif}}
| {{tlc|para|parameter|value|serif{{=}}yes}}
| {{para|parameter|value|serif=yes}}
|-
| {{para|equal}}
| {{tlc|para|parameter|equal{{=}}yes}}
| {{para|parameter|equal=yes}}
|-
|-
| Only value || {{tlc|para||value}} || {{para||value}}
| {{para|plain}}
| {{tlc|para|parameter|value|plain{{=}}yes}}
| {{para|parameter|value|plain=yes}}
|-
| {{para|serif}} and {{para|plain}}
| {{tlc|para|parameter|value|serif{{=}}yes|plain{{=}}yes}}
| {{para|parameter|value|serif=yes|plain=yes}}
|-
|-
| {{code|plain}} || {{tlc|para|parameter|value|plain{{=}}yes}} || {{para|parameter|value|plain=yes}}
| rowspan="4" | Using {{code|&amp;#124;}} || <code><nowiki>{{para|&amp;#124;parameter|value}}</nowiki></code> || {{para|&#124;parameter|value}}
|-
|-
| rowspan="4" | Using {{tlf|&#33;}} || <code><nowiki>{{para|{{!}}parameter|value}}</nowiki></code> || {{para|{{!}}parameter|value}}
| <code><nowiki>{{para|&amp;#124;parameter}}</nowiki></code> || {{para|&#124;parameter}}
|-
|-
| <code><nowiki>{{para|{{!}}parameter}}</nowiki></code> || {{para|{{!}}parameter}}
| <code><nowiki>{{para||&amp;#124;value}}</nowiki></code> || {{para||&#124;value}}
|-
|-
| <code><nowiki>{{para||{{!}}value}}</nowiki></code> || {{para||{{!}}value}}
| <code><nowiki>{{para|&amp;#124;}}</nowiki></code> || {{para|&#124;}}
|-
|-
| <code><nowiki>{{para|{{!}}}}</nowiki></code> || {{para|{{!}}}}
| Wiki-formatting || {{tlc|para|<nowiki>You ''can'' '''use'''|{{sup|wiki}} <big>markup</big></nowiki>}} || {{para|You ''can'' '''use'''|{{sup|wiki}} <big>markup</big>}}
|}
|}



Latest revision as of 12:34, 5 January 2015

Edit-copy green.svg
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

{{para}} is designed for giving examples of template parameter code, e.g. for use in template documentation or instructional texts.

Parameters

There are 5 parameters, of which 2 are unnamed and 3 are named. All five parameters are optional.

Syntax

The template's syntax is

  • {{para|parameter |value |serif=yes |equal=yes |plain=yes }}

By default, the three toggle parameters, |serif, |equal and |plain, are not used. They can only be invoked by explicitly setting them to the value yes. Any other value will keep them switched off.

Optional parameters

1

Parameter name

The parameter you want to describe.

Notes
  • This parameter can be used in three ways:
    1. with text: shows the entered text as the parameter name;
    2. empty: (by entering two vertical lines; NB! This is not the same as simply skipping the parameter; see the examples) shows the value, if entered, as if for an unnamed parameter; or
    3. with &124;: gives the illusion of empty parameter input (see the examples), will show any entered text as a parameter name. Can be used with either of the two ways described above.
  • Can be wiki-formatted.
  • Must be placed before the 2nd unnamed parameter.
Usage
  • {{para|1}}

2

Parameter value

A value for the parameter.

Notes
  • This parameter can be used in three ways:
    1. 1st parameter filled in: shows the parameter value after the parameter name, and following an equals sign;
    2. 1st parameter empty: (see above) shows the value without a preceding equals sign, as if for an unnamed parameter; or
    3. skipped: only the parameter name will be displayed (if entered).
  • Can be wiki-formatted, with one exception: italic output is preset, and cannot be changed.
  • Must be placed after the 1st unnamed parameter.
Usage
  • {{para|1|2}}

serif

Value output in serif font

You can override the default output styling for the parameter value parameter (|2), by using this parameter. The output will style the output using {{varserif}}, instead of the default meta-template, {{var}}.

By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value yes. Any other value will keep it switched off.

Notes
  • This parameter only affects the look of parameter 2 (the parameter value).
Usage
  • {{para|1|2|serif=yes}}

equal

Insert equals sign

Inserts an equals sign after the parameter name when no value has been specified.

By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value yes. Any other value will keep it switched off.

Notes
  • This parameter only works when the parameter name (1) is entered without being followed by a parameter value (i.e. not entering anything for the parameter value parameter, |2).
  • If the parameter value parameter (2) is defined, it will have precedence over |equal.
Usage
  • {{para|1|equal=yes}}

plain

Plain text styling

You can override the default output styling, by using this parameter. The output will inherit the CSS value for background-color and set border to none.

By default, this parameter isn't used. It can only be invoked by explicitly setting it to the value yes. Any other value will keep it switched off.

Usage
  • {{para|1|2|plain=yes}}

Examples

Case What you type What you see
No parameters {{para}} |
Basic use {{para|parameter|value}} |parameter=value
Only parameter {{para|parameter}} |parameter
Only value {{para||value}} |value
|serif {{para|parameter|value|serif=yes}} |parameter=value
|equal {{para|parameter|equal=yes}} |parameter=
|plain {{para|parameter|value|plain=yes}} |parameter=value
|serif and |plain {{para|parameter|value|serif=yes|plain=yes}} |parameter=value
Using &#124; {{para|&#124;parameter|value}} ||parameter=value
{{para|&#124;parameter}} ||parameter
{{para||&#124;value}} ||value
{{para|&#124;}} ||
Wiki-formatting {{para|You ''can'' '''use'''|{{sup|wiki}} <big>markup</big>}} |You can use=wiki markup

See also

  • {{code}}: inserts HTML <code> tags.
  • {{samp}}: inserts HTML <samp> tags.
  • {{var}}: inserts HTML <var> tags; {{var}} is used in {{para}} to display the parameter value.
  • {{varserif}}: inserts HTML <var> tags with serif font styling.