Template:Nb/doc

From MozillaWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Edit-copy green.svg
This is a documentation subpage for Template:Nb.
It contains usage information, categories and other content that is not part of the original template page.

Usage

{{nb}} inserts up to 10 consecutive non-breaking spaces at the position where the template is placed.

The default, and intended action is to insert a single non-breaking space.

Parameters

There is only 1 parameter, which is unnamed and optional.

Syntax

The template's syntax is

  • {{nb|number value }}

To insert a single non-breaking space, you don't need to enter any parameter. Just type

  • {{nb}}

Optional parameter

1

Number of inserted spaces

You can insert up to 10 characters by entering a number value (from 2 to 10) as the first parameter. This parameter is unnamed, so no parameter name has to be included.

Note
  • If the given value is invalid, the template will an error message.
Usage
  • {{nb|1}}

Examples

Overriding wiki preformatting

Any string or group of strings indented by a single space character will be pre-formatted and displayed in a box.

Example

If you enter the code:

 This text is pre-formatted.

the output will be:

This text is pre-formatted.

By using this template, you can override this function.

Example

If you write:

{{nb}}This text is pre-formatted.

the output will be (notice the single space character indent):

 This text is pre-formatted.

Correct use

Case What you type What you see Comments
No parameter Separate{{nb}}words Separate words Inserts a non-breaking space
Parameter |1 Even{{nb|2}}more{{nb|5}}separate{{nb|9}}words Even  more     separate         words

Incorrect use

Case What you type What you see (error message)
Value for |1 < 1 Separate{{nb|0}}words SeparateError in {{nbsp}}: number of spaces can't be 0 or negative, minimum is 1.words
Value for |1 > 10 Separate{{nb|11}}words SeparateError in {{nbsp}}: too many spaces, maximum is 10.words

See also

  • {{sp}}: Inserts a single, regular space character. For use in templates, parser functions, and tables.
  • {{space}}: Inserts any one of a number of different space characters.