Module:ResourceMap

local p = {}

local UnrecognizedTypeLabel = 'not or wrongly specified'

local function getNodeTooltip( class ) local labels = mw.loadData('Module:ResourceMap/labels') -- try a cheaper lookup by full name local fullLookup = labels[class] if fullLookup ~= nil then return fullLookup end -- resort to a lookup by first word return labels[mw.text.split(class, ' ', true)[1]] or UnrecognizedTypeLabel end

function p.nodes( f ) local args = f:getParent.args local borderCoordTop = args.borderCoordTop local borderCoordBottom = args.borderCoordBottom local borderCoordLeft = args.borderCoordLeft local borderCoordRight = args.borderCoordRight local allNodes = {} for _, v in ipairs(args) do        if #v > 0 then local info = mw.text.split(v, ',', true) if #info >= 3 then local resourceType = mw.text.trim(info[3]) local lat = tonumber(info[1]) local long = tonumber(info[2]) local customTitle = info[4] and mw.text.trim(info[4]) or '' if resourceType ~= nil and lat ~= nil and long ~= nil then local title = getNodeTooltip(resourceType) .. '&#10;lat ' .. lat .. ', lon ' .. long if customTitle ~= nil then title = title .. '&#10;' .. customTitle end local markerSize = args['marker ' .. resourceType] or 7 local top = 100 * ((lat - borderCoordTop) / (borderCoordBottom - borderCoordTop) - markerSize/(2*args.mapsize)) local left = 100 * ((long - borderCoordLeft) / (borderCoordRight - borderCoordLeft) - markerSize/(2*args.mapsize)) local html = ' ' if allNodes[resourceType] == nil then allNodes[resourceType] = { html } else table.insert(allNodes[resourceType], html) end end end end end

local html = '' for resourceType, nodes in pairs(allNodes) do html = html .. ' '   	html = html .. table.concat(nodes, '\n') html = html .. ' '	end return html end

return p