Différences entre versions de « Help/Transclusion »

De Rich Annotator System
m (A protégé « Help/Transclusion » ([Modifier=Autoriser uniquement les administrateurs] (infini) [Renommer=Autoriser uniquement les administrateurs] (infini)))
Ligne 1 : Ligne 1 :
'''Transclusion''' is the inclusion of the content of a document into another document by reference.
+
'''Transclusion''' is the inclusion of the content of a document into another document by reference. Beyond template transclusion, it is particularly useful in full text division in [[Help/Texts#Full_text_divided_into_multiple_parts|multiple parts]] and [[Help/Annotations along the text|annotations along the text]]. 
  
 
====Syntax====
 
====Syntax====

Version du 3 novembre 2020 à 14:06

Transclusion is the inclusion of the content of a document into another document by reference. Beyond template transclusion, it is particularly useful in full text division in multiple parts and annotations along the text.

Syntax

If the source is a template, just use the name itself, alone:

If the source is in not a template, a colon (:) must be added in front of the name. This is the case when you assemble multiple parts of a full text into one page. For example, the page Du côté de chez Swann/Texte intégral assembles (partially) three pages: {{Du côté de chez Swann/Partie 1}}, {{Du côté de chez Swann/Partie 2}} and {{Du côté de chez Swann/Partie 3}}.

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

Transclusion markup

  • noinclude - The markup <noinclude>...</noinclude> 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 categories and interlanguage links.
  • includeonly - The markup <includeonly>...</includeonly> 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.
  • onlyinclude - The markup <onlyinclude>...</onlyinclude> 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 <noinclude> and <includeonly>, <onlyinclude> will take precedence over enclosing <nowiki> tags. In other words, <nowiki> <onlyinclude>My content</onlyinclude> </nowiki> produces only "My content" when transcluded.

For example, Du côté de chez Swann/Texte intégral partially transcludes three pages. The <div> block on the top of each part ("Du côté de chez Swann/Partie 1", "Du côté de chez Swann/Partie 2", "Du côté de chez Swann/Partie 3"), containing basic information about the text, is between <noinclude> tags, and a <div> block, with relevant information about the whole text, is on the top of the full text page, before transclusion tags.


Back to contents