Template talk:Pre

From Wikipedia, the free encyclopedia

This template will render its first parameter as if in <pre></pre> tags, with the difference that Wikimarkup is allowed, line-breaks occur, and overflow is tempered. Note: the allowance of Wikimarkup is accidental and currently incurable; parameters should be manually <nowiki></nowiki>'d if needed.

The point of this template is to avoid nasty errors that occur when the contents of a <pre> tag are too large, and force the tag to expand the page or push other elements away awkwardly.

[edit] Examples

This is some text.

This is some text in pre tags

{{pre|This is some text using this template}}

pre
This is some text using this template

This is rather a lot of text that just keeps on going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going!

Using template:

pre
This is rather a lot of text that just keeps on going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going!

What would this look like in PRE tags?


If you want white-space displayed as in pre tags, you can use the argument space, which you should set to pre:

{{pre|space=pre|This is rather a lot of text that just keeps on going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going!}}

pre
This is rather a lot of text that just keeps on going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going and going!

Note that this template cannot display multiple spaces; for this, genuine pre tags must be used.


Therejustaren'tanyspacesinthistextanditsgonnapushthepageapartnastilyohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdear.

pre
Therejustaren'tanyspacesinthistextanditsgonnapushthepageapartnastilyohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdearohdear.

What would this look like in PRE tags?

[edit] Making all pres autoflow

Just add this to your user CSS:

/* Make preformatted sections overflow with a scrollbar instead of uglies */

pre {
    overflow: auto;
    width: auto;
}

Omegatron 01:13, 16 May 2006 (UTC)