Mudanças

Ir para navegação Ir para pesquisar

Predefinição:Other uses/doc

2 809 bytes adicionados, 09h14min de 18 de dezembro de 2019
Criação da Documentação do Módulo Other Users.
<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]]) -->
{{high-risk|111000+}}
{{Module rating|protected}}
This module produces an "other uses" hatnote for linking to disambiguation pages. It implements the {{tl|other uses}} template.

== Usage from wikitext==
===otheruses()===
The <code>otheruses()</code> function directly implements {{tl|other uses}} and probably shouldn't be used anywhere else.

===otherX()===
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:

<source lang="text">{{#invoke:other uses|otherX|places with the same name}}</source>

Note that the leading "other" is automatically supplied; if a template would not use this phrasing, it should not use <code>otherX()</code>.

== Usage from Lua ==
To use this module from Lua, first load the module:

<source lang="lua">
local mOtheruses = require('Module:Other uses')
</source>

The module functions can then be used through the <code>_otheruses()</code> function:

<source lang="lua">
mOtheruses._otheruses(args, options)
</source>

===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>

Menu de navegação