Koha Test Wiki MW Canasta on Koha Portainer

Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.

For the current Koha Wiki, visit https://wiki.koha-community.org .

Template:Excerpt

From Koha Test Wiki MW Canasta on Koha Portainer
Jump to navigation Jump to search

Lua error in Module:Effective_protection_level at line 60: attempt to index field 'TitleBlacklist' (a nil value).

Template documentation[view] [edit] [history] [purge]

Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value). Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).

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

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

File:How to excerpt.webm

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 Template:Pf, Template:Pf, and Template:Pf (abbreviated Template:Pf, Template:Pf, and Template:Pf)) parser functions can be used instead of this template. Template:Pf will transclude the section of "article" with the header "section", and Template:Pf 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 Template:Pf 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}}

Script error: No such module "Excerpt/templates". Template:Sources-talk

Specific section

{{Excerpt|Science|Branches of science}}

Script error: No such module "Excerpt/templates". Template:Sources-talk

Table only

{{Excerpt|Science|Branches of science|only=table}}

Script error: No such module "Excerpt/templates".

File only

{{Excerpt|Science|19th century|only=file|files=2}}

Script error: No such module "Excerpt/templates".

List only

{{Excerpt|Indian philosophy|Orthodox schools|only=list}}

Script error: No such module "Excerpt/templates". Template:Sources-talk

Specific fragment

{{Excerpt|2020 Republican Party presidential primaries|fragment=declared|this=These tables are}}

Script error: No such module "Excerpt/templates". Template:Sources-talk Template:Sources-talk

See also

Template data

This template is used for transcluding part of an article into another article.

Template parameters

ParameterDescriptionTypeStatus
Article1 article

Title of the article to transclude

Example
Science
Pagerequired
Section2 section

Title of the section to transclude

Example
History
Stringoptional
Onlyonly

Reduce the transcluded content to this element only

Example
table
Stringoptional
Fragmentfragment

Name of the fragment to transclude

Example
definition
Stringoptional
Thisthis

Change the initial text of the hatnote

Example
This gallery is
Stringoptional
No hatnotenohat

Whether to remove the hatnote

Example
yes
Booleanoptional
Indicatorindicator

Whether to indicate the start and finish of the excerpt

Example
yes
Booleanoptional
Paragraphsparagraphs

What paragraphs to transclude

Example
1-3,5
Stringoptional
Filesfiles

What files to transclude

Default
1
Example
1-3,5
Stringoptional
Tablestables

Determines whether to transclude tables or not

Default
yes
Example
no
Booleanoptional
Referencesreferences

Determines whether to transclude references or not

Default
yes
Example
no
Booleanoptional
Subsectionssubsections

Whether to transclude the subsections of the requested section

Example
yes
Booleanoptional
Tagtag

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
Stringoptional