Modulo:Maplink/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nuova pagina: require('Module:No globals') local getArgs = require('Module:Arguments').getArgs local p = {} local pp = {} local txt = {} local function agg(...) local args = {....
 
mNessun oggetto della modifica
Riga 6:
local txt = {}
 
local function agg(t,...)
local args = {...}
for _, s in ipairs(args) do
table.insert(txtt, s)
end
end
Riga 79:
if (zoom < 0) then zoom = 0 elseif (zoom>18) then zoom = 18 end
if (cornice == 1) then
agg(txt,'\n{| class="wikitable')
if (allinea == 'right') then agg(txt,' floatright') elseif (allinea == 'left') then agg(txt,' foatleft') end
agg(txt,'" style="border: 1px solid darkgray;')
if (allinea == 'center') then agg(txt,'margin-left: auto; margin-right: auto') end
agg(txt,'"\n|-\n|style="width: ',largh,'px;"|')
end
local gr1 = {}
Riga 99:
gr1[zoom+1],'" }' }
for i=1,#pp do
table.insertagg(gr2,',{"lat":'..,pp[i].lat..,',"lon":'..,pp[i].lon..,',"size":"200","color":"'..,pp[i].col..,'","strokeColor":"","shape":"circle","text":"","textAlign":"left","textBaseline":"middle","textDx":0,"textDy":1,"textFontSize":10},{"lat":',pp[i].lat,',"lon":',pp[i].lon,',"shape":"square","size": "0","text":"',pp[i].num,'","textAlign":"center","textBaseline":"bottom","textDx":0,"textDy":5.5,"textFont":"Arial","textFontSize": 11,"textFontWeight":"bold","textColor":"white"}')
table.insert(gr2,',{"lat":'..pp[i].lat..',"lon":'..pp[i].lon..',"shape":"square","size": "0","text":"'..pp[i].num..'","textAlign":"center","textBaseline":"bottom","textDx":0,"textDy":5.5,"textFont":"Arial","textFontSize": 11,"textFontWeight":"bold","textColor":"white"}')
end
agg(txt, mw.getCurrentFrame():expandTemplate { title = "Graph:Street map with marks",
args = { lat = centroy, lon = centrox, zoom = zoom, width = largh, height = altezza, minimap = 0, table.concat(gr2) }
} )
agg(txt,'<div style="text-align:left;font-size:70%;color:grey"><span style="font-size:125%">{{#tag:maplink|\n[ {"type": "FeatureCollection", "features": [')
for i=1,#pp do
if (i>1) then agg(txt,',') end
agg(txt,'{"type":"Feature","geometry":{"type":"Point","coordinates":[',pp[i].lon,',',pp[i].lat,'] }')
agg(txt,',"properties":{"title": "',pp[i].nome,'","description":"","marker-symbol": "-number',gruppo,'","marker-size":"medium","marker-color":"',pp[i].col,'" } }')
end
agg(txt,'] } ]|zoom=',zoom,'|latitude=',centroy,'|longitude=',centrox,'|text="[Schermo intero]"}}</span>')
agg(txt,'<div style="float:right" class="plainlinks nourlexpansion">[https://wikimediafoundation.org/wiki/Maps_Terms_of_Use Wikimedia] | © [https://www.openstreetmap.org/copyright OSM]</div></div>')
 
if (cornice == 1) then
agg(txt,'\n|-')
if not (dida == '') then agg(txt,'\n|style="font-size:90%"|',dida) end
if (elenco == '2') then
if (dida == '') then agg(txt,'\n|') end
agg(txt,'\n{| width="100%"\n|-\n|width=50% valign=top|<small>')
for i=1,#pp do
agg(txt,'{{NumLegenda|',pp[i].num,'|',pp[i].col,'|',pp[i].nome,'}}<br/>')
if (i == math.floor(#pp/2 +0.5)) then agg(txt,'</small>\n|width=50% valign=top|<small>') end
end
agg(txt,'</small>\n|}')
elseif (elenco == '1') then
if (dida == '') then agg(txt,'\n|style="font-size:90%"|') else agg(txt,'<br/>') end
agg(txt,'<small>')
for i=1,#pp do
agg(txt,'{{NumLegenda|',pp[i].num,'|',pp[i].col,'|',pp[i].nome,'}}<br/>')
end
end
agg(txt,'</small>\n|}')
end
return frame:preprocess(table.concat(txt))