Modulo:Codice statistico: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
+tabella HTML
+codici, +grado amministrativo
Riga 24:
-- Codici statistici configurati
local statCodes = {
AUT = {
AUT = { prop = 'P964', catprefix = 'Codice municipale austriaco', format = formatSA },
CHE default = { prop = 'P771P964', catprefix = 'Codice OFSmunicipale austriaco', format = formatSA },
},
DEU = { prop = 'P439', catprefix = 'Codice municipale tedesco', format = formatDestatis },
CHE = {
ESP = { prop = 'P772', catprefix = 'Codice INE' },
FRA default = { prop = 'P374P771', catprefix = 'Codice INSEEOFS' },
},
ITA = { prop = 'P635', catprefix = 'Codice ISTAT' }
DEU = {
AUT default = { prop = 'P964P439', catprefix = 'Codice municipale austriacotedesco', format = formatSAformatDestatis },
},
ESP = {
ESP default = { prop = 'P772', catprefix = 'Codice INE' },
},
FRA = {
DEU ["1"] = { prop = 'P439P2585', catprefix = 'Codice municipaleregione tedescoINSEE', format = formatDestatis },
["2"] = { prop = 'P2586', catprefix = 'Codice dipartimento INSEE' },
["4"] = { prop = 'P2506', catprefix = 'Codice cantone INSEE' },
default = { prop = 'P374', catprefix = 'Codice INSEE' }
},
ITA = {
ITA default = { prop = 'P635', catprefix = 'Codice ISTAT' }
}
}
 
Line 35 ⟶ 50:
local cat
if userval then
userval = string.gsub(userval, ' ', '')
if not wdval then
cat = string.format('%s assente su Wikidata', code.catprefix)
elseif string.gsub(wdval, ' ', '') == string.gsub(userval, ' ', '') then
cat = code.catuguali and string.format('%s uguale a Wikidata', code.catprefix)
else
Line 69 ⟶ 83:
:tag('th')
:wikitext('Paese')
:done()
:tag('th')
:wikitext('Grado amministrativo')
:done()
:tag('th')
Line 74 ⟶ 91:
:done()
 
for idx_, keyiso3166 in ipairs(sortedCodes) do
local codecodes = statCodes[keyiso3166]
for key, value in pairs(codes) do
tableNode
:tag('tr')tableNode
:tag('tdtr')
:wikitexttag(code.catprefix'td')
:donewikitext(value.catprefix)
:tagdone('td')
:wikitexttag(key'td')
:donewikitext(iso3166)
:tagdone('td')
:tag('td')
:wikitext(string.format('[[d:p:%s|%s (%s)]]', code.prop, mWikidata._getLabel( { code.prop } ), code.prop))
:wikitext(key == 'default' and 'predefinito' or key)
:done()
:done()
:tag('td')
:wikitext(string.format('[[d:p:%s|%s (%s)]]', codevalue.prop, mWikidata._getLabel( { codevalue.prop } ), codevalue.prop))
:done()
end
end
 
Line 107 ⟶ 129:
local iso3166 = mWikidata._getProperty({ 'P17', showprop = 'P298', from = args.from, n = 1 })
code = statCodes[iso3166]
end
-- ricerca grado amministrativo
if code then
code = code[args.grado] or code.default
end