Différences entre versions de « Help/Transclusion »

De Rich Annotator System
Ligne 11 : Ligne 11 :
 
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.
 
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'''<br>
+
'''Transclusion markup'''
 
* '''noinclude''' - The markup <code><nowiki><noinclude>...</noinclude></nowiki></code> 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 [[Help/Categories|categories]] and [[Help/Interlanguage links|interlanguage links]].
 
* '''noinclude''' - The markup <code><nowiki><noinclude>...</noinclude></nowiki></code> 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 [[Help/Categories|categories]] and [[Help/Interlanguage links|interlanguage links]].
* includeonly - The markup <code><nowiki><includeonly>...</includeonly></nowiki></code> 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''.
+
* '''includeonly''' - The markup <code><nowiki><includeonly>...</includeonly></nowiki></code> 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 <code><nowiki><onlyinclude>...</onlyinclude></nowiki></code> 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 <code><nowiki><noinclude></nowiki></code> and <code><nowiki><includeonly></nowiki></code>, <code><nowiki><onlyinclude></nowiki></code> will take precedence over enclosing <code><nowiki><nowiki></nowiki></code> tags. In other words, <code><nowiki><nowiki><onlyinclude>My content</onlyinclude></nowiki></nowiki></code> produces only "My content" when transcluded.
+
* '''onlyinclude''' - The markup <code><nowiki><onlyinclude>...</onlyinclude></nowiki></code> 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 <code><nowiki><noinclude></nowiki></code> and <code><nowiki><includeonly></nowiki></code>, <code><nowiki><onlyinclude></nowiki></code> will take precedence over enclosing <code><nowiki><nowiki></nowiki></code> tags. In other words, <code><nowiki><nowiki> <onlyinclude>My content</onlyinclude> </nowiki></nowiki></code> produces only "My content" when transcluded.
 +
 
 +
For example, [[Du côté de chez Swann/Texte intégral]] partially transcludes three pages. The <code><nowiki><div></nowiki></code> 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 <code><nowiki><noinclude></nowiki></code> tags, and a <code><nowiki><div></nowiki></code> block, with relevant information about the whole text, is on the top of the full text page, before transclusion tags.
  
  

Version du 3 novembre 2020 à 12:27

Transclusion is the inclusion of the content of a document into another document by reference.

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