Template:Pre: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Scratch that, it just wasn't working in Show preview.)
(Used <pre> instead of <div>. Moved doc. Added Template:Lang.)
Line 1: Line 1:
<div style="padding: 1em;border-left: 6px solid {{{bdcolor}}};color: {{{txtcolor}}};background-color: {{{bgcolor}}};line-height: 1.1em;font-size: 100%;overflow: auto;font-family: monospace, sans-serif;">{{{1}}}</div>
{{lang|Template:pre}}
<noinclude>
<onlyinclude><includeonly><!--
== Usage ==
 
Adds more functionality to the existing message box obtainable by adding one space before text.
--><pr<noinclude></noinclude>e style="
This is the default box. This is produced by adding one space to the beginning of this line.
  background:{{{bgcolor|#444}}};
<pre>It also works by adding an HTML <code><nowiki><pre></nowiki></code> tag.</pre>
  border-color:{{{bdcolor|#666}}};
The syntax for the <code><nowiki>{{pre}}</nowiki></code> template is:
  color:{{{txtcolor|#ddd}}};
<pre>
  {{{style|}}};
{{pre
">{{{1|}}}<!--
|bgcolor=background color
--></pre><!--
|bdcolor=border color
 
|txtcolor=text color
--></includeonly></onlyinclude>
|message
{{documentation}}
}}
</pre>
{{pre|bgcolor=#555|bdcolor=#FFF|txtcolor=yellow|In this example the bgcolor is #555 bdcolor is #FFF and txtcolor is yellow.}}
</noinclude>

Revision as of 19:57, 19 December 2021


English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

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}}