Template:Excerpt/doc

From The League Wiki
Jump to navigation Jump to search

Lua error in Module:TNT at line 159: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Uses TemplateStyles.tab.

This template is used for transcluding part of an article into another article. This template extends the capabilities of the built-in Help:Labeled section transclusion function.

Usage

Basic usage

  • {{Excerpt|Title of the article}} — Transclude the lead section of an article (example).
  • {{Excerpt|Title of the article|Title of the section}} — Transclude a specific section excluding any subsections (example).

Parameters

  • 1 or article — Title of the article to transclude. Only required parameter. If no other parameters are used, the lead section will be transcluded (example).
  • 2 or section — Title of the section to transclude (example).
  • only — Reduce the transcluded content to this element only
    • only=table or only=tables — Transclude only the tables of the requested section (example).
    • only=list or only=lists — Transclude only the lists of the requested section (example).
    • only=file or only=files — Transclude only the files of the requested section, optionally cherry-picked with the files parameter (example).
  • fragment — Name of the fragment to transclude. Must be marked with <section begin=Name of the fragment/> and <section end=Name of the fragment/> in the transcluded article (example).
  • this — Change the initial text of the hatnote. For example, if the transcluded content is a gallery, you can set this=This gallery is so that the hatnote reads "This gallery is an excerpt from..." (example).
  • nohat — Hide the hatnote "This section is an excerpt from..."
  • paragraphs — Specify the paragraphs to transclude. For example 1-3,5 will transclude paragraphs 1, 2, 3 and 5. By default all paragraphs are transcluded. Notice that if the paragraph order changes in the source article, the transcluded paragraphs will change too and without any notice, so use with caution. Doesn't work with fragment.
  • files — Specify the files to transclude. For example 1-3,5 will transclude files 1, 2, 3 and 5. By default only the first file is transcluded. Doesn't work with fragment.
  • indicator — Determines whether to show a vertical bar along the excerpt to indicate where it starts and where it ends. By default none is shown. Set to yes to cause it to show.
  • references — Determines whether to transclude references or not. By default all references are transcluded. Set to no to prevent it.
  • tables — Determines whether to transclude tables or not. By default all tables are transcluded. Set to no to prevent it.
  • subsections — Use together with section to transclude the entire section including any subsections. Notice that if the transclusion is done from a section level 3, and the transcluded subsections are level 3 too, then the transcluded subsections will show with the same hierarchy as the transcluding section, which is probably not desirable, so use with caution.
  • tag — By default the excerpt is wrapped with <div> tags. Set to span to wrap it with <span> tags instead.

Replacing Template:Main

How to replace a section for an excerpt.

Sections are often summaries of more precise subarticles (generally linked with Template:Main). Sometimes it's convenient to replace such sections for excerpts of the subarticles, after merging the original content of the section (if any) in the subarticle. This improves both the subarticle and the section, reduces maintenance, drives contributors to collaborate, etc.

An efficient way to proceed is:

  1. Open the section in one tab and the subarticle in another.
  2. Edit both.
  3. Copy the text of the section and paste it below the lead section of the subarticle.
  4. Delete repeated content and adjust using common sense.
  5. Save the changes in the subrticle with an edit summary like: Bring content from [[Article]].
  6. Back to the section, delete all content and replace it for an excerpt of the subarticle.
  7. Save the changes in the section with an edit summary like: Move content to [[Subarticle]] and leave an excerpt.

Compared to #section

For simple cases of transcluding sections of articles, the {{#section}}, {{#section-x}}, and {{#section-h}} (abbreviated {{#lst}}, {{#lstx}}, and {{#lsth}})) parser functions can be used instead of this template. {{#lsth:article|section}} will transclude the section of "article" with the header "section", and {{#lsth:article}} will transclude the lead section of "article". Excerpting only specific paragraphs can be done by marking up the source article with <section>...</section> tags and using {{#lst:fragmentname}} to transclude those fragments, which is equivalent to using the |fragment= parameter with this template. <lsth>...</lsth> can also be used to transclude everything but those fragments.

The text will not be trimmed of excess whitespace, there will not be a header (equivalent to |nohat=yes, and all files, templates, tables, references, and subsections will be included unless the source article is marked up with <section>...</section>, <noinclude>...</noinclude>, or <onlyinclude>...</onlyinclude> tags. Self links will appear in bold.

Examples

Lead section

{{Excerpt|Science}}
Excerpt error: Page 'Science' not found
Sources

Specific section

{{Excerpt|Science|Branches of science}}
Excerpt error: Page 'Science' not found
Sources

Table only

{{Excerpt|Science|Branches of science|only=table}}
Excerpt error: Page 'Science' not found

File only

{{Excerpt|Science|19th century|only=file|files=2}}
Excerpt error: Page 'Science' not found

List only

{{Excerpt|Indian philosophy|Orthodox schools|only=list}}
Excerpt error: Page 'Indian philosophy' not found
Sources

Specific fragment

{{Excerpt|2020 Republican Party presidential primaries|fragment=declared|this=These tables are}}
Excerpt error: Page '2020 Republican Party presidential primaries' not found
Sources

Notes

See also

Template data

<templatedata> { "params": { "1": { "aliases": [ "article" ], "label": "Article", "description": "Title of the article to transclude", "example": "Science", "type": "wiki-page-name", "required": true }, "2": { "aliases": [ "section" ], "label": "Section", "description": "Title of the section to transclude", "example": "History", "type": "string" }, "fragment": { "label": "Fragment", "description": "Name of the fragment to transclude", "example": "definition", "type": "string" }, "nohat": { "description": "Whether to remove the hatnote", "label": "No hatnote", "example": "yes", "type": "boolean" }, "paragraphs": { "label": "Paragraphs", "description": "What paragraphs to transclude", "example": "1-3,5", "type": "string" }, "files": { "label": "Files", "description": "What files to transclude", "example": "1-3,5", "type": "string", "default": "1" }, "subsections": { "label": "Subsections", "description": "Whether to transclude the subsections of the requested section", "example": "yes", "type": "boolean" }, "indicator": { "label": "Indicator", "description": "Whether to indicate the start and finish of the excerpt", "example": "yes", "type": "boolean" }, "tag": { "description": "Allows use of \"span\" rather than \"div\" for when you don't want a line break before or after the excerpt", "default": "div", "example": "span", "type": "string", "label": "Tag" }, "tables": { "label": "Tables", "description": "Determines whether to transclude tables or not", "example": "no", "type": "boolean", "default": "yes" }, "references": { "label": "References", "description": "Determines whether to transclude references or not", "example": "no", "type": "boolean", "default": "yes" }, "only": { "label": "Only", "description": "Reduce the transcluded content to this element only", "example": "table", "type": "string" }, "this": { "label": "This", "description": "Change the initial text of the hatnote", "example": "This gallery is", "type": "string" } }, "description": "This template is used for transcluding part of an article into another article.", "paramOrder": [ "1", "2", "only", "fragment", "this", "nohat", "indicator", "paragraphs", "files", "tables", "references", "subsections", "tag" ] } </templatedata>