Template:Section link/doc: Difference between revisions

Content deleted Content added
Documenting |nopage=y parameter
text editing
 
(19 intermediate revisions by 12 users not shown)
Line 1:
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Lua|Module:Section link}}
{{tsh|§l}}
== Usage ==
=== Single section ===
This template is used to generate a link to a certain section of an article that has an appropriate section mark ([[§]]).
This template is used to generate a link to a certain section of a local wiki page and render an appropriate section mark ([[w:§|§]]).
 
Instead of:
<pre>[[Download#What next?|Download § What next?]]</pre>
{{Pre|<nowiki>[[History of IBM#1969: Antitrust, the Unbundling of software and services|History of IBM § 1969: Antitrust, the Unbundling of software and services]]</nowiki>}}
 
...you can write:
{{pre|{{tlx|section link|History of IBM|1969: Antitrust, the Unbundling of software and services}}}}
 
{{tlx|Section link|Download|What next?}}
which is much shorter and does not require you to search for the section mark character.
 
...which is much shorter and does not require you to search for the section mark character.
 
Both generate:
: {{Section link|History of IBMDownload|1969: Antitrust, the Unbundling of software andWhat servicesnext?}}
 
=== Multiple sections ===
 
This template may generate consecutive links to several sections of the same page:
{{tlx|Section link|Download|Download from Git instead|What next?}}
{{pre|{{tlx|section link|History of IBM|1880s–1924: The origin of IBM|1969: Antitrust, the Unbundling of software and services|1993–present: IBM's near disaster and rebirth}}}}
 
...will generate:
: {{section link|Download|Download from Git instead|What next?}}
:{{section link|History of IBM|1880s–1924: The origin of IBM|1969: Antitrust, the Unbundling of software and services|1993–present: IBM's near disaster and rebirth}}
 
=== Suppressing display of the page name ===
Sometimes the page name needs not to appear, e.g. to avoid redundancy and wordiness. For the page on which the template is used, not specifying a page name creates a section link only. The following:
Sometimes we want to suppress display of the page name, and this is done with the {{para|nopage=y}} parameter and value.
{{tlx|Section link|<nowiki/>|Suppressing page name}}
 
...is the equivalent of:
Comparison of displayed results:
<pre>[[#Suppressing page name|§ Suppressing page name]]</pre>
#<code><nowiki>{{section link|WP:Manual of Style|Quotations}}</nowiki></code> &ndash; {{section link|WP:Manual of Style|Quotations}}
#<code><nowiki>{{section link|WP:Manual of Style|Quotations|nopage=y}}</nowiki></code> &ndash; {{section link|WP:Manual of Style|Quotations|nopage=y}}
#<code><nowiki>{{section link|WP:Manual of Style|Quotations|Quotation marks|Commas}}</nowiki></code> &ndash; {{section link|WP:Manual of Style|Quotations|Quotation marks|Commas}}
#<code><nowiki>{{section link|WP:Manual of Style|Quotations|Quotation marks|Commas|nopage=y}}</nowiki></code> &ndash; {{section link|WP:Manual of Style|Quotations|Quotation marks|Commas|nopage=y}}
 
...and renders as:
Usage example:
: {{section link||Suppressing page name}}
*<code><nowiki>[[WP:Article titles]] (a policy), at {{section link|nopage=y|WP:Article titles|Precision}}</nowiki></code> &ndash; [[WP:Article titles]] (a policy), at {{section link|nopage=y|WP:Article titles|Precision}}}}
 
For other pages, {{para|nopage|1}} can be used to suppress the page name.
== See also ==
* {{tl|sectionlink}} &ndash; <code><nowiki>{{sectionlink|WP:Manual of Style|Italics}}</nowiki></code> displays as {{sectionlink|WP:Manual of Style|Italics}}
* {{tl|link section}} &ndash; <code><nowiki>{{link section|WP:Manual of Style|Italics}}</nowiki></code> displays as {{link section|WP:Manual of Style|Italics}}
 
Comparison of displayed results:
<includeonly>
* {{tlx|Section link|Help:Templates|Parameters}} → <br
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
/>{{Section link|Help:Templates|Parameters}}
[[Category:Internal link templates]]
* {{tlx|Section link|Help:Templates|Parameters|nopage{{=}}1}} →<br
/>{{Section link|Help:Templates|Parameters|nopage=1}}
* {{tlx|Section link|Help:Templates|Parameters|Anonymous parameters|Numbered parameters}} →<br
/>{{Section link|Help:Templates|Parameters|Anonymous parameters|Numbered parameters}}
* {{tlx|Section link|Help:Templates|Parameters|Anonymous parameters|Numbered parameters|nopage{{=}}1}} →<br
/>{{Section link|Help:Templates|Parameters|Anonymous parameters|Numbered parameters|nopage=1}}
 
== TemplateData ==
[[ja:Template:節リンク]]
{{TemplateData header}}
[[sl:Predloga:Section link]]
<templatedata>
</includeonly>
{
"description": {
"en": "This template is used to generate a link to a certain section of a local wiki page and render an appropriate section mark (§). This template may generate consecutive links to several sections of the same page.",
"cs": "Tato šablona se používá k vygenerování odkazu na určitou sekci místní wiki stránky a vykreslení příslušné značky sekce (§). Tato šablona může generovat po sobě jdoucí odkazy na několik částí stejné stránky."
},
"params": {
"1": {
"label": {
"en": "Page name",
"cs": "Název stránky"
},
"description": {
"en": "Name of the page to which the link must be created. Leave empty to link to the current page. Doing so causes no page name to appear.",
"cs": "Název stránky, na kterou musí být vytvořen odkaz. Nechte prázdné, chcete-li odkazovat na aktuální stránku. Pokud tak učiníte, nezobrazí se žádný název stránky."
},
"type": "wiki-page-name",
"suggested": true
},
"2": {
"label": {
"en": "Section name 1",
"cs": "Název sekce 1"
},
"description": {
"en": "Name of the (first) section to which the link must be created. This parameter is mandatory.",
"cs": "Název (první) sekce, na kterou musí být vytvořen odkaz. Tento parametr je povinný."
},
"type": "string",
"required": true
},
"3": {
"label": {
"en": "Section name 2",
"cs": "Název sekce 2"
},
"description": {
"en": "This template can link to additional sections within one page. You can supply another section name in this field.",
"cs": "Tato šablona může odkazovat na další sekce v rámci jedné stránky. V tomto poli můžete zadat jiný název sekce."
},
"type": "string"
},
"4": {
"label": {
"en": "Section name 3",
"cs": "Název sekce 3"
},
"description": {
"en": "This template can link to additional sections within one page. You can supply another section name in this field.",
"cs": "Tato šablona může odkazovat na další sekce v rámci jedné stránky. V tomto poli můžete zadat jiný název sekce."
},
"type": "string"
},
"5": {
"label": {
"en": "Section name 4",
"cs": "Název sekce 4"
},
"description": {
"en": "This template can link to additional sections within one page. You can supply another section name in this field.",
"cs": "Tato šablona může odkazovat na další sekce v rámci jedné stránky. V tomto poli můžete zadat jiný název sekce."
},
"type": "string"
},
"nopage": {
"label": {
"en": "Suppress page name?",
"cs": "Potlačit název stránky?"
},
"description": {
"en": "If set to a truthy value, suppresses the page name.",
"cs": "Pokud je nastaveno na pravdivou hodnotu, potlačí se název stránky."
},
"default": "0",
"autovalue": "1",
"type": "boolean"
}
}
}
</templatedata>
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Internal link templates{{#translation:}}]]
}}</includeonly>