切换搜索
搜索
切换菜单
notifications
切换个人菜单
查看“模块:Other uses/doc”的源代码
来自决策链云智库
更多操作
←
模块:Other uses/doc
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{high-risk}} {{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: <syntaxhighlight lang="text">{{#invoke:other uses|otherX|places with the same name}}</syntaxhighlight> 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: <syntaxhighlight lang="lua"> local mOtheruses = require('Module:Other uses') </syntaxhighlight> The module functions can then be used through the <code>_otheruses()</code> function: <syntaxhighlight lang="lua"> mOtheruses._otheruses(args, options) </syntaxhighlight> ===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>
本页使用的模板:
模板:High-use
(
查看源代码
)
模板:High-use
(
查看源代码
)
模板:Module rating
(
查看源代码
)
模板:Tl
(
查看源代码
)
模块:High-use
(
查看源代码
)
模块:Message box
(
查看源代码
)
模块:Message box/configuration
(
查看源代码
)
模块:Message box/ombox.css
(
查看源代码
)
模块:Transclusion count
(
查看源代码
)
模块:Transclusion count/data/O
(
查看源代码
)
模块:Yesno
(
查看源代码
)
返回
模块:Other uses/doc
。