Modulo:Mapframe/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
spostata e rivista gestione legenda in getLegenda, +mw.html
Riga 12:
end
 
local function agggetLegenda(tpoints, ...ncols)
local argsdivStyle = {...}
['column-count'] = ncols,
for _, s in ipairs(args) do
['-moz-column-count'] = ncols,
table.insert(t, s)
['-webkit-column-count'] = ncols
end
}
local divNode = mw.html.create('div'):css(divStyle)
local elenco_numcurrNum = 1
local elenco_lettcurrChar = 'A'
 
for _, spoint in ipairs(argspoints) do
agg(elenco_dati,stringlocal pNode = mw.html.formatcreate('<p style="'):cssText('font-size:90%%;border-left:4px solid %s">',points[i] .. point.col))
local text
if points[i]point.simb:find('-number') == 1 then
agg(elenco_dati,text = string.format('&nbsp;<b>%d</b>.',elenco_num) currNum)
currNum = currNum + 1
elseif points[i]point.simb:find('-letter') == 1 then
agg(elenco_dati,text = string.format('&nbsp;<b>%s</b>.',elenco_lett) currChar)
elenco_lettcurrChar = ('ABCDEFGHIJKLMNOPQRSTUVWXYZA'):match(elenco_lettcurrChar .. '(.)')
elseif points[i]point.simb == '' then
text = ''
else
agg(elenco_dati,text = string.format('[[File:Maki2-%s-18.svg|18px]]',points[i] point.simb))
end
pNode:wikitext(text .. ' ' .. point.nome)
divNode:node(pNode)
end
 
return tostring(divNode)
end
 
Line 32 ⟶ 56:
if args.cornice then cornice = tonumber(args.cornice) or 1 else cornice = 1 end
local lat1, lat2, lon1, lon2 = 400, -400, 400, -400
local elenco = tonumber(args.elenco) or 0
local elenco_dati = {}
local elenco_num = 1
local elenco_lett = 'A'
 
if args.didascalia then agg(elenco_dati, args.didascalia) end
 
if geo == -1 then
Line 69 ⟶ 87:
end
num = num + 1
end
if elenco == 2 then
agg(elenco_dati,'\n{| width="100%" style="font-size:90%"\n|-\n|width=50% valign=top|')
for i=1,#points do
agg(elenco_dati,string.format('<p style="border-left:4px solid %s">',points[i].col))
if points[i].simb:find('-number') == 1 then
agg(elenco_dati, string.format('&nbsp;<b>%d</b>.',elenco_num))
elenco_num = elenco_num+1
elseif points[i].simb:find('-letter') == 1 then
agg(elenco_dati, string.format('&nbsp;<b>%s</b>.',elenco_lett))
elenco_lett = ('ABCDEFGHIJKLMNOPQRSTUVWXYZA'):match(elenco_lett..'(.)')
elseif points[i].simb == '' then
else
agg(elenco_dati, string.format('[[File:Maki2-%s-18.svg|18px]]',points[i].simb))
end
agg(elenco_dati,string.format(' %s</p>',points[i].nome))
if (i == math.floor(#points/2 +0.5)) then agg(elenco_dati,'\n|width=50% valign=top|') end
end
agg(elenco_dati,'\n|}')
elseif elenco == 1 then
for i=1,#points do
agg(elenco_dati,string.format('<p style="font-size:90%%;border-left:4px solid %s">',points[i].col))
if points[i].simb:find('-number') == 1 then
agg(elenco_dati, string.format('&nbsp;<b>%d</b>.',elenco_num))
elenco_num = elenco_num+1
elseif points[i].simb:find('-letter') == 1 then
agg(elenco_dati, string.format('&nbsp;<b>%s</b>.',elenco_lett))
elenco_lett = ('ABCDEFGHIJKLMNOPQRSTUVWXYZA'):match(elenco_lett..'(.)')
elseif points[i].simb == '' then
else
agg(elenco_dati, string.format('[[File:Maki2-%s-18.svg|18px]]',points[i].simb))
end
agg(elenco_dati,string.format(' %s</p>',points[i].nome))
end
end
end
Line 151 ⟶ 135:
-- esclude didascalia per cornice = 0 e per sinottico = 1
if cornice == 1 and sinottico ~= 1 then
m_args.text = (args.didascalia or '') .. (args.elenco and getLegenda(points, args.elenco) or '')
m_args.text = mw.getCurrentFrame():preprocess(table.concat(elenco_dati))
end