LIMSWiki:Substitution

From LIMSWiki
Revision as of 19:44, 29 May 2013 by Shawndouglas (talk | contribs) (Added cat.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Substitution is the one-time, permanent copying of any content on LIMSwiki. It differs from transclusion, which continually updates as the linked-to content changes.

To substitute, add subst: after the opening braces, as in {{subst:page name}}. For example: substitution {{subst:Medicine}} in contrast to transclusion {{Medicine}}. The contents of page "Medicine" will be expanded (for any templates) and stored at each point where "{{subst:Medicine}}" is placed in a page. Note how ref-tags refuse to run "subst:" unless temporarily renamed as "<xref name=xx>" or similar.

This page also lists templates that should either always or never be substituted except in the LIMSWiki namespace. Automated tools (like bots) that do such replacements will never be used on the original template. If you are going to use a bot to substitute templates, please read through the talk page first, as many are under dispute or change status over time, and substitution is permanent.

About subst

Definition

The subst: keyword (short for "substitution") is used as a prefix inside template code. It changes the way the software expands the template. Ordinarily, a template will be expanded "on the fly"; that is, the template code on a page calls a separate page every time it is rendered. Although most page views are served from the cache, pages need to be rendered for previews, and rendered again when the page changes. When someone is editing a page with a normal template call, they see the template call. Placing "subst:" inside the curly brackets tells the software to permanently replace the template with the text of the template (i.e., the text that is on the template's article page when the template is added to the page). Therefore {{template}} becomes {{subst:template}}, until you save the page. The next editor sees not the template call, but the text of the template when you saved; it does not change even if the template is edited.

Usage

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}}", "subst:test" or "test1 applied" in your edit summary) so other editors can easily see what you have done.

Additionally, when creating or editing templates that are commonly substituted, adding an HTML comment to the template page helps article editors to see how templates are being used (e.g. <!-- Substituted from Template:Documentation -->).