Modulo:Codice statistico: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m spazio
m modulo no globals obsoleto
 
(6 versioni intermedie di un altro utente non mostrate)
Riga 3:
]]--
 
require('Modulo:No globalsstrict')
 
local getArgs = require('Modulo:Arguments').getArgs
Riga 13:
-- @return {string}
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
Riga 22:
-- @return {string}
local function formatP439(id)
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
Riga 31:
-- @return {string}
local function formatP440(id)
return string.gsub(id, "'(%d%d)(%d)(%d%d)"', "'%1 %2 %3"')
end
 
Riga 83:
local statCodes = {
AUT = {
default = { prop = 'P964', catprefix = 'Codice municipale austriaco', format = formatP964 }
},
BEL = {
default = { prop = 'P1567', catprefix = 'Codice INS' }
},
BRA = {
default = { prop = 'P1585', catprefix = 'Codice municipale IBGE', format = formatP1585 }
},
CHE = {
default = { prop = 'P771', catprefix = 'Codice OFS', compare = compareP771 }
},
CHN = {
default = { prop = 'P442' }
},
CZE = {
default = { prop = 'P782', catprefix = 'Codice LAU' }
},
DEU = {
["'1"'] = {}, -- disabilitato
["'3"'] = { prop = 'P440', catprefix = 'Codice dei distretti tedesco', format = formatP440 },
default = { prop = 'P439', catprefix = 'Codice municipale tedesco', format = formatP439 }
},
DNK = {
default = { prop = 'P1168', catprefix = 'Codice municipale danese' }
},
ESP = {
default = { prop = 'P772', catprefix = 'Codice INE' }
},
FRA = {
["'1"'] = { prop = 'P2585', catprefix = 'Codice regione INSEE' },
["'2"'] = { prop = 'P2586', catprefix = 'Codice dipartimento INSEE' },
["'3"'] = { prop = 'P3423', catprefix = 'Codice arrondissement INSEE' },
["'4"'] = { prop = 'P2506', catprefix = 'Codice cantone INSEE' },
default = { prop = 'P374', catprefix = 'Codice INSEE', format = formatP374 }
},
HUN = {
default = { prop = 'P939', catprefix = 'Codice KSH', format = formatP939 }
},
ITA = {
default = { prop = 'P635', catprefix = 'Codice ISTAT' }
},
NLD = {
default = { prop = 'P382', catprefix = 'Codice municipale CBS' }
},
NOR = {
default = { prop = 'P2504', catprefix = 'Codice municipale norvegese' }
},
UKR = {
default = { prop = 'P1077', catprefix = 'Codice KOATUU' }
}
}
Line 137 ⟶ 140:
-- @param {string} userval
-- @param {string} wdval
-- @returnparam {booleantable} code
-- @return {string}
local function getWikidataCategory(userval, wdval, code)
local cat
Line 145 ⟶ 149:
if userval then
if not wdval then
cat = string.format('%s assente su Wikidata', code.catprefixprop)
elseif comparefunc(wdval, userval) then
cat = string.format('%s uguale asu Wikidata', code.catprefixprop)
else
cat = string.format('%s differente dasu Wikidata', code.catprefixprop)
end
elseif wdval then
cat = string.format('%s lettoletta da Wikidata', code.catprefixprop)
end
 
Line 200 ⟶ 204:
for key, value in pairs(codes) do
if value.prop then
local catLetto = value.catprefixprop .. ' lettoletta da Wikidata'
local pagesInCat = mw.site.stats.pagesInCategory(catLetto, 'pages')
tableNode
:tag('tr')
:tag('td')
:wikitext(mw.wikibase.getLabel(value.catprefixprop))
:done()
:tag('td')