Module:About-distinguish: Difference between revisions

Content deleted Content added
Basic implementation of Template:About-distinguish
 
m Merging the sentences is more likely to be interpreted as referring to the article or even its subject. Having the sentences unconnected doesn't make sense.
 
(5 intermediate revisions by 4 users not shown)
Line 10:
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
 
Line 38 ⟶ 44:
[14] = 'category'
},
sectionString = 'section',
formatted = true
}
for k, v in pairs(defaultOptions) do
Line 51 ⟶ 58:
local about = table.remove(args, 1)
 
--Assemble everything together and return
--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 wde31 = (wde and wde.formatPropertyValues('P31').value) == 'human'
local wde21 = wde and wde.formatPropertyValues('P21').value
local pronoun = wde31 and (pronouns[wde21] or pronouns['default']) or 'It is'
local text = string.format(
'This %s is about %s. %sand is not to be confused with %s.',
pageType,
about,
mHatlist.orList(args, trueoptions.formatted)
pronoun,
mHatlist.orList(args, true)
)
return mHatnote._hatnote(text)