Templat:Prewrap
{{{1}}} |
Use, Limitations, and Options
suntingUse
suntingThis template makes a preformatted text box with adjusable styles. It wraps long lines while preserving the preformatting of other lines.
The wrapping of long code lines, while preserving other preformats might be useful for Wiki and other code listings. Poetry and lyrics might also make use of it, since they consist largely of preformatted text. In any case, preformatted text can be CSS-styled to a considerable extent and need not be restricted to the style-sheet's default styles. Refer to the options for their use. The format to call the template into use is just:
Two typical examples look like this:
The time has come for all good men to come to the aid of the party. The quick brown fox jumps over the lazy dog 0123456789 times. 1 2 3 4 5 6 7 8 9 0 |
<table class=toccolours style="margin: 1em 0 0 0; width: 300px; background: #f9f9f9;;" align= left> <td align=center style="font-weight: bold;">{{{1}}}</td> <tr> <td align=left style="font-weight: normal;">{{{2}}}</td> </tr> </table> |
Notice that the very long unformatted text section and the long table list lines have been wrapped in their specified widths while the other lines which are formatted, have their white-space preserved. This behaviour will be seen only for browsers which support the pre-wrap value of the white-space property.
Limitations
suntingThis pre-wrap value is planned for Firefox 3. Versions of Opera after Opera 8 already work well with it. IE6 does not handle it but IE7 is unclear.
This template suffers in the usual way from parameters containing pipe symbols, and the conventional fixes still need applied. For example, to display the code for a Wiki table, be sure to separate the template's closing curly brackets from the closing curly bracket of the table listing with a space. In addition, use the numbered parameter when calling the template into use. HTML symbols are tolerated better.(See the above example).
Be sure to use the <br clear=all> code to force the next box or text line into a clear space. Follow-on material will otherwise float-left and wrap.
Options
suntingContainer
sunting- align
- container page position. left, center, or right, default left
- border
- box outer all round border, default 1px solid lightgray
- height
- box height, default auto
- width
- box width, default auto
- overflow
- action in event of text overflow; eg scrollbars , default auto
Content
sunting- cbgc
- content box background color, default transparent
- cfc
- content text color, default inherit
- clh
- content height between text lines, default 1.1em
- cp
- content text padding, default 1em
- cff
- content font family, default inherit
- cfs
- content font size, default inherit
- cfst
- content font style, default normal
- ctha
- content text horizontal alignment, default left. Options; left,center,right
- cfw
- content font weight, default normal
The White-space Property
sunting- wrap
- white-space handling, default pre-wrap. Options are normal, pre, pre-wrap, or nowrap.
Notes on White-space
suntingThe normal option resembles the usual Wiki behaviour for white-space, in that it does not generally preserve white-space, except for excess line spacing. The pre option preserves all white-space. The pre-wrap option wraps long lines while preserving all other white-space; this is the choice for Wiki code listings. The nowrap option does not preserve any white-space, not even double line spacing, and places everything into one line.