Content deleted Content added
→Markup: add the memory aid "inTransclusion" for insertion between the two words of each tag name |
←Replaced content with '.....' |
||
Line 1: | Line 1: | ||
..... |
|||
{{redirect3|WP:TRANS|You may be looking for [[Wikipedia:Transwiki log]], [[Help:Transwiki]], [[Wikipedia:Translation]] or [[Wikipedia:WikiProject Transwiki]]}} |
|||
{{shortcut|WP:TRANS}} |
|||
'''[[Transclusion]]''' is the inclusion of the content of a document into another document by reference. In the Wikipedian context, it is the use of the [[Wikipedia:Template messages|template functionality]] of [[MediaWiki]] to include the same content in multiple documents without having to edit those documents separately. Template transclusion is the common way to use template messages, and is implemented by using a template tag, with this form: |
|||
:<code><nowiki>{{template name}}</nowiki></code> |
|||
Occasionally one may want to use a template, but for one reason or another may not want to use transclusion. The automatic one-time copying of a template's code/text to the location of a template tag is called [[Wikipedia:Substitution|Template substitution]] or subclusion (substitution + transclusion). To subclude a template's code/text, the template tag is modified from the standard transclusion tag to a substitution tag, simply by adding <code>subst:</code>, creating a tag with the form: <code>{{tls|Template name}}</code>. |
|||
{{/How Transclusion Works}} |
|||
== Etymology == |
|||
[[Ted Nelson]] coined the term "[[transclusion]]," as well as "[[hypertext]]" and "[[hypermedia]]", in his 1982 book, ''[[Literary Machines]]''. |
|||
==Partial transclusion== |
|||
By using "noinclude", "onlyinclude" and "includeonly" markup, it is possible to transclude part of a page rather than all of it. Such partial transclusions can also be achieved by transcluding from other pages such as subpages. It is often useful not to transclude some information, such as template documentation. |
|||
For an example of how this technique can be applied to simplify the creation of [[WP:SS|summary articles]], see [[Pathology]], which consists of a collection of transcluded [[WP:LEAD|lead paragraphs]] from several main articles. |
|||
{{anchor|Transclusion markup}} <!--Temp anchor |
|||
until renamed section is checked for link breakage via ''what links here''--> |
|||
===Markup=== |
|||
{{also|Help:Template#Noinclude, includeonly, and onlyinclude|Help:Category#Categories_and_templates}} |
|||
There are three pairs of [[html element|tags]] that can be used in [[wikitext]] to control how transclusion affects '''''[[HTML#Elements|elements]]''''' of a template or article. |
|||
They determine whether or not wikitext renders, either in its own article, which we will call "'''here'''", or in another article where it is transcluded, which we will call "'''there'''". |
|||
*'''<nowiki><noinclude></nowiki>: ''' the content '''will not be rendered ''there'''''. These tags have no effect ''here''. |
|||
*'''<nowiki><includeonly></nowiki>: ''' the content '''will render only ''there''''', and will not render ''here'' (like [[invisible ink]] made visible by means of transclusion). |
|||
*'''<nowiki><onlyinclude></nowiki>:''' the ''element'' will render ''here'' and will render ''there'', but it '''will exclude the rest of the article from rendering ''there'''''. |
|||
There can be several such section ''elements''. Also, they can be nested. All possible renderings are achievable. For example, to render ''there'' one or more sections of the page ''here'' use '''<nowiki><onlyinclude></nowiki>''' tags. To append text ''there'', wrap the addition in '''<nowiki><includeonly></nowiki>''' tags above, within, or below the section. To omit portions of the section, nest '''<nowiki><noinclude></nowiki>''' tags within it. |
|||
As a memory aid insert the phrase ''in transclusion'' between the two words to get "noInTransclusionInclude", "includeInTransclusionOnly" and "onlyInTransclusionInclude". |
|||
{{for example|m:template:information thread|the wikitext of the the wiki news thread.}} |
|||
===Subpages=== |
|||
One can cut and paste the text to be transcluded into a [[Wikipedia:Subpages|subpage]], then use the name of the subpage in the transclusion template. This approach can only be used with subpages from User, Talk or Wikipedia pages; currently, subpages [[Wikipedia:Subpages#Articles do not have sub-pages (main namespace)|cannot be created from main article pages]]. |
|||
Example: you want to discuss the deletion and redirecting of [[Pussycat]] to [[Cat]]. First, create the subpage [[Talk:Pussycat/Let's delete Pussycat!]], write your comment into it, then transclude it in [[Talk:Pussycat]] and [[Talk:Cat]] using the template '''<nowiki>{{Talk:Pussycat/Let's delete Pussycat!}}</nowiki>'''. Comments posted in either talk pages will be shown in both. |
|||
===Special pages=== |
|||
{{see also|Wikipedia:Special pages#Miscellaneous}} |
|||
Some pages on [[Special:Specialpages]] can be transcluded, such as [[Special:Allpages]], [[Special:Prefixindex]], [[Special:Newfiles]], [[Special:Newpages]], [[Special:Recentchanges]] and [[Special:Recentchangeslinked]]. |
|||
Samples: |
|||
*<nowiki>{{Special:Allpages/General}}</nowiki> – a list of pages starting at "General" |
|||
*<nowiki>{{Special:Prefixindex/General}}</nowiki> – a list of pages with prefix "General" |
|||
*<nowiki>{{Special:Newfiles/4}}</nowiki> – a gallery of the four most recently uploaded files |
|||
*<nowiki>{{Special:Newpages/5}}</nowiki> – a list of the five most recently created pages |
|||
*<nowiki>{{Special:Recentchanges/5}}</nowiki> – the five most recent changes |
|||
*<nowiki>{{Special:Recentchangeslinked/General}}</nowiki> – recent changes to the pages linked from "General" |
|||
Except for Special:Recentchangeslinked, the slash and the word/number after the slash can be omitted, giving a list of pages without a specific starting point, or a list of the default length. |
|||
==Pages related to [[MediaWiki]] [[transclusion]]== |
|||
* [[m:Help:A_simple_composite_example]] |
|||
* [[Wikipedia:MediaWiki namespace]] |
|||
** [[m:Help:MediaWiki namespace]] |
|||
* [[m:Help:Variable]] |
|||
*[[Wikipedia talk:Template namespace#transcluding prose]] |
|||
==Templates== |
|||
* [[Help:Template]] |
|||
* [[Wikipedia:Template namespace]] |
|||
* [[Wikipedia:Template limits]] |
|||
== See also == |
|||
* [[MediaZilla:4547|Request for template transclusion from Commons]] (interwiki templates, etc.) |
|||
* [[Wikipedia:Substitution]] (the opposite of transclusion) |
|||
[[Category:MediaWiki Help]] |
|||
[[Category:Wikipedia editing]] |
|||
[[Category:Wikipedia templates]] |
|||
[[fa:ویکیپدیا:تراگنجانش]] |
|||
[[fr:Wikipédia:Inclusion]] |
|||
[[ko:위키백과:문서 끼워넣기]] |
|||
[[yi:װיקיפּעדיע:אריינשטעלן]] |
|||
[[zh:Wikipedia:嵌入包含]] |
|||
[[pt:Wikipedia:Predefinições]] |
|||
[[simple:Wikipedia:Transclusion]] |
|||
[[pl:Wikipedia:Transkluzja]] |
Revision as of 18:21, 10 January 2010
.....