Template:Para: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "<code><nowiki>|</nowiki>{{#if:{{{1|}}}|<span style="white-space:nowrap;">{{{1}}}</span><nowiki>=</nowiki>|}}{{{2|}}}</code><noinclude> {{Documentation}} <!--Categories and int...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<code><nowiki>|</nowiki>{{#if:{{{1|}}}|<span style="white-space:nowrap;">{{{1}}}</span><nowiki>=</nowiki>|}}{{{2|}}}</code><noinclude>
<code>&#124;{{#if:{{{}}}|{{#if:{{{1<includeonly>|</includeonly>}}}|{{{1}}}=}}{{{2<includeonly>|</includeonly>}}}|={{{1|}}}}}</code><!--
{{Documentation}}
 
-->{{#if:{{{3|}}}<!--
-->|&nbsp;({{#if:{{{req|}}}|'''''required''''',&nbsp;}}{{#if:{{{opt|}}}|''optional'',&nbsp;}}{{{3}}})<!--
-->|{{#if:{{{req|}}}|&nbsp;('''''required''''')}}{{#if:{{{opt|}}}|&nbsp;(''optional'')}}<!--
-->}}<!--
 
--><noinclude>{{Documentation}}
<!--Categories and interwikis go near the bottom of the /doc subpage.-->
<!--Categories and interwikis go near the bottom of the /doc subpage.-->
[[Category:Templates]][[Category:Functionality]]
[[Category:Templates]][[Category:Functionality]]
</noinclude>
</noinclude>

Latest revision as of 11:50, 18 June 2023

|{{{1}}}={{{2}}}


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

  1. {{para|name}}
    Result: |name=
  2. {{para|name|req=1}}
    Result: |name= (required)
  3. {{para|name|opt=1}}
    Result: |name= (optional)
  4. {{para|opt|1}}
    Result: |opt=1
  5. {{para|title|<var>book title</var>}}
    Result: |title=book title
  6. {{para||section}}
    Result: |section. This is useful for referring to values of unnamed parameters; note the empty first parameter in the template call.
  7. {{para|<var>parameter</var>|<var>value</var>}}
    Result: |parameter=value
  8. {{para|=|foo}}
    Result: |=foo
  9. {{para|2||''optional'' if first parameter is present}}
    Result: |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 <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