Wikipedia:WikiProject User warnings/Help:Everything
Wikipedia:WikiProject User warnings/t/documentation-header
The documentation provide both basic and advanced documentation to various aspects of templates.
- All documentation
- Introduction to user warnings, relevant policies, et cetera.
- Template usage outlines general usage guidelines.
- Template coding describes technical template design guidelines.
Wikipedia:WikiProject User warnings/Help:Glossary
Template usage
In general
All standardized templates take several parameters that are entirely optional. For example, you can use {{s/block}} instead of {{s/block|~~~~|1 hour|vandalism}}; the template will automatically insert generic text. Further, all parameters are designed to be very flexible; you can typically write anything in them, including diff links, in-depth messages, and HTML.
User warning templates
Usage depends largely on the particular series of templates. See the documentation on the template talk pages or summary instructions in the list of templates.
Block templates
Block templates differ from user warning templates in two fundamental ways. First, they're enclosed inside a message box, which means that placing your signature outside the template will place it visually separate from the message. This is resolved by typing out your signature (typically ~~~~) as the first parameter.
The second difference is the order of the parameters: whereas user warning templates are in order of use, block templates are not. This is because some of the parameters are less optional than in user warning templates, and they happen to be at the end.
- The signature should always be used; although there's an auto-signature as default value, it converts the username link to plain text (ie, [[User:Pathoschild|Pathoschild]]).
- The time parameter is almost always used, as it signifies when the block expires.
- The reason parameter is rarely used, and by default blames the block on vandalism.
As such, although the order of parameters in the templates are time-reason-signature, the template parameters are input as signature-time-reason. This way, you can ignore the more optional parameters by using "{{block|~~~~}}" instead of "{{block|||~~~~}}". Wikipedia:WikiProject User warnings/Help:Template design
General design guidelines
Severity levels
Every series of templates includes four templates of increasing severity, designating a tone ranging from kindly to stern. These don't necessarily designate a chronological order; a user may simply use a level of his choice based on the severity desired. For example, the test series is test1, test2, test3, test4.
- Assumes the user is not malicious; welcome with polite pointer to sandbox and/or to relevant help and policy pages.
- No faith assumption; pointer to sandbox with polite request to stop and mention of consequences.
- Assumes bad faith; stern cease and desist.
- Assumes bad faith; strong cease and desist, last warning.
Civility
Regardless of the severity level of the template, the user warning should be a model of civility (even for the most destructive vandal). Remember than when you use a warning template, you do so in Wikipedia's name. See Please do not bite the newcomers, Civility, and Etiquette.
Derivatives
No derivative template (a non-standard variant of a template under a new name) should be included in the list of standardized templates or mentioned in the documentation. Although users are free to create and use non-standard templates, these should not be recognized by the project.
Template coding guidelines
Categorization
Template page
User warning templates should be categorized to Category:User warning templates (if the template is a redirect page to another template, it should be categorized using the sort key "Redirect"). User block templates should be categorized to Category:User block templates, with the sort key "Temporary" or "Indefinite" as appropriate. The category tag should be on the template page within noinclude syntax.
<noinclude> [[Category:User warning templates]] [[Category:User block templates|Indefinite]] </noinclude>
User talk page
Any template that places pages it's used on into a category should surround the category tags with the category parameter. If the template uses <noinclude>
tags, be careful to place the parameter inside these tags. This allows the use of the template on a page (such as a talk or list page) without adding that page to a category by using the template with no value specified for the category parameter: {{template|category=}}
.
<noinclude>{{{category|[[Category:User block templates|Temporary]]}}}</noinclude>
Parameters
Default values
Nearly every parameter should have a default value, such that misuse does not break the template. 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.
{{{1|He or she}}} is cool.
Supplied the pronoun with {{template|He}}
, the template will expand to "He is cool". Ignoring the parameter with {{template}}
, the template will default the value and expand to "He or she is cool".
Named syntax
When a template's parameters might be given symbols that break templates (notably the '|' pipe symbol and '=' equals sign), a named syntax should allow these. In such cases, a named and unnamed can coexist as needed. For example, a wikilink template can assign both a name and a number to a parameter by 'nesting' them (placing parameters in other parameters' default values).
[[{{{link|{{{1|{{{default value}}}}}}]]
Using {{template|article}}
is straightforward enough, and will expand to [[article]]
. However, some symbols will break the template if used like that. These require the named syntax: {{template|link=article|name}}
, which will expand to [[article|name]]
.
Nested substitution
Any template containing templates, magic variables, or ParserFunctions should include a "safesubst:" parameter at the appropriate location. This allows for easy substitution of all nested templates inside a template. For example, consider the following template code:
This is {{{{{|safesubst:}}}CURRENTYEAR}}.
Substituting the template using {{subst:template}}
will output "This is 2025".
Block template CSS
Wikipedia allows registered users to maintain a personal stylesheet located at user:username/skin.css, where 'username' is the username and 'skin' is the name of the skin in use (usually monobook). To help users take full advantage of this feature, block templates should be enclosed in a CSS container with the "user-block" class.
<div class="user-block">template message</div>
Should the user wish to, they can customize the appearance of all block templates by adding CSS to their user stylesheet. For example, the following code adds a dark red background with white text.
.user-block { background:#C00 !important; color:#FFF; }
Compatibility with lists
All user warning and block templates should be natively compatible with lists. For optimal intervention efficiency, talk pages with numerous warnings are sometimes organized into formatted lists sectioned by date (see the guidelines). Due to the way Wikipedia parses wiki syntax into HTML, list items are closed at any newline.
Templates with newlines will break any list they are placed in: the first paragraph will be in the list, the others out, and any subsequent templates in the list will begin a new list. By using HTML paragraph syntax directly, Wikipedia's paragraph parsing is circumvented and multiple-paragraph templates can then be added to organized warning lists without problem.
<p>Paragraph 1.</p><p>Paragraph 2.</p><p>Paragraph 3.</p>
To prevent the problem with newlines, templates must be on a single code line; however, this is highly illegible to humans in edit view. To restore legibility, HTML comments can be inserted to emulate the appearance of newlines. Although this looks ungainly with two-term lines, the comments are much less bulky when used with more realistic paragraphs.
<p>Paragraph 1.</p><!-- --><p>Paragraph 2.</p><!-- --><p>Paragraph 3.</p>