Transclusion/ru

Трансклюзия - это включение содержимого одного документа в другой с помощью простановки ссылки (reference). В Вики это использование шаблонов  от MediaWiki  для включения одного контента в несколько документов без необходимости редактировать каждый из них по отдельности.

Механизм трансклюзии



 Синтаксис

Если источник находится в пространстве имён Шаблон (англ. Template) (например, шаблон приветствия "Welcome" (Template:Welcomeна английском в MediaWiki или "Добро пожаловать" в русской версии Википедии), просто вставьте это имя / название шаблона само по себе:

Если источник находится в основном пространстве имён статей (например, визуальный редактор "VisualEditor"), перед названием следует вставить двоеточие :

Если источник находится в любом другом пространстве имён (например, участников (users) вики "User:Example" "Участник:Такой-то"), требуется указать полное название страницы, включая пространство имён, где она находится:

Если источник - какая-то из подстраниц целевой страницы, (например, подстраница на японском языке страницы о трансклюзии  "Transclusion/ja"), можете просто указать имя  исходной подстраницы вне зависимости от того, в каком она пространстве имён:



Для трансклюзии любой страницы - "источника" (внутри какого-либо одного проекта MediaWiki, такого как Википедия) на другую страницу вставьте следующий код:, где вместо SOMEPAGE подставьте название исходной страницы.

Когда мы передаём содержимое страницы B на странице A, оно полностью отобразится там, где мы вставим шаблон трансклюзии - название упоминаемой страницы в двойных фигурных скобках

For example, you might decide to place a welcome message on every newcomer's talk page. Transclusion creates a "live" link between the template-page and the target-page(s) upon which the message should appear. When the template is edited, all the target-pages are edited too.

You might also decide to create a (template) page with your mailing address and include that template on not only your page, but all your friends' pages as well. When you move your television and couch to another apartment, you can change your address template, and that new information will automatically update on all your friends' pages.

Происхождение термина

Ted Nelson coined the term "transclusion", as well as "hypertext" and "hypermedia", in his 1982 book Literary Machines.

Частичная трансклюзия

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 and categories.

Transclusion markup

 * noinclude - The markup  means that the text between the tags will not be transcluded onto another page and will appear only on the page itself. This is useful for template documentation and categories.
 * 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, but will appear on the page itself if not accompanied by "includeonly" tags as well. 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.

Подстраницы
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 be used only where subpages are enabled; for example, on the English Wikipedia, subpages can be used only 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.

Служебные страницы

 * See also:w:Wikipedia:Transclusion and 

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:.

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 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

Шаблоны

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

Смотрите также

 * Request for template transclusion from Commons (interwiki templates, etc.)
 * w:Wikipedia:Substitution (the opposite of transclusion)
 * Extension:Labeled Section Transclusion

fa:ویکی‌پدیا:تراگنجانش fr:Wikipédia:Inclusion ko:위키백과:문서 끼워넣기 yi:װיקיפּעדיע:אריינשטעלן zh:Wikipedia:嵌入包含 pt:Wikipedia:Predefinições