Template:Nowrap/doc
| This is a documentation subpage for Template:Nowrap It contains usage information, categories and other content that is not part of the original template page. |
| This template is used in MediaWiki:Histlegend. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
| This template can only be edited by administrators because it is transcluded onto one or more cascade-protected pages. |
| Dis template no suppose be used inside citation templates like Citation Style 1 and Citation Style 2, because e get markup wey go spoil the COinS metadata wey dem create; see Wikipedia:COinS. |
{{Nowrap}} or {{nowrap}} dey stop wrapping of some specific text (wey fit dey inside link too). Use this template small-small, no overuse am. E dey stop words from breaking to new line for spaces, hyphens ("-"), or sometimes parentheses depending on the browser. The size of the text wey no fit wrap become the smallest width wey that paragraph need, and this fit make the page no adjust well for small screens or different ways people dey view the content.
If you want the opposite thing wey {{nowrap}} dey do, you fit use {{wbr}}. For more information about how wrapping and breaking sentences work, check Wikipedia:Line-break handling.
Usage
[edit source]{{Nowrap|these words stay together}}→ these words stay together{{Nowrap|a, b, c, or d.}}→ a, b, c, or d.{{Nowrap| merry-go-round }}→ merry-go-round{{Nowrap| [[Four-part harmony]] }}→ Four-part harmony{{Nowrap| [[Cascading Style Sheets|CSS]] }}→ CSS{{Nowrap| [[#Examples|Examples section]] }}→ Examples section{{Nowrap}}→ {{{1}}}{{Nowrap|A very long sentence that should wrap when the window becomes smaller but which is prevented from wrapping by this template, which prevents normal line wrapping of long strings that are wrapped in the template.}}→ A very long sentence that should wrap when the window becomes smaller but which is prevented from wrapping by this template, which prevents normal line wrapping of long strings that are wrapped in the template.
Examples
[edit source]"They held "
|
"He encountered "
|
Controlling line-breaking in infoboxes
[edit source]You fit use this template together with {{Wbr}} and {{Spaces}} to control how lines dey break inside bulletless lists for infoboxes, so long entries wey wrap no go look like different entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for more details.
Handling equal-sign or bar
[edit source]Templates get problem when parameter data contain equal-sign "=" or vertical bars "|" (pipes). Note say this no apply if the equal-sign "=" or vertical bar "|" dey inside wikilink or another template. If you get bare equal-sign "=" or vertical bar "|", you fit use {{Nowrap begin}} + {{Nowrap end}} instead. But there be other ways too:
For text wey get equal-sign "=", put 1= before the text, use triple-brace unnamed parameter {{{|=}}}, or use the {{=}} magic word. Example:
{{Nowrap|1=2 + 2 = 4}},{{Nowrap|2 + 2 {{{|=}}} 4}}, or{{Nowrap|2 + 2 {{=}} 4}}
All of them go render like this:
- 2 + 2 = 4.
For text wey get vertical bar "|", escape the bar(s) with "|" or "{{pipe}}" or "{{abs}}". Example, if you want put two bars "|6|" like this:
{{Nowrap||6| < 7}}or{{Nowrap|{{pipe}}6{{pipe}} < 7}}or{{Nowrap|{{abs|6}} < 7}}
E go render like this:
- |6| < 7
Technical details
[edit source]The actual code wey dey do the work na this HTML <span> tag wey apply one class to the text inside the template:
<span class="nowrap">This text will not wrap</span>
The class nowrap receive the CSS property white-space: nowrap; inside MediaWiki:Common.css.
TemplateData
[edit source]TemplateData for Nowrap
E dey stop words from breaking to new lines (line breaks) inside text or inside a link wey get spaces or hyphens (-).
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Text | 1 | Text or link wey need protection. | String | required |