Difference between revisions of "Template:Braces/doc"

From blackwiki
Jump to navigation Jump to search
imported>Meteor sandwich yum
(-Regbraces, which will be deleted)
imported>Andrybak
 
(25 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{documentation subpage}}
+
{{Documentation subpage}}
* The template returns the first unnamed parameter in double braces. To be used to demonstrate template code without the need for clunky nowiki'ing. Further unnamed parameters (up to 8 more) can be used without worrying for pipes.
+
 
* An alternative is to use <tt>&amp;#123;{foo}&amp;#125;</tt>.
+
* This template returns the first unnamed parameter in double braces. To be used to demonstrate template code without the need for clunky nowiki'ing. Further unnamed parameters (up to 8 more) can be used without worrying for pipes.
* If the parameter '''tt''' (short for 'teletype', an early mono-spaced font) is set equal to any value apart from the null string, the font becomes a mono-spaced type which may be useful when displaying syntax format.
+
* An alternative is to use <code>&amp;#123;{some text}&amp;#125;</code>.
:[Note &ndash; This may well be changed to the specific setting, "'''tt'''= y" to reduce potential clashes if a template uses the named parameter '''tt''' for something else. This setting should therefore be used to ensure compatibility with future changes.]
+
* Set {{mono|code{{=}}on}}{{\}}{{mono|code{{=}}true}}{{\}}etc. to switch the font used to the HTML <nowiki><code></nowiki>-style monospaced font.
* To improve legibility a 'thin-space' is inserted on each side of the pipe character '|' when displayed in transclusion.
+
* To improve legibility, {{tl|thin space}}s are inserted either side of any [[Vertical bar|pipe character]]s ("{{thin space|{{!}}}}") displayed by the template.
* If detailing a template which requires 'named-variable = ....',  use {{((}}={{))}} for the equals sign
+
* To ensure equals-signs are handled as text by the template, use {{tl|{{=}}}} to produce them&nbsp;– e.g. <code><nowiki>{{braces|Templatename|p1{{=}}v1|p2{{=}}v2|...}}</nowiki></code> (and see examples below).
;Examples
+
 
:<nowiki>{{braces|template-name|value1|value2}}</nowiki> gives  {{braces|template-name|value1|value2}}<br/>
+
===Examples===
:<nowiki>{{braces|tt=y|template-name|value1|value2}}</nowiki> gives  {{braces|tt=y|template-name|value1|value2}}<br/>
+
{{Markup
:<nowiki>{{braces|tt=y|template-name|value1{{=}}XYZ|value2{{=}}PQR}}</nowiki> gives  {{braces|tt=y|template-name|value1{{=}}XYZ|value2{{=}}PQR}}<br/>
+
| col2 = Output
BUT
+
 
:<nowiki>{{braces|tt=y|template-name|value1=XYZ|value2=PQR}}</nowiki> gives  {{braces|tt=y|template-name|value1=XYZ|value2=PQR}}
+
| <nowiki>{{braces|Templatename|item1|item2}}</nowiki>
 +
| {{braces|Templatename|item1|item2}}
 +
 
 +
| <nowiki>{{braces|code=on |Templatename|item1|item2}}</nowiki>
 +
| {{braces|code=on |Templatename|item1|item2}}
 +
 
 +
| <nowiki>{{braces |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}</nowiki>
 +
| {{braces |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}
 +
 
 +
| <nowiki>{{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}</nowiki>
 +
| {{braces |code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}
 +
 
 +
}}
 +
 
 +
Note that omitting the double-braces around the equals signs in the last two examples does not work as intended:
 +
{{Markup
 +
| col2 = Output
 +
 
 +
| <nowiki>{{braces |Templatename|item1=XYZ|item2=PQR}}</nowiki>
 +
| {{braces |Templatename|item1=XYZ|item2=PQR}}
 +
 
 +
| <nowiki>{{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}</nowiki>
 +
| {{braces |code=on |Templatename|item1=XYZ|item2=PQR}}
 +
 
 +
}}
  
 
== See also ==
 
== See also ==
* {{tl|Brackets}}
+
* {{tl|brackets}}
* {{tl|Nowiki}}
+
* {{tl|nowiki}}
* {{tl|Mono}} monospaced font
+
* {{tl|mono}}
* {{tl|Ttt}} {{tag|tt}} tags
+
* {{tl|mset}}
 +
<!--[Now deprecated?:] * {{tl|Ttt}} {{tag|tt}} tags.-->
 +
 
 +
<includeonly>{{Sandbox other||
 +
[[Category:Character-substitution templates]]
 +
[[Category:Wikitext typing-aid templates]]
 +
}}</includeonly>

Latest revision as of 05:10, 3 October 2020

  • This template returns the first unnamed parameter in double braces. To be used to demonstrate template code without the need for clunky nowiki'ing. Further unnamed parameters (up to 8 more) can be used without worrying for pipes.
  • An alternative is to use &#123;{some text}&#125;.
  • Set code=on / code=true / etc. to switch the font used to the HTML <code>-style monospaced font.
  • To improve legibility, {{thin space}}s are inserted either side of any pipe characters ("| ") displayed by the template.
  • To ensure equals-signs are handled as text by the template, use {{=}} to produce them – e.g. {{braces|Templatename|p1{{=}}v1|p2{{=}}v2|...}} (and see examples below).

Examples

Markup Output
{{braces|Templatename|item1|item2}}

{{Templatename|item1|item2}}

{{braces|code=on |Templatename|item1|item2}}

{{Templatename|item1|item2}}

{{braces |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}

{{Templatename|item1=XYZ|item2=PQR}}

{{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}

{{Templatename|item1=XYZ|item2=PQR}}

Note that omitting the double-braces around the equals signs in the last two examples does not work as intended:

Markup Output
{{braces |Templatename|item1=XYZ|item2=PQR}}

{{Templatename}}

{{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}

{{Templatename}}

See also