Changes

Jump to navigation Jump to search
removing {{High-use}} for template with less than 1000 transclusions
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES WHERE INDICATED THE BOTTOM OF THIS PAGE -->

This is the {{tl|nowrap begin}} template. This template prevents word wraps (line breaks) in text and links with spaces in. It is designed to handle the really tricky wrapping cases where you need full control. It works similarly to {{tl|nowrap}} and {{tl|nowraplinks}}. This template takes no parameters; instead, it works in tandem with {{tl|nowrap end}}.

{{Ambox |text='''Note:''' The use of these templates in {{tl|Navbox}} and similar templates is deprecated; see [[Template:Navbox/doc#See also]]. Use the [[WP:HLIST|"hlist" class]] and, when occasionally necessary, {{tl|allow wrap}}. The nowrap behaviour implemented by the {{tc|nowrap}} set has been made ambient, while hlist provides a more appropriate structure and improved accessibility.}}

===Helper templates===
This template has a number of helper templates which allows you to tell the web browser exactly where line breaks may occur:

'''Note:''' These helper templates may only be used in sections surrounded by {{tl|nowrap begin}} and {{tl|nowrap end}} or they may cause weird behaviour of your page.

* {{tl|wrap}}{{spaced ndash}}Marks where a wrap may occur.

===Usage===
<pre><nowiki>
{{nowrap begin}}

[[Salt]] and{{wrap}} [[Pepper]] and{{wrap}} [[Curry]]
and{{wrap}} [[Saffron]].{{wrap}}
[[Salt]] and{{wrap}} [[Pepper]] and{{wrap}} [[Curry]]
and{{wrap}} [[Saffron]].

{{nowrap end}}
</nowiki></pre>

It will render something like this:

:[[Salt]] and [[Black pepper|Pepper]] and [[Curry]] and
:[[Saffron]]. [[Salt]] and [[Black pepper|Pepper]] and
:[[Curry]] and [[Saffron]].

But it will ''not'' render like this:

:[[Salt]] and [[Black pepper|Pepper]] and [[Curry]]
:and [[Saffron]]. [[Salt]] and [[Black pepper|Pepper]]
:and [[Curry]] and [[Saffron]].

To make your code readable and easy to edit, you can put each wrappable "line" on its own line. And let's use some dots too. Like this:

<pre><nowiki>
{{nowrap begin}}

[[Salt]] and [[Pepper]]{{·}}{{wrap}}
[[Pepper]] and [[Curry]]{{·}}{{wrap}}
[[Curry]] and [[Saffron]]{{·}}{{wrap}}
[[Saffron]] and [[Salt]]

{{nowrap end}}
</nowiki></pre>

It will render something like this:

:[[Salt]] and [[Black pepper|Pepper]] '''·''' [[Black pepper|Pepper]] and [[Curry]] '''·'''
:[[Curry]] and [[Saffron]] '''·''' [[Saffron]] and [[Salt]]

But it will ''not'' render like this:

:[[Salt]] and [[Black pepper|Pepper]] '''·''' [[Black pepper|Pepper]]
:and [[Curry]] '''·''' [[Curry]] and [[Saffron]]
:'''·''' [[Saffron]] and [[Salt]]

===Examples===
Here are the above examples in actual running code in a table. Try dragging the width of your web browser window so it becomes smaller and smaller and watch how the line wrapping behaves:

{| class="wikitable"
|
{{nowrap begin}}
[[Salt]] and{{wrap}} [[Black pepper|Pepper]] and{{wrap}} [[Curry]]
and{{wrap}} [[Saffron]].{{wrap}}
[[Salt]] and{{wrap}} [[Black pepper|Pepper]] and{{wrap}} [[Curry]]
and{{wrap}} [[Saffron]].
{{nowrap end}}
|
{{nowrap begin}}
[[Salt]] and [[Black pepper|Pepper]]{{·}}{{wrap}}
[[Black pepper|Pepper]] and [[Curry]]{{·}}{{wrap}}
[[Curry]] and [[Saffron]]{{·}}{{wrap}}
[[Saffron]] and [[Salt]]
{{nowrap end}}
|}

An example demonstrating all the helper templates:

{| class="wikitable"
|
{{nowrap begin}}
[[Salt]]{{wrap}} [[Black pepper|Pepper]]{{wrap}} [[Curry]]{{·}}{{wrap}} [[Saffron]]{{·}}{{wrap}} [[Salt]]{{•}}{{wrap}} [[Black pepper|Pepper]]{{•}}{{wrap}} [[Curry]]{{snd}}{{wrap}} [[Saffron]]{{snd}}{{wrap}} [[Salt]] {{!}}{{wrap}} [[Black pepper|Pepper]] {{!}}{{wrap}} [[Curry]]{{·}}{{wrap}} [[Saffron]]{{·}}{{wrap}} [[Salt]]
{{nowrap end}}
|
{{nowrap begin}}
[[Salt]]{{wrap}} [[Black pepper|Pepper]]{{wrap}} [[Curry]]{{·}}{{wrap}} [[Saffron]]{{·}}{{wrap}} [[Salt]]{{•}}{{wrap}} [[Black pepper|Pepper]]{{•}}{{wrap}} [[Curry]]{{snd}}{{wrap}} [[Saffron]]{{snd}}{{wrap}} [[Salt]] {{!}}{{wrap}} [[Black pepper|Pepper]] {{!}}{{wrap}} [[Curry]]{{·}}{{wrap}} [[Saffron]]{{·}}{{wrap}} [[Salt]]
{{nowrap end}}
|}

===Technical details===
The actual code that does the job is this HTML+CSS code:

: <code><nowiki><span style="white-space:nowrap;"> Text and links </span> <span style="white-space:nowrap;"> More text and links </span></nowiki></code>

It means that wraps may only happen in the unprotected space between the <code><nowiki></span></nowiki></code> and the <code><nowiki><span ...></nowiki></code>. That's what {{tl|nowrap begin}} and its helper templates are packaging in an easy to use way.

{{tl|·}} and the other helper templates should not have any spaces or newlines before them or they will render two spaces before the dot. They tolerate anything from no to several spaces and even a newline after them and they will still only render one space after the dot. If a wrap occurs then the wrap will come after the dot, even if there are spaces before the helper template.

The {{tl|·}} causes problems if inside sections of bolded and/or italicised text. Do end the bold text before the {{tl|·}} and continue the bold text after it to avoid the problems. {{tl|•}} and the other helper templates only have this problem if the section is bolded and italicised at the same time.

===See also===
{{List of nowrap-like templates}}

<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE, PLEASE: -->
[[Category:Line-handling templates]]
</includeonly>
Anonymous user

Navigation menu