Шаблон:= — различия между версиями

Материал из WOG Wiki
Перейти к: навигация, поиск
(Новая страница: «=<noinclude> == Usage == Use to transclude the equals symbol into template parameters, where the normal use of the symbol would provoke the parsing of the paramet…»)
 
 
Строка 1: Строка 1:
=<noinclude>
+
<includeonly>=</includeonly><noinclude>{{Doc/Template
== Usage ==
+
|descr= Use to transclude the equals symbol into template parameters, where the normal use of the symbol would provoke the parsing of the parameter's text, assigning the text to the right of the symbol as the value of a variable named by the text to the left.
Use to transclude the equals symbol into template parameters, where the normal use of the symbol would provoke the parsing of the parameter's text, assigning the text to the right of the symbol as the value of a variable named by the text to the left.
 
  
i.e. {{ic|<nowiki>{{ic|_foo = true;}}</nowiki>}} would result in a transclusion of {{Template|Inline code}} (and/or other similar templates) with the value {{ic|true;}} assigned to a variable called {{ic|_foo}} because of the way MediaWiki parses Template code. So we use {{ic|<nowiki>{{ic|_foo {{=}} true;}}</nowiki>}} in order to stop the equals sign being parsed as an assignation. Thus {{ic|<nowiki>{{ic|_foo {{=}} true;}}</nowiki>}} results in the desired {{ic|_foo {{=}} true;}}.
+
e.g {{hl|<nowiki>{{hl|_foo = true;}}</nowiki>}} tells the wiki "use the {{Template|hl}} template with {{hl|_foo}} parameter using {{hl|true}} as an argument". Using {{Template|{{=}}}} solves this issue.
  
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
+
{{Feature|informative|Another quick solution to solve the equals issue would be telling the wiki that the first (1) argument is our content: {{hl|<nowiki>{{hl|1= _foo = true;}}</nowiki>}}.}}
</noinclude>
+
 
 +
|example1= <nowiki>{{=}}</nowiki>
 +
|result1= {{=}}
 +
 
 +
}}</noinclude>

Текущая версия на 11:50, 30 июля 2022