Template:Code

From The Dreaming
Revision as of 17:41, 25 August 2016 by Stuart (talk | contribs) (Template cribbed from Blue Prism (well, I wrote it))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template for providing code within a paragraph of a wiki page.

Usage

An anonymous first parameter provides the text to wrap into a code element. An optional second parameter can set the colour of the output.

Examples

eg.

 {{code|IsItemInQueue([Queue Name], [Item Key])}}

Gives

IsItemInQueue([Queue Name], [Item Key])


The second parameter sets the colour of the output, eg.

 {{code|Dim|blue}} {{code|str}} {{code|As}} {{code|String|teal}} {{code|{{=}}}} {{code|"This is a test"|#800}} 

will emit:

Dim str As String = "This is a test"

Note the use of the {{=}} template to pass a literal '=' character. It is treated as a 'name=value' operator by mediawiki without that.