Modulo:DTBase: differenze tra le versioni
Da Wikitrek.
Backlink routine fixed |
m External source process routine |
||
| Riga 156: | Riga 156: | ||
return table.concat(AllLinks, string.char(10)) | return table.concat(AllLinks, string.char(10)) | ||
end | end | ||
function p.ExternalID() | function p.ExternalID(frame) | ||
local AllExtID = {} | local AllExtID = {} | ||
local AllSources = {} | |||
local SourcesP = {} | |||
local Item = mw.wikibase.getEntity() | local Item = mw.wikibase.getEntity() | ||
local AllP | local AllP | ||
local finalList | |||
if not Item then | if not Item then | ||
Item = mw.wikibase.getEntity('Q1') | Item = mw.wikibase.getEntity('Q1') | ||
| Riga 165: | Riga 168: | ||
AllP = mw.wikibase.orderProperties(Item:getProperties()) | AllP = mw.wikibase.orderProperties(Item:getProperties()) | ||
SourcesP = {P200 = true} | |||
for _, Property in pairs(AllP) do | for _, Property in pairs(AllP) do | ||
if Item.claims[Property][1].mainsnak.datatype == 'external-id' then | if Item.claims[Property][1].mainsnak.datatype == 'external-id' then | ||
-- Sets semantic property | -- Sets semantic property | ||
mw.smw.set((mw.wikibase.getLabelByLang(Property, 'it') or mw.wikibase.getLabel(Property)) .. " = " .. Item.claims[Property][1].mainsnak.datavalue.value) | mw.smw.set((mw.wikibase.getLabelByLang(Property, 'it') or mw.wikibase.getLabel(Property)) .. " = " .. Item.claims[Property][1].mainsnak.datavalue.value) | ||
if (SourcesP[Property]) then | |||
--ID is for external source | |||
table.insert(AllSources, "* " .. frame:expandTemplate{title = 'CitazioneIEEE', args = {'Contributori Memory Alpha', 'Gaila (Orioniana)', 'Memory Alpha', '2025-03-16', p.ExtIDLink(Property, Item.claims[Property][1].mainsnak.datavalue.value)}}) | |||
else | |||
--ID is normal external link | |||
AllExtID[#AllExtID + 1] = "* [" .. p.ExtIDLink(Property, Item.claims[Property][1].mainsnak.datavalue.value) .. " ''" .. Item.claims[Property][1].mainsnak.datavalue.value .. "''], " .. (mw.wikibase.getLabelByLang(Property, 'it') or mw.wikibase.getLabel(Property)) | |||
end | |||
end | end | ||
end | end | ||
finalList = table.concat(AllExtID, string.char(10)) | |||
if AllSources ~= nil then | |||
finalList = finalList .. "== Fonti Esterne (experimental) ==" .. string.char(10) .. table.concat(AllSources, string.char(10)) | |||
end | |||
return finalList | |||
end | end | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||