Template:Onlyinclude/doc

This is a convenience template for inserting a selective transclusion clause, as described at WP:Transclusion. It can be used to include a part of a source docu

Template:Onlyinclude/doc

This is a convenience template for inserting a selective transclusion clause, as described at WP:Transclusion. It can be used to include a part of a source document from any other target document by providing a unique keyword.

By substituting this template in the source document (see Usage below), the following will be inserted:

<onlyinclude>{{#ifeq:{{{1|keyword}}}|keyword|text to be included}}</onlyinclude>

When the source document is viewed, the text to be included will be displayed regardless of the <onlyinclude> tags.

To display the text to be included in a target document, the source document should be transcluded along with the keyword (see below).

Usage

Source document

At the source document, use the following:

{{subst:onlyinclude|id=keyword|text to be included}}

where

  • keyword is a unique keyword used for referring to the text to be included;
  • text to be included is the text that will be included in the target document when the source document is transcluded along with the keyword.

Note that this template must be substituted! (subst:)

Target document

To transclude the text to be included from the source document into the target document, use the following:

{{:PAGENAME|keyword}}

where

  • PAGENAME is the name of the source document (in article namespace);
  • keyword is the unique keyword as used in the source document.

Example

Source document

Let's assume the name of the source document is "Some City".

The following is inserted when this document is being edited:

{{subst:onlyinclude|id=population|151,853}}

Which will be substituted in the document's source by:

<onlyinclude>{{#ifeq:{{{1|population}}}|population|151,853}}</onlyinclude>

When viewing the source document, it will display:

151,853

Target document

The following is inserted in a target document:

{{:Some City|population}}

When viewing the target document, it will display:

151,853

See also


Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.