Changes

Template:Nowrap/doc

1,914 bytes added, 12:16, 8 February 2020
Created page with "{{documentation subpage}} {{TemplateStyles|Template:nowrap/core.css}} __NOTOC__ This is the {{tl|nowrap}} template. This template prevents word wraps (line breaks) in text an..."
{{documentation subpage}}
{{TemplateStyles|Template:nowrap/core.css}}
__NOTOC__
This is the {{tl|nowrap}} template.

This template prevents word wraps (line breaks) in text and links that contain spaces.

=== Usage ===

<pre>
Lots of text {{nowrap|10 kg (22 lb)}} more text.
</pre>

It may render like this:

:Lots of text 10 kg (22 lb)
:more text.

Or like this:
:Lots of text
:10 kg (22 lb) more text.

But it will ''not'' render like this:
:Lots of text 10 kg (22
:lb) more text.

=== Handling interpreted characters ===

Templates have problems to handle parameter data that contains equal signs "<code>=</code>" or vertical bars "<code>|</code>". In such cases consider using {{tl|nowrap begin}} + {{tl|nowrap end}} instead. But there are also workarounds:

For text that includes an equal sign "=", precede the text with <code>1=</code>. For example:
:<code><nowiki>{{nowrap|</nowiki>1=2 + 2 = 4}}</code>

Which renders this:
:{{nowrap|1=2 + 2 = 4}}

For text that includes a vertical bar "|", escape the bar(s) with <code><nowiki>&amp;#124;</nowiki></code> or <code><nowiki>{{!}}</nowiki></code>. For instance like this:
:<code><nowiki>{{nowrap|</nowiki>&amp;#124;2&amp;#124; < 3}}</code>

Or like this:
:<code><nowiki>{{nowrap|{{!}}2{{!}} < 3}}</nowiki></code>

Which renders this:
:{{nowrap|&#124;2&#124; < 3}}

=== Technical details ===

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

:<source lang="HTML"><span class="nowrap">This text will not wrap</span></source>

Then [[Template:Nowrap/core.css]] brings CSS code for proper rendering.

Spaces at the beginning or end of your text will fall outside the no-wrap tag in the rendered text due to Wikimedia rendering mechanisms.

=== See also ===
* {{tl|nbsp}} to enter one or more non-breaking spaces

<noinclude>[[Category:Template documentation|Nowrap/doc]]</noinclude>
<includeonly>[[Category:Formatting templates|Nowrap]]</includeonly>