|
|
| (12 intermediate revisions by 3 users not shown) |
| Line 1: |
Line 1: |
| <includeonly><onlyinclude><table style="border:1px dashed #555555; padding:5px; margin:5px;"><tr><td><pre style="padding:0px; margin:0px; border:0px;">{{{1|}}}</pre></td></tr></table></onlyinclude></includeonly> | | <includeonly><table style="margin:5px; border:1px dashed #555555; padding:5px; background-color: SlateGray;"><tr><td style="white-space: pre-wrap; font-family: monospace,Courier; color: white;">{{{1|No content.}}}</td></tr></table></includeonly><noinclude> |
| Just a little something to be able to use pre-formatted text within the confined of a code-like presentation without the box taking up the entire width of the page.
| | {{documentation}} |
| == Usage ==
| | </noinclude> |
| It's a simple template, you just add the code or function name you wish to present as the second argument:
| |
| * <nowiki>{{ code | text }}</nowiki>
| |
| == Example ==
| |
| This code:
| |
| | |
| {{co|yellow|<nowiki>{{ code | {{ foo | bar }}}}</nowiki>}}
| |
| | |
| Would result in this:
| |
| <table style="border:1px dashed #555555; padding:5px; margin:5px;"><tr><td><pre style="padding:0px; margin:0px; border:0px;">{{ foo | bar }}</pre></td></tr></table>
| |
| And this code:
| |
| | |
| {{co|yellow|<nowiki>{{code|Foo</nowiki>}}<br>
| |
| {{co|yellow|bar}}<br>
| |
| {{co|yellow| Hah!<nowiki>}}</nowiki>}}
| |
| | |
| Would result in this:
| |
| <table style="border:1px dashed #555555; padding:5px; margin:5px;"><tr><td><pre style="padding:0px; margin:0px; border:0px;">Foo
| |
| bar
| |
| Hah!</pre></td></tr></table>
| |
| Similarly this code:
| |
| | |
| {{co|yellow|<nowiki>{{code|10 PRINT "Hello World!"</nowiki>}}<br>
| |
| {{co|yellow|<nowiki>20 END}}</nowiki>}}<br> | |
| | |
| Would result in this:
| |
| <table style="border:1px dashed #555555; padding:5px; margin:5px;"><tr><td><pre style="padding:0px; margin:0px; border:0px;">10 PRINT "Hello World!"
| |
| 20 END</pre></td></tr></table>
| |
| | |
| Using it inline, like this:
| |
| | |
| {{co|yellow|foo <nowiki>{{code|Foo what? Huh? Huh!}}</nowiki> bar}}
| |
| | |
| Would result in this:
| |
| {{co|grey|Foo}}<table style="border:1px dashed #555555; padding:5px; margin:5px;"><tr><td><pre style="padding:0px; margin:0px; border:0px;">Foo what? Huh? Huh!</pre></td></tr></table>{{co|grey| bar}}
| |
| | |
| This as opposed to how <nowiki><pre></pre></nowiki> tags usually work:
| |
| <pre>Go ahead, use all the width :(</pre>
| |
| | |
| [[Category:Template]][[Category:Tools]]
| |
Template documentation (for the above template, sometimes hidden or invisible)
This template allows the presentation of pre-formatted text within the confines of a code-like presentation without the box taking up the entire width of the page.
- Usage
- Simply add the code or function name you wish to present as the second argument:
{{ code | text }}
- Example
- This code:
{{ code | <nowiki> {{ foo | bar }} </nowiki> }}
- Would result in this:
- And this code:
{{code|Foo
bar
Hah!}}
- Would result in this:
- Similarly this code:
{{code|10 PRINT "Hello World!"
20 END}}
- Would result in this:
10 PRINT "Hello World!" 20 END |
- Using it inline, like this:
foo {{code|Foo what? Huh? Huh!}} bar
- Would result in this:
- Foo bar
- This as opposed to how <pre></pre> tags usually work:
Go ahead, use all the width :(