http://opensimulator.org/index.php?title=Template:Code/doc&feed=atom&action=historyTemplate:Code/doc - Revision history2024-03-29T14:37:06ZRevision history for this page on the wikiMediaWiki 1.19.9http://opensimulator.org/index.php?title=Template:Code/doc&diff=26162&oldid=prevFritigern: /* Usage */2011-10-21T09:28:15Z<p><span dir="auto"><span class="autocomment">Usage</span></span></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 09:28, 21 October 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==Usage==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==Usage==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Wraps a short span of text in <code><nowiki><syntaxhighlight></nowiki></code> tags (see [<del class="diffchange diffchange-inline">[mw</del>:Extension:SyntaxHighlight GeSHi<del class="diffchange diffchange-inline">]</del>]).  This template should be used for short samples; longer content should use {{tag|pre}} or {{tag|syntaxhighlight}}. See [[Help:Wiki markup]] for an explanation of what the various tags do.{{clarify|reason=[[Help:Wiki markup]] does not mention any such "source" XML tag.}}</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Wraps a short span of text in <code><nowiki><syntaxhighlight></nowiki></code> tags (see [<ins class="diffchange diffchange-inline">http</ins>:<ins class="diffchange diffchange-inline">//www.mediawiki.org/wiki/</ins>Extension:<ins class="diffchange diffchange-inline">SyntaxHighlight_GeSHi </ins>SyntaxHighlight GeSHi]).  This template should be used for short samples; longer content should use {{tag|pre}} or {{tag|syntaxhighlight}}. See [[Help:Wiki markup]] for an explanation of what the various tags do.{{clarify|reason=[[Help:Wiki markup]] does not mention any such "source" XML tag.}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>If the content includes an equals sign (=), you must specify the parameter explicitly: <code><nowiki>{{code|1=date=30 Feb 2010}}</nowiki></code>.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>If the content includes an equals sign (=), you must specify the parameter explicitly: <code><nowiki>{{code|1=date=30 Feb 2010}}</nowiki></code>.</div></td></tr>
</table>Fritigernhttp://opensimulator.org/index.php?title=Template:Code/doc&diff=26161&oldid=prevFritigern: Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> ==Usage== Wraps a short span of text in <code><nowiki><syntaxhighlight></nowi..."2011-10-21T09:26:48Z<p>Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> ==Usage== Wraps a short span of text in <code><nowiki><syntaxhighlight></nowi..."</p>
<p><b>New page</b></p><div>{{Documentation subpage}}<br />
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --><br />
<br />
==Usage==<br />
Wraps a short span of text in <code><nowiki><syntaxhighlight></nowiki></code> tags (see [[mw:Extension:SyntaxHighlight GeSHi]]). This template should be used for short samples; longer content should use {{tag|pre}} or {{tag|syntaxhighlight}}. See [[Help:Wiki markup]] for an explanation of what the various tags do.{{clarify|reason=[[Help:Wiki markup]] does not mention any such "source" XML tag.}}<br />
<br />
If the content includes an equals sign (=), you must specify the parameter explicitly: <code><nowiki>{{code|1=date=30 Feb 2010}}</nowiki></code>.<br />
<br />
The template uses the <code><nowiki><syntaxhighlight></nowiki></code> tag with the attribute <code>enclose="none"</code>. This works like the combination of the <code><nowiki><code></nowiki></code> and <code><nowiki><nowiki></nowiki></code> tags, applied to the expanded wikitext. For example, <code><nowiki>{{code|some '''wiki''' text}}</nowiki></code> will '''''not''''' render the word "wiki" in bold, and will render the tripled-single-quotes:<br />
<br />
:{{code|some '''wiki''' text}}<br />
<br />
However, <code><nowiki>{{code|a {{template}} call}}</nowiki></code> will still invoke the template:<br />
<br />
:{{code|a {{template}} call}}<br />
<br />
Use {{tag|nowiki}} around the template name to avoid this problem:<br />
<br />
:{{code|a <nowiki>{{template}}</nowiki> call}}<br />
<br />
When used inline with regular text, {{tnull|code}} generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:<br />
:{{code|foo &nbsp;<nowiki>{{code|bar baz}}</nowiki>&nbsp; quux.}}<br />
is well spaced:<br />
:foo &nbsp;{{code|bar baz}}&nbsp; quux.<br />
versus:<br />
:{{code|foo <nowiki>{{code|bar baz}}</nowiki> quux.}}<br />
which is going to be visually confusing for many:<br />
:foo {{code|bar baz}} quux.<br />
because "foo" and "{{code|bar}}" will seem more closely associated than "{{code|bar}}" and "{{code|baz}}"; the width of the space character in a monospaced font is almost always larger than in a proportional font.<br />
<br />
Use parameter {{{2}}} (unnamed, as {{para|2}}, or more explicitly as {{para|lang}}) to specify a language for Extension:SyntaxHighlight GeSHi. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though {{code|html4strict}} and {{code|html5}} are valid values, as are {{code|php}}, {{code|perl}}, {{code|css}}, {{code|javascript}}, {{code|mysql}} and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.<br />
<br />
This template does not need to be [[Wikipedia:Template substitution|substituted]].<br />
<br />
Finally, embedded templates do not function inside {{tnull|code}}; for longer, free-form blocks of code, which can contain templates such as {{tlx|var}} and {{tlx|samp}}, use {{tag|code}} as a wrapper instead of this template.<br />
<br />
===Examples===<br />
{| class="wikitable"<br />
! style="width:50%;" | input<br />
! style="width:50%;" | output<br />
|-<br />
| <pre style="margin:0px; white-space:normal;">Lorem {{code|ipsum '''dolor'''}} sit amet</pre><br />
| Lorem {{code|ipsum '''dolor'''}} sit amet<br />
|-<br />
| <pre style="margin:0px; white-space:normal;">The declaration {{code |lang=cpp |int foo(const std::string& bar, const std::vector<long double*>& baz);}} is the prototype for a function defined later.</pre> <br />
| The declaration {{code |lang=cpp |int foo(const std::string& bar, const std::vector<long double*>& baz);}} is the prototype for a function defined later.<br />
|-<br />
| <pre style="margin:0px; white-space:normal;">If the code contains an [[equals sign]], such as {{code |lang=javascript |code=var img = document.getElementsByTagName("img");}}, you must identify the first parameter explicitly as {{{1}}} or {{{code}}}; see also [[:bugzilla:5138]].</pre> <br />
| If the code contains an [[equals sign]], such as {{code |lang=javascript |code=var img = document.getElementsByTagName("img");}}, you must identify the first parameter explicitly as {{{1}}} or {{{code}}}; see also [[:bugzilla:5138]].<br />
|}<br />
<br />
<br />
<includeonly><!--<br />
++++ PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANK YOU. --><br />
[[Category:Programming typing-aid templates|{{PAGENAME}}]]<br />
<!--[[Category:Semantic markup templates|{{PAGENAME}}]]<br />
<!--[[Category:Wikipedia XHTML tag replacing templates|{{PAGENAME}}]] - Doesn't actually qualify yet; needs <code>.--><br />
</includeonly></div>Fritigern