Template:32

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:32/doc.


Usage

[edit]

{{32}} will insert a single, ordinary space character, using the numeric character reference  . It is a more readable alternative to using that code.

Anywhere you need a regular space

[edit]

You can use {{32}} anywhere you need a regular, breaking space. If you need a non-breaking space or multiple spaces in a row, use {{Space}}.

Inserting a space inside a parser function

[edit]

Sometimes when using parser functions, you need to insert a space at the beginning or end of an optional message. {{32}} can be used for that purpose. In the following examples, look closely at the spacing between words and punctuation to see the subtle differences.

Example
I like green{{#if:{{{blue|}}}|and blue}}.

The above example works fine if 'blue' does not have a value ('I like green.').

However, if 'blue' is set to true (|blue=true), then the message is incorrectly run together ('I like greenand blue.').

I like green {{#if:{{{blue|}}}|and blue}}.

Adding the space between 'green' and '{{#if' avoids running the 'green and' together, but now there will be an extra space if 'blue' is not set ('I like green .').

I like green{{#if:{{{blue|}}}| and blue}}.

Adding the space between the pipe ('|') and the word 'and' doesn't work. Any leading or trailing spaces from a parser function output are stripped, so this produces exactly the same output as the first example when 'blue' is true ('I like greenand blue.').

I like green{{#if:{{{blue|}}}|{{32}}and blue}}.

This one works! By inserting the {{32}} in the parser function output, the space is not stripped, and the correct output is given whether blue is set to true ('I like green and blue.') or not set at all ('I like green.').

Disabling default substitution

[edit]

Suppose you have a template, {{Example}}, that uses substitution, like this:

{{{{{subst|subst:}}}#if{{{condition|}}}|message}}

When the template is transcluded and saved, the result would be interpreted as:

{{subst:#if{{{condition|}}}|message}}

You could override the substitution by setting the 'subst' attribute to {{32}}:

{{Example| subst={{32}} }}

Now the result would be interpreted as:

{{ #if{{{condition|}}}|message}}

The extra blank space preceding the '#if' would not affect the template at all (except to suppress the default substitution).

TemplateData

[edit]
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Inserts a single space character; mainly used in parser functions

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
No parameters specified