Template:Nowrap/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{dochead}}
{{dochead}}{{Wikipedia}}{{lua|Variable arguments}}
{{Wikipedia}}
The <code>{<nowiki />{nowrap}}</code> template stops wrapping of specific text that may happen at spaces, dashes, or parentheses. It is to be used for sections such as units, dates, and mathematical equations that should always stay together.
 
The <code><nowiki>{{nowrap}}</nowiki></code> template stops wrapping of specific text that may happen at spaces, dashes, or parentheses. It is to be used for sections such as units and dates that should always stay together.


=== Usage ===
=== Usage ===
Pass in the text to be held together as a single unnamed parameter. Passing in two or more unnamed parameters will produce individual chunks of non-wrapped text separated by a comma and space. Spaces within the parameters will not wrap, but the spaces separating the generated non-wrapped <code><nowiki><span></nowiki></code> elements are ordinary spaces and will wrap by default.
Pass in the text to be held together as a single unnamed parameter. Two or more unnamed parameters will result in individual chunks of non-wrapped text separated by a comma and space.


All leading and trailing whitespaces in the input parameters will be trimmed.
Leading and trailing whitespaces in the input parameters will be trimmed. Interior whitespaces will not wrap, but the spaces separating the generated <code><<nowiki />span></code> elements are ordinary spaces and will wrap by default.


{| class="wikitable"
{| class="wikitable"
|-
|-
! You type !! Generated HTML
! You type
! Generated HTML
! Rendered output
|-
|-
| {{{{ROOTPAGENAME}}|<code><nowiki>{{nowrap|10 kg (22 lb)}}</nowiki></code>}} || <syntaxhighlight lang="html"><span style="white-space: nowrap;">10 kg (22 lb)</span></syntaxhighlight>
| {{{{ROOTPAGENAME}}|<code><nowiki>{{nowrap|10 kg (22 lb)}}</nowiki></code>}}
| <syntaxhighlight lang="html"><span style="white-space: nowrap;">10 kg (22 lb)</span></syntaxhighlight>
| {{{{ROOTPAGENAME}}|10 kg (22 lb)}}
|-
|-
| {{{{ROOTPAGENAME}}|<code><nowiki>{{nowrap|1 Jan|2 Feb|3 Mar|4 Apr}}</nowiki></code>}} || <syntaxhighlight lang="html"><span style="white-space: nowrap;">1 Jan</span>, <span style="white-space: nowrap;">2 Feb</span>,
| {{{{ROOTPAGENAME}}|<code><nowiki>{{nowrap|1 Jan|2 Feb|3 Mar|4 Apr}}</nowiki></code>}}
<span style="white-space: nowrap;">3 Mar</span><span style="white-space: nowrap;">4 Apr</span></syntaxhighlight>
| <syntaxhighlight lang="html"><span style="white-space: nowrap;">1 Jan</span>, <span style="white-space: nowrap;">2 Feb</span>, <span style="white-space: nowrap;">3 Mar</span>, <span style="white-space: nowrap;">4 Apr</span></syntaxhighlight>
| {{{{ROOTPAGENAME}}|1 Jan|2 Feb|3 Mar|4 Apr}}
|}
|}


{{escape notice}}
{{escape notice}}
=== See also ===
* {{modlink|Variable arguments}}

Latest revision as of 03:16, 16 February 2025

English Wikipedia has an article on:

The {{nowrap}} template stops wrapping of specific text that may happen at spaces, dashes, or parentheses. It is to be used for sections such as units, dates, and mathematical equations that should always stay together.

Usage

Pass in the text to be held together as a single unnamed parameter. Two or more unnamed parameters will result in individual chunks of non-wrapped text separated by a comma and space.

Leading and trailing whitespaces in the input parameters will be trimmed. Interior whitespaces will not wrap, but the spaces separating the generated <span> elements are ordinary spaces and will wrap by default.

You type Generated HTML Rendered output
{{nowrap|10 kg (22 lb)}}
<span style="white-space: nowrap;">10 kg (22 lb)</span>
10 kg (22 lb)
{{nowrap|1 Jan|2 Feb|3 Mar|4 Apr}}
<span style="white-space: nowrap;">1 Jan</span>, <span style="white-space: nowrap;">2 Feb</span>, <span style="white-space: nowrap;">3 Mar</span>, <span style="white-space: nowrap;">4 Apr</span>
1 Jan, 2 Feb, 3 Mar, 4 Apr

Note: Pipe characters (|) must be escaped as {{!}} or {{pipe}}, equals signs must be escaped as {{=}} (this may apply to tags as well, e.g. <div style{{=}}"…">), and other special characters and character sequences may need to be escaped accordingly, except for ones inside <nowiki>, <pre>, <math>, and <syntaxhighlight> tags.