66 506
contributi
Nessun oggetto della modifica |
(Species category added) |
||
(2 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 170: | Riga 170: | ||
return p.PropertiesOnTree("P16", 3, false) | return p.PropertiesOnTree("P16", 3, false) | ||
end | end | ||
-------------------------------------------------------------------------------- | |||
-- Build and return the list of categories for a specific page | |||
-- | |||
-- @param {Frame} Info from MW session | |||
-- @return {string} List of properties in Wikitext | |||
-------------------------------------------------------------------------------- | |||
function p.CategoryTree(frame) | function p.CategoryTree(frame) | ||
local AZInstancesMember = {Q23 = "Personaggi", Q18 = "Specie", Q95 = "Pianeti", Q19 = "Cast", Q52 = "Cast"} | local AZInstancesMember = {Q23 = "Personaggi", Q18 = "Specie", Q95 = "Pianeti", Q19 = "Cast", Q52 = "Cast"} | ||
Riga 176: | Riga 182: | ||
local UpperCategories | local UpperCategories | ||
local AZCategory = '' | local AZCategory = '' | ||
local SpeciesCategory = '' | |||
if mw.wikibase.getEntity() then | if mw.wikibase.getEntity() then | ||
Riga 204: | Riga 211: | ||
AZCategory = "[[Category:" .. AZInstancesMember[CurrentQ] .. " - " .. FirstLetter .. "]]" | AZCategory = "[[Category:" .. AZInstancesMember[CurrentQ] .. " - " .. FirstLetter .. "]]" | ||
return (p.PropertiesOnTree("P68", 1, false) or "") .. AZCategory | |||
-- Check if item has Species (P65) property | |||
if mw.wikibase.getEntity().claims['P65'] ~= nil then | |||
SpeciesCategory = "[[Category:" .. AZInstancesMember[CurrentQ] .. " - " .. mw.wikibase.getLabelByLang(mw.wikibase.getEntity().claims['P65'][1].mainsnak.datavalue.value.id, "it") .. "]]" | |||
end | |||
return (p.PropertiesOnTree("P68", 1, false) or "") .. AZCategory .. SpeciesCategory | |||
else | else | ||
UpperCategories = p.PropertiesOnTree("P68", 2, true) | UpperCategories = p.PropertiesOnTree("P68", 2, true) |