Module:About-distinguish: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (1 revision imported)
No edit summary
 
Line 50: Line 50:
args = mTableTools.compressSparseArray(args)
args = mTableTools.compressSparseArray(args)
local about = table.remove(args, 1)
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
--Assemble everything together and return
local text = string.format(
local text = string.format(
'This %s is about %s. %s not to be confused with %s.',
'This %s is about %s, not to be confused with %s.',
pageType,
pageType,
about,
about,
pronoun,
mHatlist.orList(args, true)
mHatlist.orList(args, true)
)
)

Navigation menu