Mudanças entre as edições de "Predefinição:Other uses/doc"

Origem: IRChelp Brasil - Wiki
Ir para navegação Ir para pesquisar
(Criação da Documentação do Módulo Other Users.)
 
 
Linha 1: Linha 1:
<includeonly>{{Being deleted|2019 May 15|Module:Other_uses2}}</includeonly><!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
+
{{documentation subpage}}
{{high-risk|111000+}}
+
{{High-use| 53271 }}
{{Module rating|protected}}
+
{{lua|Module:Other uses}}
This module produces an "other uses" hatnote for linking to disambiguation pages. It implements the {{tl|other uses}} template.
+
{{for|navboxes|Template:Navigation templates}}
  
== Usage from wikitext==
+
This template creates a note directing the reader to the [[WP:DISAMBIGUATION|disambiguation page]] related to the page it is included in. The page to which is directed, can be a page whose name is the name of the current page with "(disambiguation)" appended to it. Or you can direct the user to a disambiguation page with a different title, by supplying it as an argument to the template.
===otheruses()===
 
The <code>otheruses()</code> function directly implements {{tl|other uses}} and probably shouldn't be used anywhere else.
 
  
===otherX()===
+
==Usage==
The <code>otherX()</code> function allows direct implementation of templates that differ from {{tl|other uses}} in only phrasing. For example, where {{tl|other uses}} is phrased with "other uses", {{tl|other places}} is phrased with "other places with the same name" and can be implemented using <code>otherX()</code>, which takes the custom phrasing as its parameter at the module invocation. {{tl|other places}} in particular could be implemented with this wikitext:
+
'''{{Tlx|Other uses}} results in'''
 +
{{other uses}}
  
<source lang="text">{{#invoke:other uses|otherX|places with the same name}}</source>
+
'''{{Tlx|Other uses|Target (disambiguation)}} results in'''
 +
{{other uses|Target (disambiguation)}}
  
Note that the leading "other" is automatically supplied; if a template would not use this phrasing, it should not use <code>otherX()</code>.
+
==When to use this template==
 +
This template can be used on pages with an ambiguous title to direct readers that intended to read a similarly named article, to a [[WP:D|disambiguation page]].
 +
Please link to a page that includes the word "(disambiguation)" in the title (if one exists), as illustrated in the example above and suggested [[WP:INTDABLINK|here]].
  
== Usage from Lua ==
+
==When not to use this template==
To use this module from Lua, first load the module:
+
Do not use this template on an article with an unambiguous title; for example, a reader who searches specifically for "Paris, Virginia" is not likely to have been looking for an article about a city in France (or anywhere else), so it would ''not'' be appropriate to add {{tlx|other uses|Paris}} to the top of the [[Paris, Virginia]] article.  Also, do not use this template to link to an article that is not a disambiguation page; instead, one of the other [[WP:HATNOTE|hatnote templates]] listed below may be more appropriate for that purpose.
  
<source lang="lua">
+
{{Hatnote templates}}
local mOtheruses = require('Module:Other uses')
 
</source>
 
  
The module functions can then be used through the <code>_otheruses()</code> function:
+
== TemplateData ==
 +
{{TemplateData header}}
 +
<templatedata>
 +
{
 +
"description": "This template creates a note directing the reader to the disambiguation page related to the page it is included in.",
 +
"params": {
 +
"1": {
 +
"label": "Target page",
 +
"description": "Use this parameter to direct the user to a disambiguation page with a different title.",
 +
"type": "wiki-page-name"
 +
}
 +
}
 +
}
 +
</templatedata>
  
<source lang="lua">
+
<includeonly>{{sandbox other||
mOtheruses._otheruses(args, options)
+
[[Category:Hatnote templates]]
</source>
+
[[Category:Disambiguation and redirection templates]]
  
===Parameters of <code>_otheruses()</code>===
 
;args
 
:A table containing strings of link text, without brackets. For example, <code>{"PAGE1", "PAGE2#SECTION", "PAGE3<nowiki>|</nowiki>LABEL"}</code>. Make sure that there are no gaps or nil values, as that can confuse the <code>mw.text.listToText()</code> function the module uses. If in doubt, use <code>compressSparseArray()</code> from [[Module:TableTools]]. This may be empty or nil.
 
;options
 
:A table containing a number of optional named values; you must supply at least one of <code>options.defaultPage</code> or <code>options.title</code>; in most cases setting the latter to <code>mw.title.getCurrentTitle().prefixedText</code> is advisable. The following options are supported:
 
:*<code>defaultPage</code>: String; completely overrides the linked page when no arguments are supplied
 
:*<code>title</code>: String; sets the title used before the "(disambiguation)" suffix.
 
:*<code>disambiguator</code>: String; replaces "disambiguation" in the suffix
 
:*<code>otherText</code>: String; replaces "uses" in "other uses"
 
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
[[Category:Hatnote modules]]
 
 
}}</includeonly>
 
}}</includeonly>

Edição atual tal como às 08h17min de 18 de dezembro de 2019

Predefinição:High-use

Predefinição:For

This template creates a note directing the reader to the disambiguation page related to the page it is included in. The page to which is directed, can be a page whose name is the name of the current page with "(disambiguation)" appended to it. Or you can direct the user to a disambiguation page with a different title, by supplying it as an argument to the template.

Usage

{{Other uses}} results in

{{Other uses|Target (disambiguation)}} results in

When to use this template

This template can be used on pages with an ambiguous title to direct readers that intended to read a similarly named article, to a disambiguation page. Please link to a page that includes the word "(disambiguation)" in the title (if one exists), as illustrated in the example above and suggested here.

When not to use this template

Do not use this template on an article with an unambiguous title; for example, a reader who searches specifically for "Paris, Virginia" is not likely to have been looking for an article about a city in France (or anywhere else), so it would not be appropriate to add {{other uses|Paris}} to the top of the Paris, Virginia article. Also, do not use this template to link to an article that is not a disambiguation page; instead, one of the other hatnote templates listed below may be more appropriate for that purpose.

Predefinição:Hatnote templates

TemplateData

Cabeçalho de TemplateData

As informações a seguir (editar) são definidas com TemplateData. Isso possibilita o seu uso pelo Editor Visual e por outras ferramentas. Predefinição:Other uses/dados

This template creates a note directing the reader to the disambiguation page related to the page it is included in.

Parâmetros da predefinição

ParâmetroDescriçãoTipoEstado
Target page1

Use this parameter to direct the user to a disambiguation page with a different title.

Páginaopcional