Module:Navbox
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Lua error in Module:Lua_banner at line 113: attempt to index field 'edit' (a nil value). Template:Lua sidebar
This module implements the Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Template:Sandbox other Template:Redirect-distinguishLua error: expandTemplate: template "No redirect" does not exist.
The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing the template name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a template by name without invoking it.
Note that this template may be used under the name "tee-el" (tl) as well as "tee-one" (t1)— both function the same way and produce the same results. This is not true for all such visually confusing templates containing a possible 1/l mix-up: and are not interchangeable.
Template loop detected: Template:Tl works exactly like Template loop detected: Template:Tl with the addition of optionally displaying alternative label text (link label). Template loop detected: Template:Tl can include the use of parameters in the template (as {{{1}}}).
Examples
A short example of its use is:
{{tl|Example}}
- which generates
- Template loop detected: Template:Tl
Other longer examples:
Code | Result | Notes |
---|---|---|
{{tl|Void}}
|
Template loop detected: Template:Tl | Standard usage |
{{tls|Example}}
|
Template:Tls | For templates that should be substituted |
{{tl2|X1}}
|
Template:Tl2 | This formats the link to show how it would look in code (i.e., monospace font) |
{{tl2|sisterTemplate:=M:|3x}}
|
{{3x}}
|
Same as above, for templates on another Wikimedia project (in this example, Meta, using m: ). See Interwiki codes.
|
{{tl2|sisterTemplate:=wikibooks|langTemplate:=de:|WP}}
|
{{WP}}
|
For templates on another language project |
{{tl|1==)}}
|
Template loop detected: Template:Tl | Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template loop detected: Template:Tl or Template loop detected: Template:Tl
|
TemplateData
TemplateData for Navbox
This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.
Parameter | Description | Type | Status | |
---|---|---|---|---|
template name | 1 | positional parameter: the template name without the namespace prefix “Template:”, which is added automatically | Line | required |
See also
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other to produce a [t]emplate [l]ink with single [p]arameter.
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other to produce a [t]emplate [l]ink with e[x]tended number of parameters.
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other to produce a [t]emplate [l]ink that's [s]ubst:ituted, with a single [p]arameter.
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other, tl or tlp in any namespace.
- Template:Lcs
- Template loop detected: Template:Documentation subpage
File:Ambox warning orange.svg | This Lua module is used on approximately 4,510,000 pages, or roughly 48066% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module depends on the following other modules: |
Description
The "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation.
For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl.
Usage
Here is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
{{distinguish|Foo}}
→ Template loop detected: Template:Distinguish
This hatnote can be used to distinguish the topic from multiple other topics:
{{distinguish|Foo|Bar}}
→ Template loop detected: Template:Distinguish
{{distinguish|Foo|Bar|Gaz}}
→ Template loop detected: Template:Distinguish
It can also be used to customize the text that will appear. You may do this using the template's Template:Para parameter. For example, from the Wikipedia article on Phobos (mythology), an article about a Greek god that is also the name of one of the moons of Mars, and where the word "Phoebus", quite similar to "Phobos", has an altogether different meaning. Note that for ease of understanding, terms with parenthetical disambiguation should usually be piped:
{{distinguish|text Template:= the Martian moon [[Phobos (moon)|Phobos]], or Phoebus, an epithet of the Greek god [[Apollo]]}}
→ Template loop detected: Template:Distinguish
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type ...an [[epithet]] of the [[Greek]] god [[Apollo]].
It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box.
When to use
This hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
- Coma
- Template loop detected: Template:Distinguish
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation.
However, {{distinguish}}
is not suitable when the difference is not readily apparent without additional details. Consider a reader looking for a game they believe is named Reversi:
- Template:Cross Reversi
- Template loop detected: Template:Distinguish
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game.
In this case you should use {{about}}
instead of {{distinguish}}
. The difference is to provide explanatation upfront without requiring the reader to click through and differentiate the terms on their own.
{{Distinguish}}
should only be used when the ambiguity exists for a portion of the readership that is sufficient to warrant a hatnote. Care should be taken to avoid trivial uses.
TemplateData
TemplateData for Navbox
A hatnote used when there is an ambiguity in an article's title.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Name of article | 1 | Name of article that you want to link to | Page name | suggested |
Optional additional article to link (2) | 2 | Optional additional article to link | Page name | optional |
Optional additional article to link (3) | 3 | Optional additional article to link | Page name | optional |
Optional additional article to link (4) | 4 | Optional additional article to link | Page name | optional |
Custom text | text | Custom message in wikitext; e.g. "[[foo]] and [[Bar (computer science)|bar]]" produces "Not to be confused with [[foo]] and [[Bar (computer science)|bar]]." | String | optional |
Self reference | selfref | If set, marks note as being a self reference, to not be shown when content is reused | Boolean | optional |
Redirects
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
See also
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
- Template loop detected: Template:Tl
Template:Sandbox other This template displays a message that the current page is a documentation subpage.
Usage
{{Documentation subpage}}
- or
{{Documentation subpage|[[Template:Var]]}}
Userbox documentation
To set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use:
Text customization
The parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here''''' |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text2='''''text2 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Template:Hidden begin
{{Documentation subpage |text1='''''text1 appears here'''''}}
Template loop detected: Template:Documentation subpage
Template:Hidden end
Other parameters
Template:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.)
Display
This template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
- On a /doc page, it displays a box explaining template documentation and links to the template page.
- On other pages – i.e. pages transcluding the /doc page – the template will not show. The template page itself (which contains
Template loop detected: Template:Template link
) will automatically note that the documentation is transcluded from a subpage.
Functions
In addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F".
See also
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
- Template loop detected: Template:Template link
Usage
File:Question book-new.svg | This module's documentation is missing, inadequate, or does not accurately describe its functionality and/or the parameters in its code. Please help to expand and improve it. |
See also
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect |
---|---|
{{lt|Hatnote}}
|
Template:Lt |
{{lts|Hatnote}}
|
Template:Lts |
{{t links|Hatnote}}
|
Template:T links |
{{tfd links|Hatnote}}
|
Template:Tfd links |
{{tetl|Hatnote}}
|
Template:Tetl |
{{tsetl|Hatnote}}
|
Template:Tsetl |
{{ti|Hatnote}}
|
Template:Ti |
{{tic|Hatnote}}
|
Template:Tic |
{{tim|Hatnote}}
|
Template:Tim |
{{tiw|Hatnote}}
|
Template loop detected: Template:Tiw |
{{tlt|Hatnote}}
|
Template:Tlt |
{{ttl|Hatnote}}
|
Template:Ttl |
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other to e[xp]an[d] (i.e. demonstrate) a template in situ.
General-purpose formatting
Template:NoteFoot Template:Clear
Other formatting templates
Code example | Effect | Notes |
---|---|---|
{{tl2|Hatnote|lang=fr}}
|
Template:Tl2 | Supports linking to sister projects (e.g., fr:Hatnote) |
{{tlu|User:Ahunt/SSHFS}}
|
Template:Tlu | Supports linking to any namespace |
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
|
Template:Demo | Shows code and example |
{{xpd|Hatnote|Some hatnote text}}
|
Template:Xpd | Shows code, example and a link to expand the template code |
{{tln|Hatnote}}
|
Template:Tln | Produces a normal link to the template |
{{elc|Template:Hatnote}} {{elc|Template:Hatnote|Hatnote}}
|
Template:Elc Template:Elc |
Formats wikilink, with optional piped link text and blended suffix |
{{ml|Example|hello}}
|
Template:Ml | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{mlx|Example|hello}}
|
Template:Mlx | Counterpart to Template loop detected: Template:Tl for linking to Lua modules |
{{para|title|<var>book title</var>}}
|
Template:Para | Formats template parameters for display, with or without values |
{{sclx|LASTING}}
|
Template:Sclx | Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. |
{{tag|ref}} {{xtag|templatedata}}
|
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing |
{{dtl|Ping project}}
|
Template:Dtl | Wikidata counterpart to Template loop detected: Template:Tl |
{{pf|if}} {{pf|if|{{{1}}}|true|false}}
|
Template:Pf Template:Pf |
Parser function equivalent to Template loop detected: Template:Tl |
{{magic word|uc:}}
|
Template:Magic word | Magic word links |
With utility links
Code example | Effect | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{lt|Hatnote}}
|
Template:Lt | |||||||||||||||||||||||||||||||||||||||||
{{lts|Hatnote}}
|
Template:Lts | |||||||||||||||||||||||||||||||||||||||||
{{t links|Hatnote}}
|
Template:T links | |||||||||||||||||||||||||||||||||||||||||
{{tfd links|Hatnote}}
|
Template:Tfd links | |||||||||||||||||||||||||||||||||||||||||
{{tetl|Hatnote}}
|
Template:Tetl | |||||||||||||||||||||||||||||||||||||||||
{{tsetl|Hatnote}}
|
Template:Tsetl | |||||||||||||||||||||||||||||||||||||||||
{{ti|Hatnote}}
|
Template:Ti | |||||||||||||||||||||||||||||||||||||||||
{{tic|Hatnote}}
|
Template:Tic | |||||||||||||||||||||||||||||||||||||||||
{{tim|Hatnote}}
|
Template:Tim | |||||||||||||||||||||||||||||||||||||||||
{{tiw|Hatnote}}
|
Template loop detected: Template:Documentation subpage
DescriptionThe "distinguish" template produces a hatnote to point out to our readers the existence of one or more articles whose title(s) is/are similar to the page in question. It is used in cases where the distinction between the titles is generally obvious and does not need further explanation. For those cases where an explanation is required, please use the templates Template loop detected: Template:Tl and Template loop detected: Template:Tl. For use on category pages, the corresponding template is Template loop detected: Template:Tl. UsageHere is an example of its standard usage (used, for purposes of this example, with the placeholder article "Foo"; the following could be placed on a theoretical article named "Foo (song)", or perhaps one named "Fou" or "Fu"):
Note that a final period is automatically added at the end of the sentence, and that only one blue link is used per disambiguated topic (i.e, do not type It may also be appropriate to place a similar hatnote on the article for Phobos (moon) to distinguish it from the article on Phobos (mythology) and the article on Apollo, though it is probably unnecessary to place yet another hatnote on the article on Apollo, since most readers searching for "Apollo Phoebus" will get there by simply typing "Apollo" in the Wikipedia search box. When to useThis hatnote is generally used when readers have misspelled their desired title, and the error would be apparent by simply displaying the alternative term without further explanation. For example, consider a reader looking for the punctuation mark who instead ends up at coma:
Readers are presumed to recognize that they actually wanted comma by merely looking at the spelling, and this case generally requires no further explanation. However,
In the above hatnote, it is not generally apparent how the suggested Reversis is different from Reversi, which is also a game. In this case you should use
TemplateDataThis is the TemplateData documentation for this template used by VisualEditor and other tools; click here to see a monthly parameter usage report for this template.
Template:Template other
TemplateData for Navbox A hatnote used when there is an ambiguity in an article's title.
Redirects
See also
Template:Sandbox other This template displays a message that the current page is a documentation subpage. Usage
Userbox documentationTo set this template to use "userbox" and "userbox page" rather than "template" and "template page" or "user template" and "user template page", use: Text customizationThe parameters Template:Para and/or Template:Para can be used to set the text of, respectively, the template's first and second lines. If text1 is set but not text2, both lines' text will derive from text1:
Template:Hidden begin
Other parametersTemplate:Para will prevent this template from generating any categories. (By default, "Namespace documentation pages" (usually Category:Template documentation pages) is added, or Category:Documentation subpages without corresponding pages if the main page doesn't exist.) DisplayThis template should normally be placed at the top of /doc pages. It changes output depending on where it is viewed:
FunctionsIn addition to its message, the template adds pages to Category:Template documentation pages, Category:User documentation pages, or similar (named after the subject space), but only for documentation pages in namespaces with the subpage feature. It defaults the sort key to the page name without namespace: Template:Foo, for example, would be sorted as "Foo", i.e. under "F". See also
Usage
See alsoTemplate loop detected: Template:Template-linking templates | |||||||||||||||||||||||||||||||||||||||||
{{tlt|Hatnote}}
|
Template:Tlt | |||||||||||||||||||||||||||||||||||||||||
{{ttl|Hatnote}}
|
Template:Ttl | |||||||||||||||||||||||||||||||||||||||||
{{twlh|Hatnote}}
|
Template:Twlh |
Template:Sandbox other template. Please see the template page for usage instructions.
Tracking/maintenance categories
- Category:Navbox orphans (0)
- Category:Navigational boxes without horizontal lists (0)
- Category:Navboxes using background colours (0)
- Category:Potentially illegible navboxes (0)
- Category:Navboxes using borders (0)
--
-- This module implements {{Navbox}}
--
local p = {}
local navbar = require('Module:Navbar')._navbar
local getArgs -- lazily initialized
local args
local border
local listnums
local ODD_EVEN_MARKER = '\127_ODDEVEN_\127'
local RESTART_MARKER = '\127_ODDEVEN0_\127'
local REGEX_MARKER = '\127_ODDEVEN(%d?)_\127'
local function striped(wikitext)
-- Return wikitext with markers replaced for odd/even striping.
-- Child (subgroup) navboxes are flagged with a category that is removed
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
local orphanCat = '[[Category:Navbox orphans]]'
if border == 'subgroup' and args.orphan ~= 'yes' then
-- No change; striping occurs in outermost navbox.
return wikitext .. orphanCat
end
local first, second = 'odd', 'even'
if args.evenodd then
if args.evenodd == 'swap' then
first, second = second, first
else
first = args.evenodd
second = first
end
end
local changer
if first == second then
changer = first
else
local index = 0
changer = function (code)
if code == '0' then
-- Current occurrence is for a group before a nested table.
-- Set it to first as a valid although pointless class.
-- The next occurrence will be the first row after a title
-- in a subgroup and will also be first.
index = 0
return first
end
index = index + 1
return index % 2 == 1 and first or second
end
end
local regex = orphanCat:gsub('([%[%]])', '%%%1')
return (wikitext:gsub(regex, ''):gsub(REGEX_MARKER, changer)) -- () omits gsub count
end
local function processItem(item, nowrapitems)
if item:sub(1, 2) == '{|' then
-- Applying nowrap to lines in a table does not make sense.
-- Add newlines to compensate for trim of x in |parm=x in a template.
return '\n' .. item ..'\n'
end
if nowrapitems == 'yes' then
local lines = {}
for line in (item .. '\n'):gmatch('([^\n]*)\n') do
local prefix, content = line:match('^([*:;#]+)%s*(.*)')
if prefix and not content:match('^<span class="nowrap">') then
line = prefix .. '<span class="nowrap">' .. content .. '</span>'
end
table.insert(lines, line)
end
item = table.concat(lines, '\n')
end
if item:match('^[*:;#]') then
return '\n' .. item ..'\n'
end
return item
end
local function renderNavBar(titleCell)
if args.navbar ~= 'off' and args.navbar ~= 'plain' and not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then
titleCell:wikitext(navbar{
args.name,
mini = 1,
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;box-shadow:none;padding:0;'
})
end
end
--
-- Title row
--
local function renderTitleRow(tbl)
if not args.title then return end
local titleRow = tbl:tag('tr')
if args.titlegroup then
titleRow
:tag('th')
:attr('scope', 'row')
:addClass('navbox-group')
:addClass(args.titlegroupclass)
:cssText(args.basestyle)
:cssText(args.groupstyle)
:cssText(args.titlegroupstyle)
:wikitext(args.titlegroup)
end
local titleCell = titleRow:tag('th'):attr('scope', 'col')
if args.titlegroup then
titleCell
:css('border-left', '2px solid #fdfdfd')
:css('width', '100%')
end
local titleColspan = 2
if args.imageleft then titleColspan = titleColspan + 1 end
if args.image then titleColspan = titleColspan + 1 end
if args.titlegroup then titleColspan = titleColspan - 1 end
titleCell
:cssText(args.basestyle)
:cssText(args.titlestyle)
:addClass('navbox-title')
:attr('colspan', titleColspan)
renderNavBar(titleCell)
titleCell
:tag('div')
-- id for aria-labelledby attribute
:attr('id', mw.uri.anchorEncode(args.title))
:addClass(args.titleclass)
:css('font-size', '114%')
:css('margin', '0 4em')
:wikitext(processItem(args.title))
end
--
-- Above/Below rows
--
local function getAboveBelowColspan()
local ret = 2
if args.imageleft then ret = ret + 1 end
if args.image then ret = ret + 1 end
return ret
end
local function renderAboveRow(tbl)
if not args.above then return end
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
:addClass(args.aboveclass)
:cssText(args.basestyle)
:cssText(args.abovestyle)
:attr('colspan', getAboveBelowColspan())
:tag('div')
-- id for aria-labelledby attribute, if no title
:attr('id', args.title and nil or mw.uri.anchorEncode(args.above))
:wikitext(processItem(args.above, args.nowrapitems))
end
local function renderBelowRow(tbl)
if not args.below then return end
tbl:tag('tr')
:tag('td')
:addClass('navbox-abovebelow')
:addClass(args.belowclass)
:cssText(args.basestyle)
:cssText(args.belowstyle)
:attr('colspan', getAboveBelowColspan())
:tag('div')
:wikitext(processItem(args.below, args.nowrapitems))
end
--
-- List rows
--
local function renderListRow(tbl, index, listnum)
local row = tbl:tag('tr')
if index == 1 and args.imageleft then
row
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass(args.imageclass)
:css('width', '1px') -- Minimize width
:css('padding', '0px 2px 0px 0px')
:cssText(args.imageleftstyle)
:attr('rowspan', #listnums)
:tag('div')
:wikitext(processItem(args.imageleft))
end
if args['group' .. listnum] then
local groupCell = row:tag('th')
-- id for aria-labelledby attribute, if lone group with no title or above
if listnum == 1 and not (args.title or args.above or args.group2) then
groupCell
:attr('id', mw.uri.anchorEncode(args.group1))
end
groupCell
:attr('scope', 'row')
:addClass('navbox-group')
:addClass(args.groupclass)
:cssText(args.basestyle)
:css('width', args.groupwidth or '1%') -- If groupwidth not specified, minimize width
groupCell
:cssText(args.groupstyle)
:cssText(args['group' .. listnum .. 'style'])
:wikitext(args['group' .. listnum])
end
local listCell = row:tag('td')
if args['group' .. listnum] then
listCell
:css('text-align', 'left')
:css('border-left-width', '2px')
:css('border-left-style', 'solid')
else
listCell:attr('colspan', 2)
end
if not args.groupwidth then
listCell:css('width', '100%')
end
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing
if index % 2 == 1 then
rowstyle = args.oddstyle
else
rowstyle = args.evenstyle
end
local listText = args['list' .. listnum]
local oddEven = ODD_EVEN_MARKER
if listText:sub(1, 12) == '</div><table' then
-- Assume list text is for a subgroup navbox so no automatic striping for this row.
oddEven = listText:find('<th[^>]*"navbox%-title"') and RESTART_MARKER or 'odd'
end
listCell
:css('padding', '0px')
:cssText(args.liststyle)
:cssText(rowstyle)
:cssText(args['list' .. listnum .. 'style'])
:addClass('navbox-list')
:addClass('navbox-' .. oddEven)
:addClass(args.listclass)
:addClass(args['list' .. listnum .. 'class'])
:tag('div')
:css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
:wikitext(processItem(listText, args.nowrapitems))
if index == 1 and args.image then
row
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass(args.imageclass)
:css('width', '1px') -- Minimize width
:css('padding', '0px 0px 0px 2px')
:cssText(args.imagestyle)
:attr('rowspan', #listnums)
:tag('div')
:wikitext(processItem(args.image))
end
end
--
-- Tracking categories
--
local function needsHorizontalLists()
if border == 'subgroup' or args.tracking == 'no' then
return false
end
local listClasses = {
['plainlist'] = true, ['hlist'] = true, ['hlist hnum'] = true,
['hlist hwrap'] = true, ['hlist vcard'] = true, ['vcard hlist'] = true,
['hlist vevent'] = true,
}
return not (listClasses[args.listclass] or listClasses[args.bodyclass])
end
local function hasBackgroundColors()
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do
if tostring(args[key]):find('background', 1, true) then
return true
end
end
end
local function hasBorders()
for _, key in ipairs({'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do
if tostring(args[key]):find('border', 1, true) then
return true
end
end
end
local function isIllegible()
local styleratio = require('Module:Color contrast')._styleratio
for key, style in pairs(args) do
if tostring(key):match("style$") then
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then
return true
end
end
end
return false
end
local function getTrackingCategories()
local cats = {}
if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
if hasBorders() then table.insert(cats, 'Navboxes using borders') end
return cats
end
local function renderTrackingCategories(builder)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
for _, cat in ipairs(getTrackingCategories()) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
--
-- Main navbox tables
--
local function renderMainTable()
local tbl = mw.html.create('table')
:addClass('nowraplinks')
:addClass(args.bodyclass)
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
if args.state == 'collapsed' then args.state = 'mw-collapsed' end
tbl
:addClass('mw-collapsible')
:addClass(args.state or 'autocollapse')
end
tbl:css('border-spacing', 0)
if border == 'subgroup' or border == 'none' then
tbl
:addClass('navbox-subgroup')
:cssText(args.bodystyle)
:cssText(args.style)
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
:addClass('navbox-inner')
:css('background', 'transparent')
:css('color', 'inherit')
end
tbl:cssText(args.innerstyle)
renderTitleRow(tbl)
renderAboveRow(tbl)
for i, listnum in ipairs(listnums) do
renderListRow(tbl, i, listnum)
end
renderBelowRow(tbl)
return tbl
end
function p._navbox(navboxArgs)
args = navboxArgs
listnums = {}
for k, _ in pairs(args) do
if type(k) == 'string' then
local listnum = k:match('^list(%d+)$')
if listnum then table.insert(listnums, tonumber(listnum)) end
end
end
table.sort(listnums)
border = mw.text.trim(args.border or args[1] or '')
if border == 'child' then
border = 'subgroup'
end
-- render the main body of the navbox
local tbl = renderMainTable()
-- render the appropriate wrapper around the navbox, depending on the border param
local res = mw.html.create()
if border == 'none' then
local nav = res:tag('div')
:attr('role', 'navigation')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args.title or args.above or (args.group1 and not args.group2) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))
else
nav:attr('aria-label', 'Navbox')
end
elseif border == 'subgroup' then
-- We assume that this navbox is being rendered in a list cell of a parent navbox, and is
-- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the
-- padding being applied, and at the end add a <div> to balance out the parent's </div>
res
:wikitext('</div>')
:node(tbl)
:wikitext('<div>')
else
local nav = res:tag('div')
:attr('role', 'navigation')
:addClass('navbox')
:addClass(args.navboxclass)
:cssText(args.bodystyle)
:cssText(args.style)
:css('padding', '3px')
:node(tbl)
-- aria-labelledby title, otherwise above, otherwise lone group
if args.title or args.above or (args.group1 and not args.group2) then
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))
else
nav:attr('aria-label', 'Navbox')
end
end
if (args.nocat or 'false'):lower() == 'false' then
renderTrackingCategories(res)
end
return striped(tostring(res))
end
function p.navbox(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
args = getArgs(frame, {wrappers = {'Template:Navbox'}})
-- Read the arguments in the order they'll be output in, to make references number in the right order.
local _
_ = args.title
_ = args.above
for i = 1, 20 do
_ = args["group" .. tostring(i)]
_ = args["list" .. tostring(i)]
end
_ = args.below
return p._navbox(args)
end
return p