Difference between revisions of "Template:Code"

From EVE University Wiki
Jump to: navigation, search
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
<div style="float:right; margin-left:1em; margin-bottom:1em;">__TOC__</div>
 
<div style="float:right; margin-left:1em; margin-bottom:1em;">__TOC__</div>
</noinclude><table style='padding:5px; margin:5px; border:1px dashed #555555;'><tr><td style='white-space:pre;'><nowiki>{{{1|}}}</nowiki></td></tr></table><noinclude>
+
</noinclude><table style='padding:5px; margin:5px; border:1px dashed #555555;'><tr><td style='white-space:pre;'>{{{1|}}}</td></tr></table><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.
 
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.
Line 13: Line 13:
  
 
Would result in this:
 
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>
+
{{code|{{ foo | bar }}}}
 
And this code:
 
And this code:
  

Revision as of 13:15, 28 November 2013

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.

Usage

It's a simple template, you just add the code or function name you wish to present as the second argument:

  • {{ code | text }}

Example

This code:

{{ code | {{ foo | bar }}}}

Would result in this:

Template:Foo

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

Foo what? Huh? Huh!

bar

This as opposed to how <pre></pre> tags usually work:

Go ahead, use all the width :(