Module:Slippymap

தமிழர்விக்கியிலிருந்து
Sukanthi (பேச்சு | பங்களிப்புகள்) பயனரால் செய்யப்பட்ட 08:51, 22 ஆகத்து 2025 அன்றிருந்தவாரான திருத்தம் ("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 = t..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது)
(வேறுபாடு) ← பழைய திருத்தம் | ஆக அண்மைய திருத்தம் (வேறுபாடு) | புதிய திருத்தம் → (வேறுபாடு)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Slippymap/doc

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
"https://tamilar.wiki/w/index.php?title=Module:Slippymap&oldid=292207" இலிருந்து மீள்விக்கப்பட்டது