8,856
editsno edit summary
No edit summary Tag: Manual revert |
No edit summary |
||
Line 8: | Line 8: | ||
To create or edit templates you need access to them. This can be requested on the Discord or by visiting an admin's talk page. | To create or edit templates you need access to them. This can be requested on the Discord or by visiting an admin's talk page. | ||
=== What to keep in mind === | |||
Ideally, new templates should be: | Ideally, new templates should be: | ||
# Easy to use, with as few parameters as possible. | # Easy to use, with as few parameters as possible. | ||
Line 14: | Line 14: | ||
# Have easy to use TemplateData. | # Have easy to use TemplateData. | ||
=== Important considerations === | |||
Some important considerations when creating templates: | |||
* Line breaks interact unexpectedly with the table parser, which can break some templates. | |||
* Adding a pipe to a template parameter <nowiki>{{{parameter}}} > {{{parameter|}}} </nowiki> will provide it with a default value (in this case, an empty string). | |||
** This is important to remember when using the <nowiki>{{#if:}} </nowiki> parser function, since in cases where a parameter is undefined, <nowiki>{{{parameter}}}</nowiki> will return the value "true", whereas <nowiki>{{{parameter|}}}</nowiki> will return the value "false". | |||
** It is alao important to remember when a parameter is used as a value, since in cases where a parameter is undefined, <nowiki>{{{parameter}}}</nowiki> will return the value "<nowiki>{{{parameter}}}</nowiki>", whereas <nowiki>{{{parameter|}}}</nowiki> will return its default value (in this case, an empty space). | |||
* Expr and ifeq, when evaluating numbers, produce different results. This is because expr treats numbers as floats, whereas ifeq treats them as integers. | |||
=== Template documentation === | === Template documentation === | ||
{{hatnote|See also: [[Help: Template documentation]]}} | {{hatnote|See also: [[Help: Template documentation]]}} |