Template:Pre/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Extended example to show behavior with templates.)
m (correction: external links work inside the template, they just need to be written entirely.)
 
Line 7: Line 7:
<pre style="background:#444; color:#ddd; border-color:#666">[...]</pre>
<pre style="background:#444; color:#ddd; border-color:#666">[...]</pre>


== Usage ==
==Usage==
=== Parameters ===
===Parameters===
* {{param|1}} - The text inside the box.
* {{param|1}} - The text inside the box.
* {{param|bgcolor}} - The background color.
* {{param|bgcolor}} - The background color.
Line 16: Line 16:
{{note|Examples for colors formats are <code>#FFF</code>, <code>#FFFFFF</code> and <code>white</code>. See [[Wiki:Help:Using colors]].}}
{{note|Examples for colors formats are <code>#FFF</code>, <code>#FFFFFF</code> and <code>white</code>. See [[Wiki:Help:Using colors]].}}


=== Examples ===
===Examples===
{| class=wikitable
{| class=wikitable
!width=50%| Wikitext
!width=50%| Wikitext
Line 24: Line 24:
This example defines just the message
This example defines just the message
in multiple lines.
in multiple lines.
[[Main Page|Wikilinks]] work in here, too, but not [www.google.com external links].
[[Main Page|Wikilinks]] and [https://www.wikipedia.org/ external links] work in here, too.
For template calls, the pipe {{!}} and the equals sign {{=}} must be "escaped".
For template calls, the pipe {{!}} and the equals sign {{=}} must be "escaped".
Template transclusions like {{source}} will be resolved.
Template transclusions like {{source}} will be resolved.
Line 32: Line 32:
This example defines just the message
This example defines just the message
in multiple lines.
in multiple lines.
[[Main Page|Wikilinks]] work in here, too, but not [www.google.com external links].
[[Main Page|Wikilinks]] and [https://www.wikipedia.org/ external links] work in here, too.
For template transclusions, the pipe {{!}} and the equals sign {{=}} must be "escaped".
For template transclusions, the pipe {{!}} and the equals sign {{=}} must be "escaped".
Template transclusions like {{source}} will be resolved.
Template transclusions like {{source}} will be resolved.
Line 42: Line 42:
|}
|}


=== Comparison ===
===Comparison===
  This is the default box. This is produced by adding one space to the beginning of this line.
  This is the default box. This is produced by adding one space to the beginning of this line.
<pre>This is the result when using just the &lt;pre> HTML tag with no style.</pre>
<pre>This is the result when using just the &lt;pre> HTML tag with no style.</pre>


== See also ==
==See also==
* {{tl|Pre}}
* {{tl|Pre}}
* {{tl|Code}}
* {{tl|Code}}

Latest revision as of 12:41, 4 May 2022

This is supposed to be <pre>{{{1}}}<pre> but dark by default and with more options.

The crucial difference between <pre> and this template: The verbatim of this template affects whitespace but not wikitext (how could it?), so this template can be used for code from games as well as for links (!) but not for plain wikitext. To get the "full" verbatim, you must use <pre> directly (which this template should actually make simpler but it cannnot):

<pre style="background:#444; border-color:#666; color:#ddd">[...]</pre>, which renders as follows:

[...]

Usage

Parameters

  • {{{1}}} - The text inside the box.
  • {{{bgcolor}}} - The background color.
  • {{{bdcolor}}} - The border color.
  • {{{txtcolor}}} - The text color.
  • {{{style}}} - Can be used to add or override any style parameters of the <pre> that this templates uses.
Note.pngNote:Examples for colors formats are #FFF, #FFFFFF and white. See Wiki:Help:Using colors.

Examples

Wikitext Result
{{pre|
This example defines just the message
in multiple lines.
[[Main Page|Wikilinks]] and [https://www.wikipedia.org/ external links] work in here, too.
For template calls, the pipe {{!}} and the equals sign {{=}} must be "escaped".
Template transclusions like {{source}} will be resolved.
Template transclusions like {{source{{!}}4}} will NOT be resolved!
}}
This example defines just the message
in multiple lines.
Wikilinks and external links work in here, too.
For template transclusions, the pipe | and the equals sign = must be "escaped".
Template transclusions like Source will be resolved.
Template transclusions like {{source|4}} will NOT be resolved!
{{pre|bgcolor=#123456|bdcolor=#ABC|txtcolor=yellow|In this example the bgcolor is #123456, bdcolor is #ABC and txtcolor is yellow.}}
In this example the bgcolor is #123456, bdcolor is #ABC and txtcolor is yellow.

Comparison

This is the default box. This is produced by adding one space to the beginning of this line.
This is the result when using just the <pre> HTML tag with no style.

See also

  • {{Pre}}
  • {{Code}}
  • {{Kbd}}
  • {{Mono}}
  • {{Samp}}
  • {{Var}}