Help:Transclusion: Difference between revisions
Appearance
Orangestar (talk | contribs) m Text replacement - "Help:Substitution" to "wikipedia:Help:Substitution" |
Orangestar (talk | contribs) m Text replacement - "Help:Magic words" to "wikipedia:Help:Magic words" |
||
| Line 77: | Line 77: | ||
===Magic words=== | ===Magic words=== | ||
[[Help:Magic words|Magic words]] are not examples of transclusion. But some have a similar double curly-bracket syntax and action to transclusion. For example, <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME}}</syntaxhighlight> renders the [[Wikipedia:Page name|Fullpagename]] of any Wikipedia page. Like templates, some magic words can also take parameters, which are separated using a colon (:); for example <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME:value}}</syntaxhighlight>. | [[wikipedia:Help:Magic words|Magic words]] are not examples of transclusion. But some have a similar double curly-bracket syntax and action to transclusion. For example, <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME}}</syntaxhighlight> renders the [[Wikipedia:Page name|Fullpagename]] of any Wikipedia page. Like templates, some magic words can also take parameters, which are separated using a colon (:); for example <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME:value}}</syntaxhighlight>. | ||
Templates do exist for some magic words, for example [[Template:FULLPAGENAME]]; but these just invoke the related magic word if passing parameters using a vertical bar (|); for example like <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME|value}}</syntaxhighlight>. But magic words parameters are best passed directly by using a colon, for example like <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME:value}}</syntaxhighlight>, which bypasses any templates. | Templates do exist for some magic words, for example [[Template:FULLPAGENAME]]; but these just invoke the related magic word if passing parameters using a vertical bar (|); for example like <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME|value}}</syntaxhighlight>. But magic words parameters are best passed directly by using a colon, for example like <syntaxhighlight lang="wikitext" inline>{{FULLPAGENAME:value}}</syntaxhighlight>, which bypasses any templates. | ||
===Transclusion modifiers=== | ===Transclusion modifiers=== | ||
As discussed above, with the example <syntaxhighlight lang="wikitext" inline>{{subst:Like}}</syntaxhighlight>, the <code>subst:</code> code alters the transclusion to substitution. This is a ''transclusion modifier'', a type of specialist magic word for altering transclusion in some manner. Another example is <syntaxhighlight lang="wikitext" inline>{{:Notability}}</syntaxhighlight>, where the <code>:</code> (colon character) forces transclusion to the main namespace. There are additional transclusion modifiers such as <code>safesubst:</code>, <code>int:</code>, <code>msg:</code>, <code>msgnw:</code>, and <code>raw:</code>. For more details on their usage, see {{slink|mw:Help:Magic words#Transclusion modifiers}}. Also see the modified commands <code>#section:</code>, <code>#section-x:</code> and <code>#section-h:</code> used for [[Help:Labeled section transclusion|labeled section transclusion]]. | As discussed above, with the example <syntaxhighlight lang="wikitext" inline>{{subst:Like}}</syntaxhighlight>, the <code>subst:</code> code alters the transclusion to substitution. This is a ''transclusion modifier'', a type of specialist magic word for altering transclusion in some manner. Another example is <syntaxhighlight lang="wikitext" inline>{{:Notability}}</syntaxhighlight>, where the <code>:</code> (colon character) forces transclusion to the main namespace. There are additional transclusion modifiers such as <code>safesubst:</code>, <code>int:</code>, <code>msg:</code>, <code>msgnw:</code>, and <code>raw:</code>. For more details on their usage, see {{slink|mw:wikipedia:Help:Magic words#Transclusion modifiers}}. Also see the modified commands <code>#section:</code>, <code>#section-x:</code> and <code>#section-h:</code> used for [[Help:Labeled section transclusion|labeled section transclusion]]. | ||
==Applications of transclusion== | ==Applications of transclusion== | ||