Template:Broader/doc: Difference between revisions
(after Template:Broader/doc) |
m (19 revisions imported from wikipedia:Template:Broader/doc) |
||
(18 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} |
|||
This module produces a "for a broader coverage related to this topic" link. It implements the {{tl|broader}} template. |
|||
{{Lua|Module:Broader}} |
|||
This template is used to make [[Wikipedia:Summary style|summary style]] explicit. It looks like this: |
|||
== Use from wikitext == |
|||
{{Broader|Article}} |
|||
This module cannot be used directly from #invoke. Instead, it can only be used through the {{tl|broader}} template. Please see the template page for documentation. |
|||
It is used in sections for which there is also a separate article on the subject. It should be used when there should be a link to another article that discusses a subject more broadly, but is not a main article (which should use {{tl|Main}}), a narrower topic (which should probably use {{tl|Further}}), or at the same level of focus (which should probably use {{tl|See also}}). |
|||
== Use from other Lua modules == |
|||
== Usage == |
|||
Load the module: |
|||
; Basic usage: {{tlc|Broader|''article''}} |
|||
<source lang="lua"> |
|||
; With a topic: {{tlc|Broader|''article''|topic{{=}}''topic''}} |
|||
local mBroader = require('Module:Broader') |
|||
; With more than one target page: {{tlc|Broader|''article1''|''article2''|''article3''|topic{{=}}''topic''}} |
|||
</source> |
|||
; All parameters: {{tlc|Broader|''article''|topic{{=}}''topic''|selfref{{=}}''yes''|category{{=}}''no''}} |
|||
== Parameters == |
|||
You can then use the _broader function like this: |
|||
This template accepts the following parameters: |
|||
<source lang="lua"> |
|||
* <code>1</code> - the page to link to (required). Categories and files are automatically escaped with the [[Help:Colon trick|colon trick]], and links to sections are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''. |
|||
mBroader._broader(page, topic, options) |
|||
* <code>2</code> (and greater numbers) - any additional pages to link to. These links are also automatically formatted as with the first parameter. |
|||
</source> |
|||
* <code>topic</code> - the name of the topic. If this is not specified, the text "this topic" is used. |
|||
* <code>selfref</code> - if set to "yes", "y", "true" or "1", adds the CSS class "selfref". This is used to denote self-references to Wikipedia. See [[Template:Selfref]] for more information. |
|||
* <code>category</code> - if set to "no", "n", "false", or "0", suppresses the error tracking category ([[:Category:Hatnote templates with errors]]). This only has an effect if the first positional parameter (the page to link to) is omitted. |
|||
== Examples == |
|||
The <var>page</var> variable is the page to be linked to, and is required. The page name can include a section link if desired. If the page includes a section link, it is automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''. |
|||
* {{tlc|Broader|Article}} → {{Broader|Article}} |
|||
The <var>topic</var> variable is a description of the topic, and is optional. The default topic value is "this topic". |
|||
* {{tlc|Broader|Article|topic{{=}}some topic}} → {{Broader|Article|topic=some topic}} |
|||
== Errors == |
|||
The <var>options</var> table can be used to configure the function's output. At current, the only option available is "selfref", which is used when the output is a self-reference to Wikipedia. to set this option, use {{code|1={selfref = true}|2=lua}}. (See the {{tl|selfref}} template for more details on self-references.) |
|||
If no page name is supplied, the template will output the following message: |
|||
; Example 1 |
|||
* {{Broader|category=no}} |
|||
<source lang="lua"> |
|||
mBroader._broader('Carbon dioxide data') |
|||
</source> |
|||
Produces: |
|||
:<code><nowiki><div class="hatnote boilerplate seealso">For a broader coverage related to this topic, see [[Carbon dioxide data]].</div></nowiki></code> |
|||
Displays as: |
|||
{{broader|Carbon dioxide data}} |
|||
If you see this error message, it is for one of four reasons: |
|||
; Example 2 |
|||
# No parameters were specified (the template code was <code><nowiki>{{Broader}}</nowiki></code>). Please use <code><nowiki>{{Broader|</nowiki>''page''<nowiki>}}</nowiki></code> instead. |
|||
<source lang="lua"> |
|||
# Some parameters were specified, but the page name wasn't included. For example, the template text <code><nowiki>{{Broader|selfref=yes}}</nowiki></code> will produce this error. Please use (for example) <code><nowiki>{{Broader|</nowiki>''page''<nowiki>|selfref=yes}}</nowiki></code> instead. |
|||
mBroader._broader('Carbon dioxide data', 'the physical properties of carbon dioxide') |
|||
# The page name was specified, but it contains an equals sign ("="). The equals sign has a special meaning in template code, and because of this it cannot be used in template parameters that do not specify a parameter name. For example, the template code <code><nowiki>{{Broader|2+2=4}}</nowiki></code> will produce this error. To work around this, you can specify the parameter name explictly by using <code>1=</code> before the page name (like this: <code><nowiki>{{Broader|1=2+2=4}}</nowiki></code>) or you can disable the equals being interpreted as delimiting a parameter name by [[Template:=|surrounding the equals with double braces]] (like this: <code><nowiki>{{Broader|2+2{{=}}4}}</nowiki></code>). |
|||
</source> |
|||
Produces: |
|||
:<code><nowiki><div class="hatnote boilerplate seealso">For a broader coverage related to the physical properties of carbon dioxide, see [[Carbon dioxide data]].</div></nowiki></code> |
|||
Displays as: |
|||
{{broader|Carbon dioxide data|the physical properties of carbon dioxide}} |
|||
If you see this error message and are unsure of what to do, please post a message on [[WP:HD|the help desk]], and someone should be able to help you. |
|||
; Example 3 |
|||
<source lang="lua"> |
|||
mBroader._broader('Lua programming on Wikipedia', 'Wikipedia:Lua', {selfref = true}) |
|||
</source> |
|||
Produces: |
|||
:<code><nowiki><div class="hatnote selfref">For a broader coverage related to Lua programming on Wikipedia, see [[Wikipedia:Lua]].</div></nowiki></code> |
|||
Displays as: |
|||
{{broader|Wikipedia:Lua|Lua programming on Wikipedia|selfref=true}} |
|||
Pages that contain this error message are tracked in [[:Category:Hatnote templates with errors]]. |
|||
== Technical details == |
|||
== See also == |
|||
This module uses [[Module:Hatnote]] to format the hatnote text and [[Module:Arguments]] to fetch the arguments from wikitext. |
|||
*{{tl|Further}} |
|||
{{Hatnote templates}} |
|||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| |
|||
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}} |
|||
<!-- Categories go here and interwikis go in Wikidata. --> |
|||
{{TemplateData header|noheader=1}} |
|||
<templatedata> |
|||
{ |
|||
"description": "This template is used to show readers where to find broader coverage related to a particular topic. It is usually placed at the top of a section or article.", |
|||
"params": { |
|||
"1": { |
|||
"label": "Article", |
|||
"description": "The name of the article that you want to link to", |
|||
"type": "string", |
|||
"required": true |
|||
}, |
|||
"2": { |
|||
"label": "Article 2", |
|||
"description": "The name of an additional article that you want to link to", |
|||
"type": "string", |
|||
"required": false |
|||
}, |
|||
"3": { |
|||
"label": "Article 3", |
|||
"description": "The name of an additional article that you want to link to", |
|||
"type": "string", |
|||
"required": false |
|||
}, |
|||
"4": { |
|||
"label": "Article 4", |
|||
"description": "The name of an additional article that you want to link to", |
|||
"type": "string", |
|||
"required": false |
|||
}, |
|||
"topic": { |
|||
"label": "Topic", |
|||
"description": "A brief description of the topic related to which a broader coverage will be provided. If left blank, the template will read 'For broader coverage related to this topic...'", |
|||
"type": "string", |
|||
"required": false |
|||
}, |
|||
"selfref": { |
|||
"type": "string/line", |
|||
"label": "Self reference", |
|||
"description": "Set to \"yes\" if the hatnote text is a self-reference to Wikipedia that would not make sense on mirrors or forks of the Wikipedia site. (E.g. \"For the Wikipedia Sandbox, see [[WP:SAND]]\".)" |
|||
}, |
|||
"category": { |
|||
"label": "Category", |
|||
"description": "Set to \"no\", \"n\", \"false\", or \"0\" to suppresses the error tracking category (Category:Hatnote templates with errors). This only has an effect if the hatnote text is omitted." |
|||
} |
|||
} |
|||
} |
|||
</templatedata> |
|||
{{Collapse bottom}} |
|||
<includeonly>{{Sandbox other|| |
|||
<!-- Categories go here and interwikis go in Wikidata. --> |
|||
[[Category:Cross-reference templates|{{PAGENAME}}]] |
|||
[[Category:Wikipedia page-section templates|{{PAGENAME}}]] |
|||
[[Category:Exclude in print|{{PAGENAME}}]] |
|||
[[Category:Hatnote templates]] |
|||
}}</includeonly> |
}}</includeonly> |
Latest revision as of 16:04, 6 July 2021
This is a documentation subpage for Template:Terminate sentence It contains usage information, categories and other content that is not part of the original template page. |
This template uses Lua: |
This template is used to make summary style explicit. It looks like this:
It is used in sections for which there is also a separate article on the subject. It should be used when there should be a link to another article that discusses a subject more broadly, but is not a main article (which should use {{Main}}), a narrower topic (which should probably use {{Further}}), or at the same level of focus (which should probably use {{See also}}).
Usage[edit source]
- Basic usage
{{Broader|article}}
- With a topic
{{Broader|article|topic=topic}}
- With more than one target page
{{Broader|article1|article2|article3|topic=topic}}
- All parameters
{{Broader|article|topic=topic|selfref=yes|category=no}}
Parameters[edit source]
This template accepts the following parameters:
1
- the page to link to (required). Categories and files are automatically escaped with the colon trick, and links to sections are automatically formatted as page § section, rather than the MediaWiki default of page#section.2
(and greater numbers) - any additional pages to link to. These links are also automatically formatted as with the first parameter.topic
- the name of the topic. If this is not specified, the text "this topic" is used.selfref
- if set to "yes", "y", "true" or "1", adds the CSS class "selfref". This is used to denote self-references to Wikipedia. See Template:Selfref for more information.category
- if set to "no", "n", "false", or "0", suppresses the error tracking category (Category:Hatnote templates with errors). This only has an effect if the first positional parameter (the page to link to) is omitted.
Examples[edit source]
{{Broader|Article}}
→{{Broader|Article|topic=some topic}}
→
Errors[edit source]
If no page name is supplied, the template will output the following message:
- Error: no page name specified (help).
If you see this error message, it is for one of four reasons:
- No parameters were specified (the template code was
{{Broader}}
). Please use{{Broader|page}}
instead. - Some parameters were specified, but the page name wasn't included. For example, the template text
{{Broader|selfref=yes}}
will produce this error. Please use (for example){{Broader|page|selfref=yes}}
instead. - The page name was specified, but it contains an equals sign ("="). The equals sign has a special meaning in template code, and because of this it cannot be used in template parameters that do not specify a parameter name. For example, the template code
{{Broader|2+2=4}}
will produce this error. To work around this, you can specify the parameter name explictly by using1=
before the page name (like this:{{Broader|1=2+2=4}}
) or you can disable the equals being interpreted as delimiting a parameter name by surrounding the equals with double braces (like this:{{Broader|2+2{{=}}4}}
).
If you see this error message and are unsure of what to do, please post a message on the help desk, and someone should be able to help you.
Pages that contain this error message are tracked in Category:Hatnote templates with errors.
See also[edit source]
- {{Further}}
TemplateData documentation used by VisualEditor and other tools
| ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Click here to see a monthly parameter usage report for this template based on this TemplateData.
TemplateData for Broader This template is used to show readers where to find broader coverage related to a particular topic. It is usually placed at the top of a section or article.
|