Přeskočit na obsah

Modul:Wikidata/Formatters/globecoordinate

Tato stránka je zamčena
Z Wikipedie, otevřené encyklopedie

require 'Modul:No globals'

local p = {}

function p.getRawValue(value, options)
	local lib = require 'Modul:Wikidata/lib'
	if not options.field then
		return error(lib.formatError('param-not-provided', 'field'))
	elseif options.field == 'latitude' or options.field == 'longitude' or options.field == 'precision' or options.field == 'globe' then
		return value[options.field]
	else
		return error(lib.formatError('invalid-field', options.field))
	end
end

function p.formatValue(value, options)
	local GlobeCoordinate = require 'Modul:GlobeCoordinate'
	local _value = GlobeCoordinate.newFromWikidataValue(value)
	local Coord = require 'Modul:Souřadnice'
	return Coord._renderCoordinates({
		_value.latitude,
		_value.longitude,
	}, mw.getCurrentFrame())
end

return p