Template:!/Doc: Difference between revisions

30 bytes added ,  28 June 2012
(documentation for the {{!}} template)
 
(→‎Comparison with {{pipe}}: fix section title)
Line 19: Line 19:
* {{Codeline|if (nargin > 2 {{!}}{{!}} nargin < 5), print_usage; endif}}
* {{Codeline|if (nargin > 2 {{!}}{{!}} nargin < 5), print_usage; endif}}


== Comparison with {{pipe}} ==
== Comparison with {{Codeline|<nowiki>{{pipe}}</nowiki>}} ==


{{Codeline|<nowiki>{{pipe}}</nowiki>}} is not a duplicate of {{Codeline|<nowiki>{{!}}</nowiki>}}. These are two different templates with very different functionality. {{Codeline|<nowiki>{{pipe}}</nowiki>}} inserts the code {{Codeline|&amp;#124;}}, which does render as a pipe in the web browsers. But it does not interfere with the MediaWiki parser. Thus it can be used in text inside wikitables and parserfunctions without causing any altered function of them. {{Codeline|<nowiki>{{!}}</nowiki>}} inserts an actual pipe character that is parsed by the MediaWiki parser. Thus it does have effect inside wikitables.
{{Codeline|<nowiki>{{pipe}}</nowiki>}} is not a duplicate of {{Codeline|<nowiki>{{!}}</nowiki>}}. These are two different templates with very different functionality. {{Codeline|<nowiki>{{pipe}}</nowiki>}} inserts the code {{Codeline|&amp;#124;}}, which does render as a pipe in the web browsers. But it does not interfere with the MediaWiki parser. Thus it can be used in text inside wikitables and parserfunctions without causing any altered function of them. {{Codeline|<nowiki>{{!}}</nowiki>}} inserts an actual pipe character that is parsed by the MediaWiki parser. Thus it does have effect inside wikitables.


Basically, {{Codeline|<nowiki>{{!}}</nowiki>}} is used to delay parsing by the pipe for ''one'' round so that a wikitable pipe can be placed inside and controlled by for instance an #if statement.
Basically, {{Codeline|<nowiki>{{!}}</nowiki>}} is used to delay parsing by the pipe for ''one'' round so that a wikitable pipe can be placed inside and controlled by for instance an #if statement.