Template:Pre/doc
Appearance
This is a documentation subpage for Template:Pre It may contain usage information, categories and other content that is not part of the original template page. |
{{pre}} uses <pre>
tags, but with text that is either wrapped or is contained in a horizontal scrollbox. This means the text will not stretch past the right side of the screen.
As it uses real <pre> tags , it will be displayed correctly regardless of how the user's skin renders <pre> boxes.
If you want to disable wikitext in it, you should use <nowiki> tags inside the template (see below).
Usage
[edit source]Wrapped text
[edit source]{{pre|Text to be displayed. And more and more and more... and a paragraph break.
And then more and more...}}
- produces:
{{#switch:{{{2}}}|nowiki|nw={{#tag:nowiki|{{{3}}}}}|{{{2}}}}}|white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;{{{style|}}}">{{#switch:{{{1}}}|nowiki|nw={{#tag:nowiki|{{{2}}}}}|{{{1}}}}} }}
Scrollbox
[edit source]{{pre|scroll|Text to be displayed. And more and more and more... and a paragraph break.
And then more and more...}}
- produces:
{{#switch:{{{2}}}|nowiki|nw={{#tag:nowiki|{{{3}}}}}|{{{2}}}}}|white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;{{{style|}}}">{{#switch:{{{1}}}|nowiki|nw={{#tag:nowiki|{{{2}}}}}|{{{1}}}}} }}
Using Wikitext
[edit source]To disable wikitext (e.g. [[links]]), <nowiki> tags must be used in the form:
{{pre|<nowiki>Your [[text]], which ''might'' include {{tl|templates}}.<noinclude>[[Category:Examples]]</noinclude></nowiki>}}
This will produce this:
{{#switch:{{{2}}}|nowiki|nw={{#tag:nowiki|{{{3}}}}}|{{{2}}}}}|white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;{{{style|}}}">{{#switch:{{{1}}}|nowiki|nw={{#tag:nowiki|{{{2}}}}}|{{{1}}}}} }}
as opposed to:
{{#switch:{{{2}}}|nowiki|nw={{#tag:nowiki|{{{3}}}}}|{{{2}}}}}|white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;{{{style|}}}">{{#switch:{{{1}}}|nowiki|nw={{#tag:nowiki|{{{2}}}}}|{{{1}}}}} }}