"ഘടകം:Slippymap/sandbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
ദൃശ്യരൂപം
'local p = {} -- Cleans input of excessive whitespace typically added by linebreaks and spaces local 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 -- Set map options with default values local options = {} options.latitude = tonumber(clean(args.lat)) or 51.3432699 options.longitude = tonumber(clean(a...' താൾ സൃഷ്ടിച്ചിരിക്കുന്നു |
No edit summary |
||
| വരി 39: | വരി 39: | ||
}, | }, | ||
properties = { | properties = { | ||
title = options.text or "Marker", | title = options.text or "Marker", -- Title for the popup | ||
["marker-symbol"] = "marker", -- Default marker symbol | |||
["marker-size"] = "medium", -- Marker size (small, medium, or large) | |||
["marker-color"] = "#FF0000", -- Marker color (hex format) | |||
}, | }, | ||
}, | }, | ||
17:40, 6 ജനുവരി 2025-നു നിലവിലുണ്ടായിരുന്ന രൂപം
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/sandbox/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {}
-- Cleans input of excessive whitespace typically added by linebreaks and spaces
local 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
-- Set map options with default values
local options = {}
options.latitude = tonumber(clean(args.lat)) or 51.3432699
options.longitude = tonumber(clean(args.lon)) or 0.52700328
options.height = tonumber(clean(args.height)) or 400
options.zoom = tonumber(clean(args.zoom)) or 12
options.align = clean(args.alignment) or "center"
options.text = clean(args.text)
if clean(args.width) == "full" then
options.width = "full"
elseif args.width then
options.width = tonumber(clean(args.width)) or 400
else
options.width = 400
end
-- Handle marker display
local content = nil
if clean(args.marker) ~= "no" then
content = mw.text.jsonEncode({
type = "FeatureCollection",
features = {
{
type = "Feature",
geometry = {
type = "Point",
coordinates = { options.longitude, options.latitude },
},
properties = {
title = options.text or "Marker", -- Title for the popup
["marker-symbol"] = "marker", -- Default marker symbol
["marker-size"] = "medium", -- Marker size (small, medium, or large)
["marker-color"] = "#FF0000", -- Marker color (hex format)
},
},
},
})
end
-- Return the mapframe tag
return frame:extensionTag {
name = "mapframe",
content = content,
args = {
latitude = options.latitude,
longitude = options.longitude,
height = options.height,
width = options.width,
zoom = options.zoom,
align = options.align,
},
}
end
return p