Module:About-distinguish
{{About-distinguish}} is a template for noting other uses when there could be confusion with another topic.
| This module depends on the following other modules: |
sex or gender (P21) (see uses)
instance of (P31) (see uses)
"This page is about … It is not to be confused with …"
{{About-distinguish}} is a template for noting other uses when there could be confusion with another topic.
{{about-distinguish|USE1|PAGE1}}→{{about-distinguish|USE1|PAGE1|PAGE2}}→{{about-distinguish|USE1|PAGE1{{!}}DISPLAY-TEXT|PAGE2#SECTION|PAGE3}}→
For cases requiring custom text, use {{about-distinguish2}} instead:
{{about-distinguish-text|USE1|TEXT}}→
If the page's Wikidata item has the property of being an instance of "human", then the template will try to replace "It" in "It is not to be confused with" with a more appropriate pronoun, based on the value of the "sex or gender" property of the item.
template for noting other uses when there could be confusion with another topic. For a version with custom text instead of links to other pages, see Template:about-distinguish-text
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| USE (what this page is about) | 1 | This is shown for the thing saying 'This page is about ...' | String | required |
| PAGE1 | 2 | First page to be shown in the 'Not to be confused with [[PAGE1]]' text. Enter the page name (and section)
| Page name | required |
| PAGE2 | 3 | Another thing that the subject of this page is not to be confused with | Page name | optional |
| PAGE3 | 4 | Yet another thing that the subject of this page is not to be confused with | Page name | optional |
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments --initialize lazily
local mTableTools = require('Module:TableTools')
local checkType = require('libraryUtil').checkType
local p = {}
function p.aboutDistinguish (frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame)
return p._aboutDistinguish(args)
end
function p.aboutDistinguishText (frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame)
return p._aboutDistinguish(args, {formatted = false})
end
function p._aboutDistinguish(args, options)
-- Type checks and defaults
checkType('_aboutDistinguish', 1, args, 'table')
if not args[1] then
return mHatnote.makeWikitextError(
'no about topic supplied',
'Template:About-distinguish',
args.category
)
end
if not args[2] then
return mHatnote.makeWikitextError(
'no page to be distinguished supplied',
'Template:About-distinguish',
args.category
)
end
checkType('_aboutDistinguish', 2, options, 'table', true)
options = options or {}
local defaultOptions = {
defaultPageType = 'page',
namespace = mw.title.getCurrentTitle().namespace,
pageTypesByNamespace = {
[0] = 'article',
[14] = 'category'
},
sectionString = 'section',
formatted = true
}
for k, v in pairs(defaultOptions) do
if options[k] == nil then options[k] = v end
end
-- Set pieces of initial "about" string
local pageType = (args.section and options.sectionString) or
options.pageTypesByNamespace[options.namespace] or
options.defaultPageType
args = mTableTools.compressSparseArray(args)
local about = table.remove(args, 1)
--Get pronoun from Wikidata. Really basic, but it should work.
local pronouns = {
['female'] = 'She is',
['transgender female'] = "She is",
['male'] = 'He is',
['transgender male'] = 'He is',
['default'] = 'They are'
}
local wde = mw.wikibase.getEntity()
local p31 = (wde and wde:formatPropertyValues('P31').value) == 'human'
local p21 = wde and wde:formatPropertyValues('P21').value
local pronoun = p31 and (pronouns[p21] or pronouns['default']) or 'It is'
--Assemble everything together and return
local text = string.format(
'This %s is about %s. %s not to be confused with %s.',
pageType,
about,
pronoun,
mHatlist.orList(args, options.formatted)
)
return mHatnote._hatnote(text)
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.