Voir: modèle:Couches.


local p = {}
local getArgs = require('Module:Arguments').getArgs

function p.Filter(frame)
	local args = getArgs(frame)
	local layers = args[1] or ''
	local filteredLayers = extract(layers,'W')
	if filteredLayers == '' then
		filteredLayers = 'M' -- currently there are only two acceptable base layer. 'M' will be set if 'W' is not specified
	end
	-- filteredLayers = 'O' -- once server functionality will be restored this line must be deleted
	-- Add additional & acceptable layer parameters
	filteredLayers = filteredLayers
		.. extract(layers,'S') -- hill shading from WM server
		.. extract(layers,'D') -- destination from Wikivoyage
		.. extract(layers,'G') -- GPX file from Wikivoyage
		.. extract(layers,'P') -- POI from Wikivoyage
		.. extract(layers,'E') -- add search box inside the map
	return filteredLayers
end

function extract(layers, layer)
	if string.match(layers, layer) ~= nil then
		return string.match(layers, layer)
	else
		return ''
	end
end

return p