66 521
contributi
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
Riga 157: | Riga 157: | ||
function p.CategoryTree(frame) | function p.CategoryTree(frame) | ||
local AZInstancesMember = {Q23 = "Personaggi", Q18 = "Specie", Q95 = "Pianeti", Q19 = "Cast"} | local AZInstancesMember = {Q23 = "Personaggi", Q18 = "Specie", Q95 = "Pianeti", Q19 = "Cast"} | ||
local CurrentItem = mw.wikibase.getEntity() | --local CurrentItem = mw.wikibase.getEntity() | ||
local CurrentQ = CurrentItem.claims['P14'][1].mainsnak.datavalue.value.id | |||
local AZCategory = '' | local AZCategory = '' | ||
if AZInstancesMember[ | if AZInstancesMember[CurrentQ] ~= nil then | ||
-- Generate auto A-Z Category | -- Generate auto A-Z Category | ||
-- TDOO generate 09 for numeric labels | -- TDOO generate 09 for numeric labels | ||
local FirstLetter = string.upper(string.sub(mw.wikibase.getLabel(), 1, 1)) | local FirstLetter = string.upper(string.sub(mw.wikibase.getLabel(), 1, 1)) | ||
AZCategory = "[[Category:" .. AZInstancesMember[ | AZCategory = "[[Category:" .. AZInstancesMember[CurrentQ] .. " - " .. FirstLetter .. "]]" | ||
return "TRUE" .. (table.concat(p.PropertiesOnTree("P68", 1, true))) .. AZCategory | return "TRUE" .. (table.concat(p.PropertiesOnTree("P68", 1, true))) .. AZCategory | ||
else | else |