Difference between revisions of "Template:=/doc"

From Yugipedia
Jump to: navigation, search
(See also: update)
m (1 revision imported: mass import/update of Wikipedia stuff)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{documentation subpage}}
+
{{Documentation subpage}}
<!--  
+
{{transclusionless|reason=it was replaced with a [[Help:Magic words|magic word]]}}
    PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE
+
<!-- Please add categories at the bottom of this page, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
    YOU CAN EDIT THE TEMPLATE DOCUMENTATION BELOW THIS COMMENT
+
This magic word allows "=" to be used in unnamed template parameters, rather than being interpreted as the separator between the parameter name and value. It evaluates to the equals sign, =. Alternatively, the [[HTML]] entity "&amp;#61;" can be used if there is no need for it to be interpreted as wikimarkup, such as when the literal equals-sign is to be displayed to the user. Until June 2022, there was a template at this location with the same function, but it was replaced with a magic word for performance reasons in [[Phab:T91154]].
-->
 
==Usage==
 
  
This template allows "<code>=</code>" to be used in template parameters.  
+
Do not use syntax like <code><nowiki>{{Template:=}}</nowiki></code>, and do not supply a parameter, for example <code><nowiki>{{=|foo}}</nowiki></code>. In those cases, the template transcludes as an error message: {{!xt|Error: The retired template <nowiki>{{=}}</nowiki> has been transcluded; see mw:Help:Magic words#Other for details. To fix this, use only the code <nowiki>{{=}}</nowiki> to generate the &#61; character.}}
  
This template cannot be [[WP:SUBST|substituted]].
+
Do not use the magic word in URLs rather use [[percent-encoding]] or no encoding:
 +
*Wrong: <code><nowiki>https://example.com/?arg{{=}}789</nowiki></code>
 +
*Correct: <code><nowiki>https://example.com/?arg%3D789</nowiki></code>
 +
*Correct: <code><nowiki>https://example.com/?arg=789</nowiki></code>
  
==Example==
+
== Usage ==
 +
* <code><nowiki>{{Font color|black|yellow|2 + 2 {{=}} 4}}</nowiki></code> produces: {{Font color|black|yellow|2 + 2 {{=}} 4}}
  
*<code><nowiki>{{Colors|black|yellow|2 + 2 {{=}} 4}}</nowiki></code> {{Arrow}} {{Colors|black|yellow|2 + 2 {{=}} 4}}
+
You can also use named parameters to bypass the restriction:
 +
* <code><nowiki>{{Font color|black|yellow|3= 2 + 2 = 4}}</nowiki></code> produces: {{Font color|black|yellow|3= 2 + 2 = 4}}
 +
 
 +
Unlike <code>&amp;#61;</code>, the magic word only delays the interpretation of the symbol as code:
 +
<syntaxhighlight lang="html">
 +
{{concat|<div style{{=}}"font-style:italic">This should be italicised.</div>}}
 +
{{concat|<div style&#61;"font-style:italic">This will not be italicised.</div>}}
 +
</syntaxhighlight>
 +
produces:
 +
{{concat|<div style{{=}}"font-style:italic">This should be italicised.</div>}}
 +
{{concat|<div style&#61;"font-style:italic">This will not be italicised.</div>}}
 +
 
 +
== TemplateData ==
 +
{{TemplateData header}}
 +
<templatedata>
 +
{
 +
"description": "A magic word to allow = to be used in template parameters",
 +
"params": {},
 +
"format": "{{_\n| _ = _\n}}"
 +
}
 +
</templatedata>
  
 
== See also ==
 
== See also ==
* [[Template:!/doc]]
+
{{Escape template list}}
 +
* [[Template:Spaces]]
 +
* [[mw:Help:Magic words]]
  
<includeonly>
+
<includeonly>{{sandbox other||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANKS. -->
+
<!-- Add categories below this line, and interwikis at Wikidata -->
[[Category:Character escape templates|{{PAGENAME}}]]
+
[[Category:Character-substitution templates]]
</includeonly>
+
[[Category:Template namespace templates]]
 +
[[Category:Mathematical formatting templates]]
 +
}}</includeonly>

Latest revision as of 23:40, 1 April 2023

This magic word allows "=" to be used in unnamed template parameters, rather than being interpreted as the separator between the parameter name and value. It evaluates to the equals sign, =. Alternatively, the HTML entity "&#61;" can be used if there is no need for it to be interpreted as wikimarkup, such as when the literal equals-sign is to be displayed to the user. Until June 2022, there was a template at this location with the same function, but it was replaced with a magic word for performance reasons in Phab:T91154.

Do not use syntax like {{Template:=}}, and do not supply a parameter, for example {{=|foo}}. In those cases, the template transcludes as an error message: Error: The retired template {{=}} has been transcluded; see mw:Help:Magic words#Other for details. To fix this, use only the code {{=}} to generate the = character.

Do not use the magic word in URLs rather use percent-encoding or no encoding:

  • Wrong: https://example.com/?arg{{=}}789
  • Correct: https://example.com/?arg%3D789
  • Correct: https://example.com/?arg=789

Usage[edit]

  • {{Font color|black|yellow|2 + 2 {{=}} 4}} produces: 2 + 2 = 4

You can also use named parameters to bypass the restriction:

  • {{Font color|black|yellow|3= 2 + 2 = 4}} produces: 2 + 2 = 4

Unlike &#61;, the magic word only delays the interpretation of the symbol as code:

{{concat|<div style{{=}}"font-style:italic">This should be italicised.</div>}}
{{concat|<div style&#61;"font-style:italic">This will not be italicised.</div>}}

produces:

This should be italicised.
This will not be italicised.

TemplateData[edit]

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for =

<templatedata> { "description": "A magic word to allow = to be used in template parameters", "params": {}, "format": "Template:\n" } </templatedata>

See also[edit]

Template call
(m for magic word)
Output (delayed interpretation as wikimarkup) HTML alternative (never interpreted as wikimarkup)
{{!}} (m) | &#124; or {{pipe}}
{{}} (m) = &#61;
{{!!}} || &#124;&#124;
{{!(}} [ &#91;
{{)!}} ] &#93;
{{!((}} [[ &#91;&#91;
{{))!}} ]] &#93;&#93;
{{(}} { &#123;
{{)}} } &#125;
{{((}} {{ &#123;&#123;
{{))}} }} &#125;&#125;
{{(((}} {{{ &#123;&#123;&#123;
{{)))}} }}} &#125;&#125;&#125;
{{(!}} {| &#123;&#124;
{{!-}} |- &#124;&#45;
{{!)}} |} &#124;&#125;