Fyrimynd:Strip whitespace/doc
Hetta er ein dokumentatión undirsíða til Fyrimynd:Strip whitespace. Hon inniheldur kunning um nýtsluna, bólkar og um annað innihald, ið ikki er við í uppruna fyrimynd síðuni. |
Henda fyrimyndin eigur ikki at verða útskift. |
This is a simple little template, for use in other templates to strip any trailing and/or leading whitespace from unnamed parameters.
In MediaWiki templates, trailing and/or leading whitespace is automatically removed from named parameters, but not from unnamed parameters. (Thus we can choose whether this removal is applied, but the choice cannot be made independently of the choice to use named or unnamed parameters. This is apparently some ancient design mistake with which we are now stuck forevermore, in the name of backward-compatibility.[1])
Usage
[rætta wikitekst]The template takes either a parameter, "x", or one unnamed parameter. The value should be numbered parameter from which the whitespace is to be removed.
{{strip whitespace | x = INPUT }}
or
{{strip whitespace | INPUT }}
where INPUT
is the expression to be stripped.
Do not substitute this template – that is, if used as {{subst:strip whitespace}}
, the resulting wikicode is not "clean".
Examples
[rætta wikitekst]Code | Result |
---|---|
1{{strip whitespace| monkey bars }}2 |
1monkey bars2 |
1{{strip whitespace|x= monkey bars }}2 |
1monkey bars2 |
Notes
[rætta wikitekst]- ↑ Unfortunately the reverse, avoiding the removal of whitespace while using a named parameter, is not possible.
See also
[rætta wikitekst]- {{Trim}}, which does nearly the exact same thing, but which may be substituted.