Template:Trim/doc

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
This is a documentation subpage for Template:Trim.
It contains usage information, categories and other content that is not part of the original template page.
To view the template page itself, see Template:Trim.

Description

Trims whitespace (regular spaces, tabs, new lines) from the beginning and end of its input. Can be used for text, but is more useful for templates.

Usage

{{Trim|input}}

Examples

Text

"{{Trim| Example text }}"

"Example text"

Images

A new line in an image link will prevent it from being rendered:

[[File:
Example.jpg|100px]]

[[File: Example.jpg|100px]]

But when trimmed:

[[File:{{trim|
Example.jpg}}|100px]]

Example.jpg

Templates

A template wishing to accept block-layout arguments must trim input of any unnamed (numbered) parameters for exactly the same reason:

{{some image handling template|[[File:{{trim|{{{1}}}}}]]}}

Won't break when called as:

{{some image handling template
| Example.jpg
}}

History

Was originally called Template:StripWhitespace here. Subsequently updated to use Wikipedia's template code, and renamed to Template:Trim.

Further reading