Ir al contenido

Módulo:GeoData/Params

De Wikiviajes, la guía libre de viajes

La documentación para este módulo puede ser creada en Módulo:GeoData/Params/doc

-- import of dewikivoyage
-- Parameters definition tor coord and geoData templates

local errorMsgs = {
	unknownParam  = ' Parámetro desconocidor: ',
	unknownParams = ' Parametros desconocidos: ',
	maintenance   = '[[Categoría:GeoData: Parámetros desconocidos]]'
}

return {
	-- module administration
	moduleInterface  = {
		suite  = 'GeoData',
		sub    = 'Params',
		serial = '2021-11-23',
		item   = 123456789
	},

	coord = {
		[ 1 ]     = '',
		[ 2 ]     = '',
		lat       = '',
		long      = '',
		name      = '',
		format    = '',
		wikidata  = '',
--		globe     = '',
		precision = '',
		region    = '',
		scale     = '',
		zoom      = '',
		type      = ''
	},

	geo = {
		[ 1 ]     = '',
		[ 2 ]     = '',
		lat       = '',
		long      = '',
		name      = '',
		wikidata  = '',
--		globe     = '',
		radius    = '',
		zoom      = '',
	},

	checkParams = function( args, a )
		local i = 0
		local s = ''
		for k, _ in pairs( args ) do
			if not a[ k ] then
				s = s .. ( s ~= '' and ', ' or '' ) .. "''" .. k .. "''"
				i = i + 1
			end
		end

		if i == 1 then
			s = errorMsgs.unknownParam .. s
		elseif i > 1 then
			s = errorMsgs.unknownParams .. s
		end
		if s ~= '' then
			s = '<span class="error">' .. s .. '</span>' .. errorMsgs.maintenance
		end

		return s
	end
}