66 476
contributi
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
(14 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 56: | Riga 56: | ||
local HTMLTable | local HTMLTable | ||
local CollectionTable = '' | local CollectionTable = '' | ||
local ExcludeP = { | local ExcludeP = {P3 = true, P14 = true, P26 = true, P30 = true, P37 = true, P58 = true, P68 = true} | ||
local Item = mw.wikibase.getEntity() | local Item = mw.wikibase.getEntity() | ||
local ItemQ = mw.wikibase.getEntityIdForCurrentPage() | local ItemQ = mw.wikibase.getEntityIdForCurrentPage() | ||
Riga 68: | Riga 68: | ||
AllP = mw.wikibase.orderProperties(Item:getProperties()) | AllP = mw.wikibase.orderProperties(Item:getProperties()) | ||
--Debug: list unsorted and sorted properties | |||
AllRows[#AllRows + 1] = {"In originale:" | --AllRows[#AllRows + 1] = {"getProperties:", Item:getProperties()} | ||
--AllRows[#AllRows + 1] = {"AllP:", AllP} | |||
PageTitle = mw.title.getCurrentTitle() | |||
if (mw.wikibase.getLabelByLang(ItemQ, 'en')) and (mw.wikibase.getLabelByLang(ItemQ, 'en')) ~= PageTitle.text then | |||
AllRows[#AllRows + 1] = {"In originale:", {mw.wikibase.getLabelByLang(ItemQ, 'en')}} | |||
end | end | ||
if (mw.wikibase.getLabelByLang(mw.wikibase. | if (mw.wikibase.getLabelByLang(ItemQ, 'it')) and (mw.wikibase.getLabelByLang(ItemQ, 'en')) ~= PageTitle.text then | ||
AllRows[#AllRows + 1] = {"In italiano:", {mw.wikibase.getLabelByLang( | AllRows[#AllRows + 1] = {"In italiano:", {mw.wikibase.getLabelByLang(ItemQ, 'it')}} | ||
end | end | ||
for _, Property in pairs(AllP) do | for _, Property in pairs(AllP) do | ||
Riga 90: | Riga 95: | ||
if (type(Value) == "table") then | if (type(Value) == "table") then | ||
if Property == "P72" then --CASE Assigments | if Property == "P72" then --CASE Assigments | ||
AccValues[#AccValues + 1] = LabelOrLink(SnakValue.qualifiers['P73'][1].datavalue.value['id']) .. " " .. LabelOrLink(Value['id']) .. " " .. LabelOrLink(SnakValue.qualifiers['P76'][1].datavalue.value['id']) .. " " .. LabelOrLink(SnakValue.qualifiers['P77'][1].datavalue.value['id']) | local Assignment = "" | ||
if SnakValue.qualifiers['P73'] then --Year | |||
Assignment = LabelOrLink(SnakValue.qualifiers['P73'][1].datavalue.value['id']) .. " " | |||
end | |||
if SnakValue.qualifiers['P15'] then | |||
Assignment = Assignment .. SnakValue.qualifiers['P15'][1].datavalue.value .. " " | |||
end | |||
Assignment = Assignment .. LabelOrLink(Value['id']) | |||
if SnakValue.qualifiers['P76'] then --Rank | |||
Assignment = Assignment .. ", " .. LabelOrLink(SnakValue.qualifiers['P76'][1].datavalue.value['id']) | |||
end | |||
if SnakValue.qualifiers['P77'] then --Occupation | |||
Assignment = Assignment .. ", " .. LabelOrLink(SnakValue.qualifiers['P77'][1].datavalue.value['id']) | |||
end | |||
--AccValues[#AccValues + 1] = LabelOrLink(SnakValue.qualifiers['P73'][1].datavalue.value['id']) .. " " .. LabelOrLink(Value['id']) .. ", " .. LabelOrLink(SnakValue.qualifiers['P76'][1].datavalue.value['id']) .. ", " .. LabelOrLink(SnakValue.qualifiers['P77'][1].datavalue.value['id']) | |||
AccValues[#AccValues + 1] = Assignment | |||
elseif Value['entity-type'] == 'item' then | elseif Value['entity-type'] == 'item' then | ||
local GenericItem | |||
if AddSemantic then | |||
GenericItem = LabelOrLink(Value['id'], Header[2]) | |||
else | |||
GenericItem = LabelOrLink(Value['id']) | |||
end | |||
if SnakValue.qualifiers and SnakValue.qualifiers['P15'] then | |||
GenericItem = SnakValue.qualifiers['P15'][1].datavalue.value .. " " .. GenericItem | |||
end | |||
AccValues[#AccValues + 1] = GenericItem | |||
elseif SnakValue.mainsnak.datavalue['type'] == 'time' then | elseif SnakValue.mainsnak.datavalue['type'] == 'time' then | ||
if AddSemantic then | if AddSemantic then |