67 251
contributi
(Category type Q52 (Real person) added) |
(Improved CategoryTree) |
||
Riga 163: | Riga 163: | ||
if AZInstancesMember[CurrentQ] ~= nil then | if AZInstancesMember[CurrentQ] ~= nil then | ||
local FirstLetter | local FirstLetter | ||
FirstLetter = string.upper(string.sub(mw.wikibase.getLabel(), 1, 1)) | if mw.wikibase.getEntity().claims['P8'] ~= nil then | ||
--Manual criteria has precedence | |||
FirstLetter = string.upper(mw.wikibase.getEntity().claims['P8'][1].mainsnak.datavalue.value) | |||
else | |||
local Label = mw.wikibase.getLabel() | |||
if AZInstancesMember[CurrentQ] == "Personaggi" or AZInstancesMember[CurrentQ] == "Cast" then | |||
--Person or character: process surname | |||
local Match = string.match(Label, "[^%s]+$") | |||
FirstLetter = string.upper(string.sub(Match, 1, 1)) | |||
else | |||
--No person: take first letter | |||
FirstLetter = string.upper(string.sub(mw.wikibase.getLabel(), 1, 1)) | |||
end | |||
end | |||
if string.find(FirstLetter, "%d") ~= nil then | if string.find(FirstLetter, "%d") ~= nil then | ||
FirstLetter = "0-9" | FirstLetter = "0-9" |