Difference between revisions of "Template:Braces/doc"

From blackwiki
Jump to navigation Jump to search
imported>Sardanaphalus
(categories from template page)
imported>Sardanaphalus
(update)
Line 1: Line 1:
{{documentation subpage}}
+
{{Documentation subpage}}
 +
* 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 <code>&amp;#123;{foo}&amp;#125;</code>.
 +
* Set {{para|code}}"on", "true", etc to switch the font used to the HTML <nowiki><code></nowiki>-style monospaced font.
 +
* To improve legibility, {{tl|thinsp}}aces are inserted either side of any [[Vertical bar|pipe character]]s ("{{thinsp}}|{{thinsp}}") displayed by the template.
 +
* To ensure equals-signs are handled as text by the template, use {{tlspc|{{=}}}} to produce them&nbsp;– e.g. {{tlc|braces|Templatename|p1{{=}}v1|p2{{=}}v2|...}} (and see examples below).
  
* 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.
+
===Examples===
* An alternative is to use <tt>&amp;#123;{foo}&amp;#125;</tt>.
+
: <code><nowiki>{{braces|Templatename|item1|item2}}</nowiki></code> → {{braces|Templatename|item1|item2}}
* 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.
+
: <code><nowiki>{{braces|code=on |Templatename|item1|item2}}</nowiki></code> → {{braces|code=on |Templatename|item1|item2}}
:[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.]
+
Using {{tlspc|=}} to produce equals-signs:
* To improve legibility a 'thin-space' is inserted on each side of the pipe character '|' when displayed in transclusion.
+
: <code><nowiki>{{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}</nowiki></code> → {{braces|code=on |Templatename|item1{{=}}XYZ|item2{{=}}PQR}}
* If detailing a template which requires 'named-variable = ....',  use {{((}}={{))}} for the equals sign
+
Not using {{tlspc|{{=}}}} to produce equals-signs (incorrect):
;Examples
+
: {{cross|15}} <code><nowiki>{{braces|code=on |Templatename|item1=XYZ|item2=PQR}}</nowiki></code> → {{braces|code=on |Templatename|item1=XYZ|item2=PQR}}
:<nowiki>{{braces|template-name|value1|value2}}</nowiki> gives  {{braces|template-name|value1|value2}}<br/>
 
:<nowiki>{{braces|tt=y|template-name|value1|value2}}</nowiki> gives  {{braces|tt=y|template-name|value1|value2}}<br/>
 
:<nowiki>{{braces|tt=y|template-name|value1{{=}}XYZ|value2{{=}}PQR}}</nowiki> gives  {{braces|tt=y|template-name|value1{{=}}XYZ|value2{{=}}PQR}}<br/>
 
BUT
 
:<nowiki>{{braces|tt=y|template-name|value1=XYZ|value2=PQR}}</nowiki> gives  {{braces|tt=y|template-name|value1=XYZ|value2=PQR}}
 
  
 
== See also ==
 
== See also ==
* {{tl|Brackets}}
+
* {{tl|brackets}}
* {{tl|Nowiki}}
+
* {{tl|nowiki}}
* {{tl|Mono}} monospaced font
+
* {{tl|mono}}
* {{tl|Ttt}} {{tag|tt}} tags
+
<!--Now deprecated?: * {{tl|Ttt}} {{tag|tt}} tags-->
  
 
<includeonly>
 
<includeonly>

Revision as of 11:43, 16 July 2014

  • 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;{foo}&#125;.
  • Set |code="on", "true", etc to switch the font used to the HTML <code>-style monospaced font.
  • To improve legibility, {{thinsp}}aces are inserted either side of any pipe characters ("Template:Thinsp|Template:Thinsp") displayed by the template.
  • To ensure equals-signs are handled as text by the template, use Template:Tlspc to produce them – e.g. {{braces|Templatename|p1=v1|p2=v2|...}} (and see examples below).

Examples

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

Using Template:Tlspc to produce equals-signs:

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

Not using Template:Tlspc to produce equals-signs (incorrect):

  1. REDIRECT Template:Xmark

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

See also