Modulo:Codice statistico/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nuova sandbox |
aggiornato alla versione corrente |
||
Riga 10:
local p = {}
-- Funzione di formattazione del codice municipale austriaco (Statistik Austria)
local function
local formatted_id = string.gsub(id, "(%d%d)(%d)(%d%d)(%d%d%d)", "%1 %2 %3 %4")▼
return string.format('[http://www.statistik-portal.de/Statistik-Portal/gemeindeverz.asp?G=%s %s]', id, formatted_id)▼
end▼
local function formatP964(id)▼
local formatted_id = string.gsub(id, "(%d)(%d%d)(%d%d)", "%1 %2 %3")
return string.format('[http://www.statistik.at/blickgem/gemDetail.do?gemnr=%s %s]', id, formatted_id)
end
-- Funzione di formattazione del codice municipale tedesco (Statistisches Bundesamt)
local codes = {▼
AUT = { prop = 'P964', catprefix = 'Codice municipale austriaco', format = formatP964 },▼
▲ local formatted_id = string.gsub(id, "(%d%d)(%d)(%d%d)(%d%d%d)", "%1 %2 %3 %4")
▲ return string.format('[http://www.statistik-portal.de/Statistik-Portal/gemeindeverz.asp?G=%s %s]', id, formatted_id)
▲end
-- Codici statistici configurati
CHE = { prop = 'P771', catprefix = 'Codice OFS' },
DEU = { prop = 'P439', catprefix = 'Codice municipale tedesco', format =
ESP = { prop = 'P772', catprefix = 'Codice INE' },
FRA = { prop = 'P374', catprefix = 'Codice INSEE' },
Riga 36 ⟶ 39:
cat = string.format('%s assente su Wikidata', code.catprefix)
elseif wdval == userval then
cat = code.catuguali and string.format('%s uguale a Wikidata', code.catprefix)
else
cat = string.format('%s differente da Wikidata', code.catprefix)
end
elseif wdval then
Riga 56 ⟶ 59:
-- ricerca paese
if args.iso3166 then
code =
end
if not code then
local iso3166 = mWikidata._getProperty({ 'P17', showprop = 'P298', from = args.from, n = 1 })
code =
end
-- valore letto da Wikidata ▼
if code then
wdval = mWikidata._getProperty({ code.prop, from = args.from, n = 1 })
formatted_wdval = (wdval and code.format) and code.format(wdval) or wdval
formatted_userval = (userval and code.format) and code.format(string.gsub(userval, ' ', '')) or userval
end▼
cat = getWikidataCategory(userval, wdval, code)
end
|