Transclusion/fr

La transclusion consiste généralement en l'inclusion du contenu d'un document dans un autre document par référence. Dans le contexte de Wikipédia, il s'agit de l'utilisation de la fonction modèle de MediaWiki pour inclure le même contenu dans de multiples documents sans avoir à éditer chacun de ces document séparément. La transclusion de modèles est la manière généralement utilisée pour utiliser les modèles de messages, et est implémentée par l'utilisation d'une balise modèle de la forme :

Comment fonctionne la transclusion


 Syntaxe des modèles

Si la source est dans l'espace de nom principal (par exemple "Cat"), placez un symbole « deux points » devant le nom :

Si la source est dans l'espace de nom Modèle (par exemple "Template:Villagepumppages"), utilisez simplement le nom du modèle :

Si la source est dans tout autre espace de nom (par exemple "User:Example"), vous devez utiliser le nom complet incluant l'espace de nom :

Pour transclure n'importe quelle page source (au sein d'un même projet MediaWiki, tel que fr:Wikipédia) à l'intérieur d'une autre page cible, utilisez le code suivant :

Lorsque la page cible A contenant ce code est affichée, le moteur inclura l'ensemble de la page source B à la place du code, SOMEPAGE.



Par exemple, vous pouvez décidez de placer un message de bienvenue sur la page de discussion de chaque nouvel inscrit. La transclusion créera un lien « en direct » entre la page du modèle et les pages cible sur lesquelles le message doit apparaitre. Lorsque le modèle sera modifié, toutes les pages cibles seront modifiées également.

For example, you might decide to create a (template) page with your mailing address and include that template on not only your page, but all your friends' pages, too. When you move your television and couch to another apartment, you will change your address template, and automatically, that new information will appear on all your friends' pages.

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 desirable not to transclude some information, such as template documentation.

For an example of how this technique can be applied to simplify the creation of summary articles, see how History of pathology was transcluded into Pathology,  which consisted of a collection of transcluded lead paragraphs from several main articles.

Balises de transclusion

 * noinclude. The markup  means that the text between the tags will not be transcluded onto another page, but will only appear on the page itself. This is useful for documentation.
 * includeonly. The markup  means that the text between the tags will only be used when the page is transcluded onto another page, and will not appear on the page itself. This can be useful, for example, for adding categories to pages transcluding a template, without adding the template itself to these categories.
 * onlyinclude. The markup  indicates that only text surrounded by "onlyinclude" markup should be transcluded onto another page. This is the most subtle of the partial transclusion tags because it often overrules the others. If there is at least one pair of "onlyinclude" tags on a page, then whenever this page is transcluded, it is only the material within the "onlyinclude" tags which gets transcluded. There can be several such sections, and within each such section, some material might be further excluded by "noinclude" tags, and might also be surrounded by "includeonly" tags so that it does not appear on the original page itself. But material outside the "onlyinclude" tags will be ignored when the page is transcluded onto another page. This can be useful, for example, to repeat a small part of one page on a second one: just surround the small part by onlyinclude tags, and transclude it onto the second page. Note that unlike and,  will take precedence over enclosing  tags. In other words, My content produces only "My content" when transcluded.

Example of how to transclude the lead of an article
[ Edit Source to see how this works ]

The lead section (also known as the lead, introduction or intro) of a Wikipedia article is the section before the table of contents and the first heading. The lead serves as an introduction to the article and a summary of its most important contents. It is not a news-style lead or lede paragraph.

Subpages
You can cut and paste the text to be transcluded into a subpage, then use the name of the subpage in the transclusion template. This approach can only be used where subpages are enabled; for example, on the English Wikipedia, subpages can only be used from User, Talk or Wikipedia pages; currently, subpages 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  . Comments posted in either talk page will be shown in both.

Special pages

 * See also:w:Wikipedia:Transclusion and Manual:$wgAllowSpecialInclusion

Some pages on Special:Specialpages can be transcluded, such as Special:AllPages, Special:PrefixIndex, Special:NewFiles, Special:NewPages, Special:RecentChanges and Special:RecentChangesLinked.

Sample: gives 3 new pages.

URL parameters can be given like template parameters, e. g..

Alternatives to transclusion by template
Occasionally you 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 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 subst:, creating a tag with the form:.

The content of a page can also be transcluded from a namespace other than "Template". See http://meta.wikimedia.org/wiki/Help:Embed_page.

Labeled Section Transclusion
An extension called Labeled Section Transclusion enables marked sections of text to be transcluded. An extension with a somewhat similar function is PageVariableExtension.

Semantic MediaWiki
The Semantic MediaWiki extension uses inline queries to query and display semantic data. There are currently two ways to perform transclusion or something similar: See http://semantic-mediawiki.org/wiki/Help:Inline_queries for further information.
 * 1) Transclusion proper. The display format "embedded" ensures that selected pages (mainspace articles, templates, etc.) are transcluded. As with templates, sections placed between noinclude tags will be omitted.
 * 2) Selected passages in a page can be assigned a property of type 'Text'. These selections can be requested by running an inline query for this type of property.

Pages related to MediaWiki transclusion

 * MediaWiki namespace
 * m:Help:MediaWiki namespace
 * m:Help:Variable
 * w:Wikipedia talk:Template namespace

Templates

 * Help:Template
 * w:Wikipedia:Template namespace
 * w:Wikipedia:Template limits