Jump to content

Wikipedia:Substitution: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Omniplex (talk | contribs)
→‎Deletion-related: mention nld + nsd also here (timestamp subst magic like prod)
(2 intermediate revisions by the same user not shown)
Line 116: Line 116:


==Templates that should NOT be subst'd==
==Templates that should NOT be subst'd==
Generally, templates that
:(a) contain calls to [[m:ParserFunctions|ParserFunctions]] (#if, #switch, etc.) and
:(b) template calls that do leave some parameters to their [[m:Help:Parameter default|defaults]] by not specifying them<br/>
should not be substed because those constructs are not replaced in the generated wiki-code <nowiki>(Substing of case (a) leaves the #if or #switch constructs verbatim at the subst location and (b) leaves constructs like "{{{1|default value}}}")</nowiki>.

=== List ===
This is a list of templates that should not be subst'd. This is because they can either contain formating standard code, contain complex code, or contain code that breaks if subst'd.
This is a list of templates that should not be subst'd. This is because they can either contain formating standard code, contain complex code, or contain code that breaks if subst'd.

* {{tl|!}} escapes a vertical bar for Wiki table syntax from the [[m:Help:Parameter_default|default parameter]] and [[m:ParserFunctions|ParserFunctions]] mechanisms.
* {{tl|!}} escapes a vertical bar for Wiki table syntax from the [[m:Help:Parameter_default|default parameter]] and [[m:ParserFunctions|ParserFunctions]] mechanisms.
* {{tl|main}} maintains formatting standard.
* {{tl|main}} maintains formatting standard.

Revision as of 17:41, 13 May 2006

[[Category:Wikipedia wp:sub
wp:substs|Substitution]]

This page lists templates that should always be subst'd except in the Wikipedia namespace. Automated tools (bots) which do such replacements will never be used on the original template pages.

If you are going to use a bot to substitute these, please read through the talk page first, as many are under dispute, and substitution is permanent.

Note: a recent software upgrade has corrected a glitch in the use of <noinclude> tags, such that any section within these tags will not be transcluded when a template is subst'd.

About subst

Definition

The subst: keyword (short for "substitution") is used as a prefix inside a template code. It changes the way the software expands the template. Ordinarily, a template is expanded "on the fly"; that is, the template code calls a separate page for the text every time someone edits a page it's used on. Placing "subst:" inside the curly brackets tells the software to permanently substitute the template with text of the template (that is, the text that is on the template's article page). Therefore {{template}} becomes {{subst:template}} and the full text is expanded when you save the page.

Usage

Note: Template substitution is a permanent change that removes functionality, it should generally be avoided without a good reason.

You can subst a template tag by adding "subst:" to a template tag. For example, use {{subst:test5}} instead of {{test5}}. When this is a major component of an edit, it is strongly suggested that the template be mentioned in the edit summary (for instance, put "{{subst:test}}" or "test1 applied" in your edit summary so other editors can easily see what you have done).

Arguments for substitution

  • Templates are often modified or deleted. If a template is boilerplate text, consider whether you want it to vary as the template is improved. If your answer is "no", substitution is warranted. An example of this is the {{welcome}} template. The archives of a user's talk page should show the actual welcome message they received, not the current welcome message.
  • If there is a template you would like to modify for a single occasion, but you don't want to modify the template for all the pages that use it, and you don't want to make a new template, you can substitute the template and then with a second edit, make the modifications. For example: a template might be used with all the states in the United States and the District of Columbia. The template might be worded correctly for the states, but not for DC. To fix the wording, you can substitute the template and then fix the wording.
  • Substituting en masse may speed up the site, though the amount and significance of this is the subject of frequent debate. Every time someone views a page, the server must get text from a separate page for every template used. Although each individual template has little effect, the vast number of templates used on Wikipedia is one factor affecting server load and article load times. Developer Brion Vibber has said "'Policy' shouldn't really concern itself with server load except in the most extreme of cases; keeping things tuned to provide what the user base needs is our job."
  • Templates are a prime target for vandalism. Changes made to a single template are propagated to every article where the template is used. In this way, a single edit can vandalise thousands of individual pages, though this is as easily reverted as any other vandalism. In the past, widely-used templates that were vandalized were usually reverted within a minute. Substituting prevents this type of attack, assuming a good version is substituted, since the template is converted into real text and will no longer be updated. If the template is substituted while in a vandalized state, however (e.g., by bots enforcing this page), the vandalism is much more difficult to clean up, which makes this a disadvantage. Protection of high-risk templates is an alternate solution. This does not appear to be a significant problem as most vandals are not very sophisticated in their methods.
  • Using templates helps hide wikitext from newcomers. (Of course, there is a "how to edit" link at the bottom of each edit page.)
See Wikipedia:Transclusion costs and benefits for further details.

Arguments against substitution

  • Once a template is substituted the result is no longer linked to the template, making it hard to find all pages displaying that text.
  • A substituted template won't be updated when the master template is updated.
  • If the template is used to standardize the appearance of something, you probably do not want to do a substitution. An example of this is a table of contents or navigation box.
  • Substituting en masse — editing thousands of articles with bots — slows down the site and wastes server resources unnecessarily.
  • Substitution increases the size of articles in the database and database dumps.
  • A substituted template can add a lot of wiki-code or HTML to the article, harming accessibility for the less technically-inclined.
  • Substituting templates prevents newcomers from learning to use templates.
  • If the template is just being used temporarily, it is usually better not to substitute. Substituted templates are much harder to remove or modify. For example the template that nominates a category for renaming {{cfr|Category name}} can easily be modified to be the template that renames the category {{category redirect|Category name}}.
  • When a vandalised template is substituted, it is more difficult to repair than regular vandalism because of the lack of links between the template and its incarnations and the lack of updatability.
  • Unsubst'ed deletion tags for trivial pages (such as categories and redirects) offer the deleting administrator a convenient, meaningful deletion summary. Example:
    "content was: '{{rfd}} #REDIRECT Wikipedia' (and the only contributor was 'Jimbo Wales')".
    A precise deletion comment gives onlookers (especially non-administrators unable to view the deleted edits) better insight as to why a specific item may have been deleted. If templates such as {{rfd}}, {{cfr}}, etc. are substed, the "reason for deletion" field defaults to a blank line. (However, pages deleted via {{afd}}, {{mfd}}, {{cfd}}, etc., should be deleted with a link to the page where the deletion was discussed.)

Templates that should be subst'd

This is a list of templates that should always be subst'd, organised by namespace. Each list is ordered alphabetically with grouped series.

Article namespace

Article talk

User namespace

User talk (warnings)

User talk messages

Image namespace

Deletion-process documentation

Misc. templates

  • {{afd}} doesn't work unless substituted
  • {{prod}} doesn't work unless substituted, similar: {{nsd}}, {{nld}}.
  • {{WP:RM}}, {{Move2}} simplify move requests.
  • {{TFAfooter}} links relevant to current featured article, notably used on the main page.
  • User signature templates cause undue server strain as changes to a minor user template must then be widely propagated, this implies {{unsigned}}, {{unsigned2}} should be substed for the same reasons
  • {{nobr}} used to ensure that wikilinks don't break across lines
  • {{debate top}}, {{debate bottom}} — simlar bolderplate message as for the deletion related messages, but for regular disussions instead.
  • {{tl}} {{tlp}} {{ttl}} {{ti}} {{tic}} {{tls}} {{cl}} {{ccl}}
  • {{talkarchive}}, {{archive}} — Archives are static.

Uncategorised suggestions

Templates that must be subst'd

These templates have a purpose and/or syntax that require them to be subst'd.

  • {{doctl}} — must be subst'd in order to function; creates standard form on template talk page for manual editing.
  • {{archivebox}} — subst magic. Creates a link box for archives.
  • {{afd}} — or else the link to "this article's entry" doesn't work.

Templates that should NOT be subst'd

Generally, templates that

(a) contain calls to ParserFunctions (#if, #switch, etc.) and
(b) template calls that do leave some parameters to their defaults by not specifying them

should not be substed because those constructs are not replaced in the generated wiki-code (Substing of case (a) leaves the #if or #switch constructs verbatim at the subst location and (b) leaves constructs like "{{{1|default value}}}").

List

This is a list of templates that should not be subst'd. This is because they can either contain formating standard code, contain complex code, or contain code that breaks if subst'd.

  • {{!}} escapes a vertical bar for Wiki table syntax from the default parameter and ParserFunctions mechanisms.
  • {{main}} maintains formatting standard.
  • {{ln}} {{lnt}} etc., complex code.
  • the various {{stub}} templates for simplified usage and removal.
  • {{See also}} — standard formatting for see also list.
  • {{Signpost-subscription}} (must be updated weekly).
  • {{if defined}}, {{unless defined}}, etc. are conditional templates, subst'ing would remove this feature resulting in a constant value.
  • {{qif}}, {{switch}}, {{ifndef}} are also conditional template, subst'ing breaks usage.
  • {{booland}}, {{boolor}}, {{boolxor}}, {{boolnand}}, {{boolnor}}, {{boolnxor}}, {{boolnot}}, {{booleq}}, {{boolne}} — conditional template, complex code.
  • various citation/reference templates (see WP:CITET) which contain very complex conditional code
  • various infoboxes, which should look consistant on various pages.
  • {{copyvio}} — far too much wikicode, and a bot relies up on it to populate WP:CP with unlisted articles.
  • {{Javadoc:SE}}, {{Javadoc:EE}} and {{Javadoc:SE-guide}} — conditional templates whose purpose is to update the links when the master template is updated.
  • {{wikilink}} — meant for special uses inside templates, does not work when subst'ed

Chemical abbreviations

See Category:Chemical element symbol templates. These are used to simplify the entry of chemical formulas.

Most templates related to renaming or deleting pages are used temporarily, and thus do not need to be substituted (it just makes more work to delete them).

Note: Exceptions are {{afd}}, {{nld}}, {{nsd}}, and {{prod}} (which do not work correctly unless substituted). In addition, those templates which document a finished deletion process ({{afd top}}, {{oldmfd}}, etc). should be substituted.

Under debate

See also