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 },▼
},
DEU = { prop = 'P439', catprefix = 'Codice municipale tedesco', format = formatDestatis },▼
CHE = {
ESP = { prop = 'P772', catprefix = 'Codice INE' },▼
},
ITA = { prop = 'P635', catprefix = 'Codice ISTAT' }▼
DEU = {
▲
},
ESP = {
},
FRA = {
▲
["2"] = { prop = 'P2586', catprefix = 'Codice dipartimento INSEE' },
["4"] = { prop = 'P2506', catprefix = 'Codice cantone INSEE' },
default = { prop = 'P374', catprefix = 'Codice INSEE' }
},
ITA = {
}
}
Line 35 ⟶ 50:
local cat
if userval then
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')
:tag('th')
:wikitext('Grado amministrativo')
:done()
:tag('th')
Line 74 ⟶ 91:
:done()
for
local
for key, value in pairs(codes) do
:tag('
:
:
:
:
:
:
: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)]]',
: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
|