(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
local module = {}
module.main = function(frame)
local fileName = frame.args[1]
local name = frame.args[2]
local attrNames = { 'width', 'height', 'size', 'mimeType' }
local title = mw.title.new('File:'..fileName)
if title ~= nil then
for i, v in ipairs(attrNames) do
if v == name then
return title.file[name]
end
end
if (frame.args['w'] or '') ~= 'false' then
error('Without this file attribute, the available file attributes include: width, height, size, and mimeType')
end
else
if (frame.args['w'] or '') ~= 'false' then
error('Do not have this file, please check the file name is correct!')
end
end
end
return module