GuildWiki has been locked down: anonymous editing and account creation are disabled. Current registered users are unaffected. Leave any comments on the Community Portal.

Template:Trim

From GuildWiki
Jump to: navigation, search

{{{1}}}

Usage[edit source]

The purpose of this simple template is to trim whitespace and extra newlines from the start and end of the parameter. Example:

  xxx{{trim|1=

  do re mi

  fa so la  

}}xxx

gives

 xxxdo re mi
 
 fa so laxxx

Warning[edit source]

The user should get into the habit to always use the "1=", because trim will otherwise break if there is an equal sign in the input. Example:

Trim breaks:  {{trim|    there is = in the input }}
Trim doesn't: {{trim|1=  there is = in the input }}
 Trim breaks:  {{{1}}}
 Trim doesn't: there is = in the input

The reason is that an equals sign makes the field be named. Trim will trim the first unnamed or {{{1}}} field, but it can of course not trim the {{{there is}}} field.