"ഘടകം:Slippymap" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
en>Minh Nguyen (Added missing fallback for when width is only nominally specified) |
(ചെ.) (ഒരു പതിപ്പ് ഇറക്കുമതി ചെയ്തു) |
(വ്യത്യാസം ഇല്ല)
| |
17:45, 27 ജൂൺ 2024-നു നിലവിലുള്ള രൂപം
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {}
-- cleans input of excessive whitespace typically added by linebreaks and spaces
function clean(input)
return input and #input > 0 and mw.text.trim(input) or nil
end
function p.slippymap(frame)
local args = (frame:getParent() or frame).args
local options = {}
options.latitude = tonumber(clean(args.lat), 10) or 51.3432699
options.longitude = tonumber(clean(args.lon), 10) or 0.52700328
options.height = tonumber(clean(args.height), 10) or 400
if clean(args.width) == "full" then
options.width = "full"
elseif args.width then
options.width = tonumber(clean(args.width), 10) or 400
else
options.width = 400
end
options.zoom = tonumber(clean(args.zoom), 10) or 12
options.align = clean(args.alignment) or "center"
options.text = clean(args.text)
local content = nil
if clean(args.marker) ~= "no" then
content = mw.text.jsonEncode {
type = "Feature",
geometry = {
type = "Point",
coordinates = {
[0] = options.longitude,
[1] = options.latitude,
},
},
}
end
return frame:extensionTag {
name = "mapframe",
content = content,
args = options,
}
end
return p