Template:Excerpt/doc: Difference between revisions
Tag: Reverted |
Tag: Manual revert |
||
Line 9: | Line 9: | ||
* <code><nowiki>{{Excerpt|Page title}}</nowiki></code> – Transclude the lead section ([[Africa#Architecture|example]]) | * <code><nowiki>{{Excerpt|Page title}}</nowiki></code> – Transclude the lead section ([[Africa#Architecture|example]]) | ||
* <code><nowiki>{{Excerpt|Page title|Section title}}</nowiki></code> – Transclude a specific section, excluding any subsections ([[Eating#Mammals|example]]) | * <code><nowiki>{{Excerpt|Page title|Section title}}</nowiki></code> – Transclude a specific section, excluding any subsections ([[Eating#Mammals|example]]) | ||
==Parameters== | |||
There is one required parameter, and numerous optional ones for configuring the excerpt: | |||
=== Summary === | |||
'''Source identification''' | |||
* {{para|1}} – Name of the article or page to transclude. '''Required.''' Aliases: {{para|article}} or {{para|page}}. | |||
* {{para|2}} – Name of the section or tag to transclude. Optional; if omitted, transcludes the lead section (content above the first section header). Aliases: {{para|section}} or {{para|fragment}}. | |||
'''Transclusion config''' | |||
Transcludable content is defined as one of several ''element types'': {{pval|file}}, {{pval|list}}, {{pval|paragraph}}, {{pval|reference}}, {{pval|subsection}}, {{pval|table}}, or {{pval|template}}. | |||
Config parameters specify which ''element type'' to transclude, and in some cases, ''how many'' and ''which'' items of that type to transclude. All config parameters are optional; if omitted, all items of all element types are transcluded from the source page identified by the two unnamed parameters. Some element types support conditional item transclusion by specifying an item number range (1-3) or comma series (1, 2, 5); these types include: files, lists, paragraphs, and tables. | |||
There are ten optional transclusion configuration parameters: | |||
* {{para|only}} – Element types to transclude. Values: {{pval|file(s)}}, {{pval|list(s)}}, {{pval|table(s)}}, {{pval|template(s)}}, {{pval|paragraph(s)}}. Default: all element types. | |||
* {{para|files}} – [[WP:FILE|Files]] to transclude. Default: all files. Same basic syntax as {{para|paragraphs}}, but see {{slink||Details}}. | |||
** {{para|onlyfreefiles|no}} – Enables transclusion of [[WP:Non-free content|non-free files]]. Default: exclude non-free content. | |||
* {{para|links|no}} – Unlink all [[H:WIKILINK|wikilinks]] and render as plain text. | |||
* {{para|lists}} – Lists ([[MOS:LIST#Bulleted lists|bulleted]], [[MOS:LIST#Numbered lists|numbered]]) to transclude. Default: all lists. Same syntax as for {{para|paragraphs}}. | |||
* {{para|paragraphs}} – [[H:PARAGRAPH|Paragraphs]] to transclude. Default: all paragraphs. | |||
* {{para|references|no}} – Exclude all [[WP:REF|references]] between <code><nowiki><ref>...</ref></nowiki></code> tags. | |||
* {{para|subsections|yes}} – Include [[MOS:SECTIONS|subsections]] of the transcluded section. Default: only content above the first subsection header. | |||
* {{para|tables}} – [[Help:Table|Tables]] to transclude. Default: all tables. Same basic syntax as {{para|paragraphs}}, but see {{slink||Details}}. | |||
* {{para|templates}} – [[Help:Template|Templates]] to transclude. By default all templates are transcluded, except those blacklisted at [[Module:Excerpt/config]]. See {{slink||Details}} for how to specify a specific template or templates for inclusion or exclusion. | |||
'''Style and extra features''' | |||
These optional parameters alter the way transcluded items are displayed: | |||
* {{para|bold|yes}} – Preserve '''bold''' text. | |||
* {{para|briefdates|yes}} – Abbreviate birth and death information to (YYYY-YYYY) format | |||
* {{para|displaytitle}} – Change the text of the link in the hatnote. For example, [[WP:ITHAT|add italics]], subscripts, etc. | |||
* {{para|hat|no}} – Hide the [[Wikipedia:Hatnote|hatnote]] "This section is an excerpt from..." | |||
* {{para|inline|yes}} – Remove the <code><nowiki><div></nowiki></code> tags around the excerpt, to use it inside other text, or to add references or other content after it [[#Suppress line breaks between paragraphs|with no paragraph break]] between them. Also hides the hatnote; to reestablish it, use {{tl|transclusion notice}} above the Excerpt invocation. | |||
* {{para|quote|yes}} – Wrap the excerpt with <code><nowiki><blockquote></nowiki></code> tags. | |||
* {{para|this}} – Change the initial text of the hatnote. For example, if the transcluded content is a gallery, you can set {{para|this|This gallery is}} so that the hatnote reads "This gallery is an excerpt from..." | |||
=== Details === | |||
* {{para|1}} or {{para|article}} or {{para|page}} | |||
*: By default the lead section is transcluded ([[Africa#Water|example]]). If the page contains an infobox, the image and caption of the infobox will be transcluded (unless {{para|files|0}} is set). Also, templates listed at [[Module:Excerpt/config]] will not be transcluded (unless requested explicitly with {{para|templates}}, see below). | |||
* {{para|2}} or {{para|section}} or {{para|fragment}} | |||
*: Name of the section to transclude ([[Eating#Mammals|example]]) or of the <code><nowiki><section></nowiki></code> tag to transclude ([[Axiom Space#Ax-1|example]]). In the case of a section tag, the section must be marked with <code><nowiki><section begin="Name of the fragment" /></nowiki></code> and <code><nowiki><section end="Name of the fragment" /></nowiki></code> in the page to be transcluded. Notice that this template provides other ways of targeting specific fragments of a page without having to resort to section tags. | |||
* {{para|only}} | |||
*: The ''element type'' to transclude, excluding all other types. By default all element types are transcluded. Param {{para|only}} is an exclusionary param, and excludes all other types of elements, except the one you name, so that for example, specifying {{para|only|paragraphs}} excludes all lists, tables, templates, and so on. Param values can be in the singular (e.g., {{para|only|paragraph}}) or plural (e.g., {{para|only|paragraphs}}) and mean different things: in the singular, only the first item of that element type is transcluded; in the plural, all items are. | |||
*:* {{para|only|file}} – Transclude only the first file (but no lists, paragraphs, tables, etc.) | |||
*:* {{para|only|files}} – Transclude all files (but nothing else) | |||
*:* {{para|only|list}} – Transclude only the first list, exclude all other element types | |||
*:* {{para|only|lists}} – Transclude all lists (but nothing else) | |||
*:* {{para|only|table}} – Transclude only the first table, exclude all other element types. Does not transclude table templates, use {{para|templates}} for that. | |||
*:* {{para|only|tables}} – Transclude all tables (but nothing else) ([[JKT48#Singles|example]]) | |||
*:* {{para|only|template}} – Transclude only the first template (excluding templates blacklisted at [[Module:Excerpt/config]], as well as all other element types) | |||
*:* {{para|only|templates}} – Transclude all templates (excluding blacklisted templates), (but nothing else) | |||
*:* {{para|only|paragraph}} – Transclude only the first paragraph, exclude all other element types | |||
*:* {{para|only|paragraphs}} – Transclude all paragraphs (but nothing else) | |||
* {{para|files}} | |||
*: An ''element item'' param, defining which files, such as images and other media, to transclude. Default: all files. | |||
*:* {{para|files|0}} – Transclude no files | |||
*:* {{para|files|A.jpg}} – Transclude the file named 'A.jpg' | |||
*:* {{para|files|A.jpg, B.png, C.gif}} – Transclude the files named 'A.jpg', 'B.png' and 'C.gif' | |||
*:* {{para|files|.+%.png}} – Transclude all PNG files | |||
*:* {{para|files|-A.jpg}} – Transclude all files except the one named 'A.jpg' | |||
*:* {{para|files|-A.jpg, B.png, C.gif}} – Transclude all files except the ones named 'A.jpg', 'B.png' and 'C.gif' | |||
*:* {{para|files|-.+%.png}} – Transclude all non-PNG files | |||
* {{para|paragraphs}} | |||
*: An ''element item'' param, defining which paragraphs to transclude. By default all paragraphs are transcluded. | |||
*:* {{para|paragraphs|0}} – Transclude no paragraphs | |||
*:* {{para|paragraphs|1}} – Transclude the first paragraph | |||
*:* {{para|paragraphs|2}} – Transclude the second paragraph | |||
*:* {{para|paragraphs|1,3}} – Transclude the first and third paragraphs | |||
*:* {{para|paragraphs|1-3}} – Transclude the first, second and third paragraphs | |||
*:* {{para|paragraphs|1-3,5}} – Transclude the first, second, third and fifth paragraphs | |||
*:* {{para|paragraphs|-1}} – Transclude all paragraphs except the first | |||
*:* {{para|paragraphs|-2}} – Transclude all paragraphs except the second | |||
*:* {{para|paragraphs|-1,3}} – Transclude all paragraphs except the first and third | |||
*:* {{para|paragraphs|-1-3}} – Transclude all paragraphs except the first, second and third | |||
*:* {{para|paragraphs|-1-3,5}} – Transclude all paragraphs except the first, second, third and fifth | |||
* {{para|subsections|yes}} | |||
*: An ''element item'' param, defining which subsections of the source to transclude. Default: only the portion of the source lying above the first subsection header. Notice that if the transclusion is done from a section level 3 in the transcluding page, and the transcluded subsections are also level 3, then transcluded subsections will show with the same hierarchy as the transcluding section, which may not be the desired outcome, so use with caution. | |||
* {{para|tables}} | |||
*: An ''element item'' param, defining which tables to transclude. Default: all tables. Does not transclude table templates just above the tables. Same syntax as when transcluding paragraphs, but also: | |||
*:* {{para|tables|Stats2020}} – Transclude the table with id 'Stats2020' | |||
*:* {{para|tables|Stats2020, Stats2019, Stats2018}} – Transclude the tables with ids 'Stats2020', 'Stats2019' and 'Stats2018' | |||
*:* {{para|tables|-Stats2020}} – Transclude all tables except the one with id 'Stats2020' | |||
*:* {{para|tables|-Stats2020, Stats2019, Stats2018}} – Transclude all tables except the ones with ids 'Stats2020', 'Stats2019' and 'Stats2018' | |||
* {{para|templates}} | |||
*: An ''element item'' param, defining which templates to transclude. Default: all templates except those blacklisted at [[Module:Excerpt/config]]. Using a hyphen (minus sign) before a comma-delimited list of templates excludes those templates from transclusion. | |||
*:* {{para|templates|-Ocean}} – Add the template 'Ocean' to the blacklist | |||
*:* {{para|templates|-Ocean, Nature}} – Add the templates 'Ocean' and 'Nature' to the blacklist | |||
*:* {{para|templates|Infobox person}} – Ignore the blacklist and transclude the template 'Infobox person' | |||
*:* {{para|templates|Infobox person, Ocean}} – Ignore the blacklist and transclude the templates 'Infobox person' and 'Ocean' | |||
*:* {{para|templates|.*}} – Ignore the blacklist and transclude all templates | |||
== Tips and how-to == | == Tips and how-to == |