Jump to content

Wikipedia:WikiProject User warnings/Help:Template coding

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pathoschild (talk | contribs) at 12:27, 13 January 2006 (creation (split from single documentation page) with documentation header). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Wikipedia:WikiProject User warnings/t/documentation-header

Template coding guidelines

Parameters

  • Default values
    • Nearly all parameters should have a default value, such that misuse does not break the template; exceptions can be made for extra parameters. You can set the default value of a parameter by using piped syntax ({{{1|default value}}}). For example, the template below takes a parameter which expects the user to supply the proper pronoun (she, he, it, they, et cetera).

      {{{1|They}}} are cool.
      Supplied the pronoun with {{template|He}}, the template will expand to "He are cool" (grammar aside). Ignoring the parameter with {{template}}, the template will default the value and expand to "They are cool".
  • Expert syntax
    • Where use could conceivably include symbols that break templates (notably the pipe (|) and equals sign (=)), an expert syntax should allow this. In such cases, an expert syntax and simple syntax can coexist as needed. For example, let us say we for some reason want to make a wikilink template.

      [[{{{1}}}]]

Usin

Paragraphs