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...")
 
Line 67: Line 67:


==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}}

Revision as of 15:59, 17 December 2014

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 4 parameters, of which 2 are unnamed and 2 are named. All four parameters are optional.

Syntax

The template's syntax is

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

By default, the two toggle parameters, 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 {{!}}: 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. 1 filled in: shows the parameter value after the parameter name, and following an equals sign;
    2. 1 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}}

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
equal {{para|parameter|equal=yes}} |parameter=
Only value {{para||value}} |value
plain {{para|parameter|value|plain=yes}} |parameter=value
Using {{!}} {{para|{{!}}parameter|value}} parameter=value
{{para|{{!}}parameter}} parameter
{{para||{{!}}value}} value
{{para|{{!}}}}

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.