Template:Excerpt
<languages />
This template uses Lua: |
<translate> This template is used for reusing parts of pages in other pages.</translate> <translate> This practice has several advantages:</translate>
<translate>
- Reduces maintenance by avoiding duplicate content that must be updated multiple times</translate>
<translate>
- Improves content quality by encouraging editors to merge related content, rather than having multiple versions in various stages of development</translate>
<translate>
- Fosters collaboration by channeling contributors into one place, rather than working in parallel
This template extends the capabilities of the built-in [[<tvar name=1>Special:MyLanguage/Transclusion</tvar>|normal transclusion]].
Usage
Basic usage
</translate>
{{Excerpt|Page title}}
— <translate> Transclude the lead section ([[<tvar name=1>#Lead section</tvar>|example]])</translate>{{Excerpt|Page title|Section title}}
— <translate> Transclude a specific section, excluding any subsections ([[<tvar name=1>#Specific section</tvar>|example]])</translate>
<translate>
Parameters
</translate>
1
— <translate> Title of the page to transclude.</translate> <translate> Only required parameter.</translate> <translate> By default the lead section will be transcluded ([[<tvar name=1>#Lead section</tvar>|example]]).</translate>2
— <translate> Title of the section to transclude ([[<tvar name=1>#Specific section</tvar>|example]]) or name of the [[<tvar name=2>Special:MyLanguage/Extension:Labeled Section Transclusion#How it works</tvar>|<tvar name=3><section>
</tvar> tag]] to transclude.</translate> <translate> Notice that this template provides other ways of targeting specific elements of a page without having to resort to section tags.</translate>only
— <translate> Elements to transclude ([[<tvar name=1>#Files only</tvar>|example]]).</translate> <translate> By default all elements are transcluded.</translate>only=file
<translate> or</translate>only=files
— <translate> Transclude only files</translate>only=list
<translate> or</translate>only=lists
— <translate> Transclude only lists</translate>only=table
<translate> or</translate>only=tables
— <translate> Transclude only tables</translate>only=template
<translate> or</translate>only=templates
— <translate> Transclude only templates</translate>only=paragraph
<translate> or</translate>only=paragraphs
— <translate> Transclude only paragraphs</translate>
paragraphs
— <translate> Paragraphs to transclude.</translate> <translate> By default all paragraphs are transcluded.</translate>paragraphs=0
— <translate> Transclude no paragraphs</translate>paragraphs=1
— <translate> Transclude the first paragraph</translate>paragraphs=2
— <translate> Transclude the second paragraph</translate>paragraphs=1,3
— <translate> Transclude the first and third paragraphs</translate>paragraphs=1-3
— <translate> Transclude the first, second and third paragraphs</translate>paragraphs=1-3,5
— <translate> Transclude the first, second, third and fifth paragraphs</translate>paragraphs=-1
— <translate> Transclude all paragraphs except the first</translate>paragraphs=-2
— <translate> Transclude all paragraphs except the second</translate>paragraphs=-1,3
— <translate> Transclude all paragraphs except the first and third</translate>paragraphs=-1-3
— <translate> Transclude all paragraphs except the first, second and third</translate>paragraphs=-1-3,5
— <translate> Transclude all paragraphs except the first, second, third and fifth</translate>
lists
— <translate> Lists to transclude.</translate> <translate> By default all lists are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs.</translate>files
— <translate> Files to transclude.</translate> <translate> By default all files are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>files=A.jpg
— <translate> Transclude the file named '<tvar name=1>A.jpg</tvar>'</translate>files=A.jpg, B.png, C.gif
— <translate> Transclude the files named '<tvar name=1>A.jpg</tvar>', '<tvar name=2>B.png</tvar>' and '<tvar name=3>C.gif</tvar>'</translate>files=.+%.png
— <translate> Transclude all PNG files</translate>files=-A.jpg
— <translate> Transclude all files except the one named '<tvar name=1>A.jpg</tvar>'</translate>files=-A.jpg, B.png, C.gif
— <translate> Transclude all files except the ones named '<tvar name=1>A.jpg</tvar>', '<tvar name=2>B.png</tvar>' and '<tvar name=3>C.gif</tvar>'</translate>files=-.+%.png
— <translate> Transclude all non-PNG files</translate>
tables
— <translate> Tables to transclude.</translate> <translate> By default all tables are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>tables=Stats2020
— <translate> Transclude the table with id '<tvar name=1>Stats2020</tvar>'</translate>tables=Stats2020, Stats2019, Stats2018
— <translate> Transclude the tables with ids '<tvar name=1>Stats2020</tvar>', '<tvar name=2>Stats2019</tvar>' and '<tvar name=3>Stats2018</tvar>'</translate>tables=-Stats2020
— <translate> Transclude all tables except the one with id '<tvar name=1>Stats2020</tvar>'</translate>tables=-Stats2020, Stats2019, Stats2018
— <translate> Transclude all tables except the ones with ids '<tvar name=1>Stats2020</tvar>', '<tvar name=2>Stats2019</tvar>' and '<tvar name=3>Stats2018</tvar>'</translate>
templates
— <translate> Templates to transclude.</translate> <translate> By default all templates are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>templates=Infobox
— <translate> Transclude the template '<tvar name=1>Infobox</tvar>'</translate>templates=Infobox, Navbox, Chart
— <translate> Transclude the template '<tvar name=1>Infobox</tvar>', '<tvar name=2>Navbox</tvar>' and '<tvar name=3>Chart</tvar>'</translate>templates=-Infobox
— <translate> Transclude all templates except '<tvar name=1>Infobox</tvar>'</translate>templates=-Infobox, Navbox, Chart
— <translate> Transclude all templates except '<tvar name=1>Infobox</tvar>', '<tvar name=2>Navbox</tvar>' and '<tvar name=3>Chart</tvar>'</translate>
this
— <translate> Change the initial text of the hatnote. For example, if the transcluded content is a gallery, you can set <tvar name=1>this=This gallery is
</tvar> so that the hatnote reads "This gallery is an excerpt from..."</translate>hat=no
— <translate> Hide the hatnote "This section is an excerpt from..."</translate>more=yes
— <translate> Show a "Read more..." link at the end</translate>bold=yes
— <translate> Keep bold text.</translate>quote=yes
— <translate> Wrap the excerpt with <tvar name=1><blockquote>
</tvar> tags.</translate>inline=yes
— <translate> Remove the hatnote and <tvar name=1><div>
</tvar> tags around the excerpt, to use it inside other text.</translate>references=no
— <translate> Remove all references.</translate>subsections=yes
— <translate> Include subsections of the transcluded section. 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.</translate>
<translate>
Replacing sections for excerpts
</translate> File:How to excerpt.webm
<translate> Sections are often summaries of more precise subpages.</translate> <translate> Sometimes it's convenient to replace the content of such sections for excerpts of the subpages, after merging the original content of the section (if any) into the subpage.</translate> <translate> This improves both the subpage and the section, reduces maintenance, drives contributors to collaborate, etc.</translate>
<translate> An efficient way to proceed is:</translate>
<translate>
- Open the section in one tab and the subpage in another.</translate>
<translate>
- Edit both.</translate>
<translate>
- Copy the text of the section and paste it below the lead section of the subpage.</translate>
<translate>
- Delete repeated content and adjust using common sense.</translate>
<translate>
- Save the changes in the subpage with an edit summary like: Bring content from <tvar name=1>[[Page]]</tvar>.</translate>
<translate>
- Back to the section, delete all content and replace it for an excerpt of the subpage.</translate>
<translate>
- Save the changes in the section with an edit summary like: Move content to <tvar name=1>[[Subpage]]</tvar> and leave an excerpt.
Examples
Lead section
</translate>
{{Excerpt|Lorem ipsum}}
Template:Reflist Template:Clear
<translate>
Specific section
</translate>
{{Excerpt|Lorem ipsum|Section}}
<translate>
Files only
</translate>
{{Excerpt|Lorem ipsum|only=files|hat=no}}
<translate>
Infobox only
</translate>
{{Excerpt|Extension:CategoryLockdown|only=templates|templates=Extension|this=This infobox is}}
<translate>
No infobox
</translate>
{{Excerpt|Extension:CategoryLockdown|templates=-Extension}}
<translate>
Portal
</translate>
{{Excerpt|Lorem ipsum|files=1|references=no|hat=no|more=yes}}
<translate>
See also
</translate>
<translate>
Template data
</translate> Lua error in Module:TNT at line 124: mw.text.jsonEncode: Cannot use type 'boolean' as a table key.