Modulo:Coord: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m Ha protetto "Modulo:Coord": Template o modulo usato in maniera estensiva ([Modifica=Consentito solo agli amministratori] (infinito) [Spostamento=Consentito solo agli amministratori] (infinito))
Moroboshi (discussione | contributi)
per Rotpunkt: sostituita getEntity con getEntityObject e sostituito htmlBuilder con mw.html
Riga 27:
local args = {} -- argomenti passati al template
local errorTable = {} -- table per contenere gli errori da ritornare
 
-- Import
local htmlBuilder = require("Modulo:HtmlBuilder")
 
-- Configurazione
Riga 61 ⟶ 58:
local entity, value, lat, long
 
entity = mw.wikibase.getEntitygetEntityObject()
if entity and entity.claims and entity.claims.p625P625 and
entity.claims.p625P625[0].mainsnak.snaktype == "value" then
value = entity.claims.p625P625[0].mainsnak.datavalue.value
lat = round(value.latitude, 6)
long = round(value.longitude, 6)
Riga 343 ⟶ 340:
(args["name"] and ("&title=" .. mw.uri.encode(args["name"])) or "")
 
root = htmlBuildermw.html.create("")
root
.:tag("span")
.:addClass("plainlinks nourlexpansion")
.:wikitext("[" .. url)
.:tag("span")
.:addClass(defaultFormat == "dec" and "geo-nondefault" or "geo-default")
.:tag("span")
.:addClass("geo-dms")
.:attr("title", "Mappe, foto aeree e altri dati per questa posizione")
.:tag("span")
.:addClass("latitude")
.:wikitext(tostring(dmsLat))
.:done()
.:wikitext(" ")
.:tag("span")
.:addClass("longitude")
.:wikitext(tostring(dmsLong))
.:done()
.:done()
.:done()
.:tag("span")
.:addClass("geo-multi-punct")
.:wikitext(" / ")
.:done()
.:tag("span")
.:addClass(defaultFormat == "dec" and "geo-default" or "geo-nondefault")
.:wikitext(args["name"] and "<span class=\"vcard\">" or "")
.:tag("span")
.:addClass("geo-dec")
.:attr("title", "Mappe, foto aeree e altri dati per questa posizione")
.:wikitext(decLat .. " " .. decLong)
.:done()
.:tag("span")
.:attr("style", "display:none")
.:tag("span")
.:addClass("geo")
.:wikitext(decLat:getDeg() .. "; " .. decLong:getDeg())
.:done()
.:done()
.:wikitext(args["name"] and ("<span style=\"display:none\"> (<span class=\"fn org\">" ..
args["name"] .. "</span>)</span></span>") or "")
.:done()
.:wikitext("]")
.:done()
 
-- formatta il risultato a seconda di args["display"] (nil, "inline", "title", "inline,title")