Module:FreeBSD: Difference between revisions

From Nasqueron Agora
m (Dereckson moved page Module:PrintsFreeBSDPort to Module:FreeBSD without leaving a redirect: A module is more generic than one function.)
No edit summary
Line 3: Line 3:
-- Gets a formatted FreeBSD port link
-- Gets a formatted FreeBSD port link
function p.GetsPortLink(frame)
function p.GetsPortLink(frame)
     if frame.args[2] == nil then
     if frame.args.url == nil then
         link = "http://www.freshports.org/" .. frame.args[1]
         link = "http://www.freshports.org/" .. frame.args.port
     else
     else
         link = frame.args[2]
         link = frame.args.url
     end
     end
      
      
     return '[' .. link .. ' ' .. frame.args[1] .. ']'
     return '[' .. link .. ' ' .. frame.args.port .. ']'
end
end


return p
return p

Revision as of 22:49, 21 January 2013

Documentation for this module may be created at Module:FreeBSD/doc

local p = {}

-- Gets a formatted FreeBSD port link
function p.GetsPortLink(frame)
    if frame.args.url == nil then
        link = "http://www.freshports.org/" .. frame.args.port
    else
        link = frame.args.url
    end
    
    return '[' .. link .. ' ' .. frame.args.port .. ']'
end

return p