Module:ResourceLink

--- -- Renders the template -- -- Takes an argument, the name of the resource. Optionally, accepts a second -- argument, "med" or "large" to render the icon as larger than the standard -- size of text, ---

local ResourceLink = {}

local IconFilenames = require("Module:IconFilenames") -- lookup table for image filenames

function ResourceLink.renderLink(frame) local strImageName = frame.args.image local strImageSize = frame.args.size local strFilename = IconFilenames.getIconFilename(strImageName) -- if looking up the provided image name returned nil, then render an error if not strFilename then return "renderIcon Error: file " .. strImageName .." not found" end

-- render the string to return, starting with the file tag, then the link tag -- use the established templates for image sizes, with the default being -- small, or in-line size. local strFileSize = "" if "med" == strImageSize then strFileSize = "" elseif "large" == strImageSize then strFileSize = "" elseif "huge" == strImageSize then strFileSize = "" end local strFilePart = string.format("", strFilename, strImageSize) -- build the link based on the name of the resource passed in local strLinkPart = "" .. strImageName .. "" return strFilePart .. " " .. strLinkPart end

return ResourceLink