Module:File link

From Illogicopedia
Jump to navigation Jump to search

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

local p = {}
local format = mw.ustring.format
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
args = getArgs(frame)
return p._main(args)
end
function p._main(args)
if args.thumb then
thumb = '|thumb|' .. args.thumb .. ''
else
thumb = ''
end
name = args[1] or args.filelink
if args.alt then
alt = '|alt=' .. args.alt .. ''
else
alt = ''
end
if args.link then
link = '|link=' .. args.link .. ''
else
link = '' 
end
if args.size then
size = '|' .. args.size .. 'px'
else
size = ''
end
return '[[File:' .. name .. '' .. size .. '' .. thumb .. '' .. alt .. '' .. link .. ']]'
end
return p