Abrir menu principal

Mudanças

Predefinição:Other uses/doc

632 bytes removidos, 09h17min de 18 de dezembro de 2019
sem sumário de edição
<includeonly>{{Being deleted|2019 May 15|Module:Other_uses2documentation subpage}}</includeonly><!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->{{highHigh-riskuse|111000+53271 }}{{lua|Module rating|protected:Other uses}}This module produces an "other uses" hatnote for linking to disambiguation pages. It implements the {{tlfor|navboxes|other usesTemplate:Navigation templates}} template.
== Usage from wikitext=====otheruses()===This template creates a note directing the reader to the [[WP:DISAMBIGUATION|disambiguation page]] related to the page it is included in. The <code>otherusespage to which is directed, can be a page whose name is the name of the current page with "(disambiguation)</code> function directly implements {{tl|other uses}} and probably shouldn't be used anywhere else" 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.
===otherX()=Usage==The <code>otherX()</code> function allows direct implementation of templates that differ from '''{{tlTlx|other Other uses}} results 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:
<source lang="text">'''{{Tlx|Other uses|Target (disambiguation)}} results in'''{{#invoke:other uses|otherX|places with the same nameTarget (disambiguation)}}</source>
Note ==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 leading word "other(disambiguation)" is automatically supplied; in the title (if a template would not use this phrasingone exists), it should not use <code>otherX()</code>as illustrated in the example above and suggested [[WP:INTDABLINK|here]].
== Usage from Lua When not to use this template==To 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 module from Luatemplate to link to an article that is not a disambiguation page; instead, first load one of the moduleother [[WP:HATNOTE|hatnote templates]] listed below may be more appropriate for that purpose.
<source lang="lua">local mOtheruses = require('Module:Other uses')</source>{{Hatnote templates}}
The module functions can then be used through the == TemplateData =={{TemplateData header}}<codetemplatedata>_otheruses(){ "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" } }}</codetemplatedata> function:
<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>