66 689
contributi
m (Item.id) |
(Categorie automatiche con serie) |
||
Riga 44: | Riga 44: | ||
local Opening = '[[Categoria:' | local Opening = '[[Categoria:' | ||
local CategoryP = 'P30' | local CategoryP = 'P30' | ||
local AbbrP = 'P24' | |||
local SeriesP = 'P16' | |||
local InstanceQ | local InstanceQ | ||
Riga 54: | Riga 56: | ||
end | end | ||
--Categories mannually inserted into the Item | |||
local ItemCategories = Item:getAllStatements(CategoryP) | local ItemCategories = Item:getAllStatements(CategoryP) | ||
for _, ItemCategory in pairs(ItemCategories) do | for _, ItemCategory in pairs(ItemCategories) do | ||
Riga 59: | Riga 62: | ||
end | end | ||
--Categorie dell'Item indicato in istanza | |||
InstanceQ = mw.wikibase.getEntity(Item['claims']['P14'][1].mainsnak.datavalue.value['id']) | InstanceQ = mw.wikibase.getEntity(Item['claims']['P14'][1].mainsnak.datavalue.value['id']) | ||
local InstanceCategories = InstanceQ:getAllStatements(CategoryP) | local InstanceCategories = InstanceQ:getAllStatements(CategoryP) | ||
for _, InstanceCategory in pairs(InstanceCategories) do | for _, InstanceCategory in pairs(InstanceCategories) do | ||
AllCategories[#AllCategories + 1] = Opening .. InstanceCategory.mainsnak.datavalue['value'] .. ']]' | AllCategories[#AllCategories + 1] = Opening .. InstanceCategory.mainsnak.datavalue['value'] .. ']]' | ||
--Category generated joining the item's Instance category plus the Series short name IF it exists | |||
if Item:getAllStatements(SeriesP) then | |||
for _, InstanceSeries in pairs(Item:getAllStatements(SeriesP)) do | |||
AllCategories[#AllCategories + 1] = Opening .. InstanceCategory.mainsnak.datavalue['value'] .. ' di ' .. InstanceSeries.mainsnak.datavalue['value'] .. ']]' | |||
end | |||
end | |||
end | end | ||