Modulo:DTBase: differenze tra le versioni

Da Wikitrek.
mNessun oggetto della modifica
Escape ID in URL
Riga 167: Riga 167:
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
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)) .. "(" .. mw.uri.encode(Item.claims[Property][1].mainsnak.datavalue.value, "QUERY") .. ")" -- [[:" .. SiteLink['site'] .. ":" .. SiteLink['title'] .. "|''" .. SiteLink['title'] .. "'']], " .. TitleLabel
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))
-- 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)
Riga 175: Riga 175:
return table.concat(AllExtID, string.char(10))
return table.concat(AllExtID, string.char(10))
end
end
--------------------------------------------------------------------------------
-- Return a URL for the external IDentifier
--
-- @param Property The P beign processed
-- @param The ID value itself
--
-- @return string String containing escaped URL
--------------------------------------------------------------------------------
function p.ExtIDLink(Property, Value)
function p.ExtIDLink(Property, Value)
local ExtIDP = 'P5'
local ExtIDP = 'P5'