Template:Out: Difference between revisions

Add `text` parameter, as per request at User_talk:Smls. Also split `comment` into `case` and `note`.
m (typo)
(Add `text` parameter, as per request at User_talk:Smls. Also split `comment` into `case` and `note`.)
Line 1:
<includeonly><div>
;{{#if: {{{1|}}} | {{{1}}} | Output}}{{#if: {{{commentnote|}}} | <i style="font-weight:normal> ({{{innote}}})</i> |}}{{#if: {{{case|}}}{{{input|}}} | <span style="font-weight:normal> &nbsp; &mdash;&nbsp; {{#if:{case|for input <code>{{{commentinput|}}}</code>}}}</span> |}}{{#if: {{{commenttext|}}} | when given an input of<nowiki/> <codespan style="font-weight:normal>{{{in|text}}}</code>}}</span> |}} <nowiki>:</nowiki>}}</div></includeonly><noinclude>
 
This template is used to introduce the output of a programming example.
Line 23:
|-
| <code>1</code>
| ReplacesText to show instead of the word "Output".
| <code><nowiki>{{out|Return value}}</nowiki></code>
| {{out|Return value}}
|-
| <code>incase</code>
| The test-case/condition which produces this output.
| <code><nowiki>{{out|case=test case 3}}</nowiki></code>
| <div style="white-space:nowrap">{{out|commentcase=test case 13}}</div>
|-
| <code>input</code>
| The (single-line) input which produces this output.
| <code><nowiki>{{out|ininput=Hello world}}</nowiki></code>
| {{out|ininput=Hello world}}
|-
| <code>commentnote</code>
| A remark to show in parentheses.
| Any other text you want shown in the same line.
| <code><nowiki>{{out|commentnote=test case 1}}elided}}</nowiki></code>
| {{out|note=elided}}
| <div style="white-space:nowrap">{{out|comment=test case 1}}</div>
|-
| <code>text</code>
| Free-form text to follow instead of a colon.
| <code><nowiki>{{out|text=...}}}}</nowiki></code>
| <div style="white-space:nowrap">{{out|text=...}}</div>
|}
 
You can combine multiple parameters, except that <tt>case</tt> and <tt>input</tt> are mutually exclusive.
 
{{template}}</noinclude>
Anonymous user