Modulo:Mapframe: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m_args dichiarato all'inizio della funzione |
m modulo no globals obsoleto |
||
(4 versioni intermedie di un altro utente non mostrate) | |||
Riga 1:
require('
local getArgs = require('Module:Arguments').getArgs
local mWikidata = require('Module:Wikidata')
Riga 14 ⟶ 15:
local function getLegenda(points, ncols)
local divStyle = {
['-webkit-column-count'] = ncols
}
local divNode = mw.html.create('div'):css(divStyle)
Riga 23 ⟶ 25:
for _, point in ipairs(points) do
local pNode = mw.html.create('p')
:css('font-size', '90%') :css('margin-top', '0')
local codeNode = mw.html.create('code')
:css('font-weight', 'bold')
Riga 30 ⟶ 34:
:css('border', '2px solid ' .. point.col)
:css('background', point.col)
if not point.simb
codeNode:wikitext(' ')
elseif point.simb:find('-number') == 1 then
codeNode:wikitext(currNum)
currNum = currNum + 1
Riga 53 ⟶ 59:
function p._mappa(args)
local points = {}
local geo = args.dati or -1▼
local sinottico = tonumber(args.sinottico) or 0
local colore = args.colore or '#b80000'
local simbolo = args.simbolo or
local gruppo = args.gruppo or ''
local autozoom = args.autozoom or 's'
Riga 71 ⟶ 76:
}
-- =================================
-- popola la sequence points
-- =================================
local num = 1
if sinottico == 1 and args.lat1 == nil and args.lon1 == nil then
Riga 101 ⟶ 109:
end
num = num + 1
end
-- non utilizza nessun simbolo con un solo punto e args.simbolo e args.simbolo1 non definiti
if #points == 1 and args.simbolo == nil and args.simbolo1 == nil then
points[1].simb = nil
end
end
-- =================================
-- popola la table m_args
-- =================================
-- valore ingrandimento
if args.zoom then
m_args.zoom = tonumber(args.zoom)
elseif
if #points == 1 then
m_args.zoom = 10 -- valore predefinito per singolo punto
Riga 134 ⟶ 149:
if args.centro_lon then
m_args.longitude = tonumber(args.centro_lon)
elseif
if #points == 1 then
m_args.longitude = points[1].lon
Riga 144 ⟶ 159:
if args.centro_lat then
m_args.latitude = tonumber(args.centro_lat)
elseif
if #points == 1 then
m_args.latitude = points[1].lat
Riga 156 ⟶ 171:
end
-- =================================
-- popola la table m_dati
-- =================================
local m_dati
if
m_dati = args.dati
else▼
m_dati = { type = 'FeatureCollection', features = {} }
for i, point in ipairs(points) do
Riga 176 ⟶ 196:
end
m_dati = mw.text.jsonEncode(m_dati)
▲ else
end
|