Module:NASA photo

require "string"

local p = {}

local protocol = "https" local domain = "eol.jsc.nasa.gov" local script = "SearchPhotos/photo.pl" local params = "mission=%s&roll=%s&frame=%s"

local url = string.format(	"%s://%s/%s?%s", protocol, domain, script, params )

function p.main(frame) local args -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. if frame == mw.getCurrentFrame then args = frame:getParent.args else args = frame end local mission, roll, frame mission, roll, frame = string.match(args[1], "(%S+)-(%d+)-(%d+)") return '[' .. string.format(url, mission, roll, frame) .. ' ' .. args[1] .. ']' end

return p