Difference between revisions of "Template:Code/doc"
From EVE University Wiki
(Created page with "<noinclude>{{main|Template:Code}}</noinclude> == Usage == This template allows the presentation of pre-formatted text within the confines of a code-like presentation without t...") |
m |
||
Line 1: | Line 1: | ||
<noinclude>{{main|Template:Code}}</noinclude> | <noinclude>{{main|Template:Code}}</noinclude> | ||
− | |||
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. | 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><nowiki>{{ code | text }}</nowiki></code> | ||
+ | ; Example | ||
+ | : This code: | ||
+ | : <code><nowiki>{{ code | <nowiki> {{ foo | bar }} </nowiki></nowiki><nowiki> }}</nowiki></code> | ||
− | + | : Would result in this: | |
− | + | : {{code|<nowiki>{{ foo | bar }}</nowiki>}} | |
− | |||
− | |||
− | + | : And this code: | |
+ | : <code><nowiki>{{code|Foo</nowiki></code> | ||
+ | : <code>bar</code> | ||
+ | : <code> Hah!<nowiki>}}</nowiki></code> | ||
− | Would result in this: | + | : Would result in this: |
− | {{code| | + | : {{code|Foo |
− | + | : bar | |
+ | : Hah!}} | ||
− | + | : Similarly this code: | |
− | + | : <code><nowiki>{{code|10 PRINT "Hello World!"</nowiki><br><nowiki> | |
− | + | 20 END}}</nowiki></code> | |
− | Would result in this: | + | : Would result in this: |
− | {{code| | + | : {{code|10 PRINT "Hello World!"<br>20 END}} |
− | |||
− | |||
− | |||
− | + | : Using it inline, like this: | |
− | + | : <code>foo <nowiki>{{code|Foo what? Huh? Huh!}}</nowiki> bar</code> | |
− | Would result in this: | + | : Would result in this: |
− | + | : {{co|grey|Foo}}{{code|Foo what? Huh? Huh!}}{{co|grey| bar}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{co|grey|Foo}}{{code|Foo what? Huh? Huh!}}{{co|grey| bar}} | ||
− | |||
− | |||
− | |||
+ | : This as opposed to how <nowiki><pre></pre></nowiki> tags usually work: | ||
+ | : <pre>Go ahead, use all the width :(</pre> | ||
<includeonly>[[Category:Template]]</includeonly> | <includeonly>[[Category:Template]]</includeonly> | ||
<noinclude>[[Category:Template documentation]]</noinclude> | <noinclude>[[Category:Template documentation]]</noinclude> |
Revision as of 00:51, 23 April 2017
- Main article: Template:Code
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:
{{ foo | bar }}
- And this code:
{{code|Foo
bar
Hah!}}
- Would result in this:
Foo - bar
- Hah!
- 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
barFoo what? Huh? Huh!
- This as opposed to how <pre></pre> tags usually work:
Go ahead, use all the width :(