置顶公告:【置顶】关于临时开启评论区所有功能的公告(2022.10.22) | 【置顶】关于本站Widget恢复使用的公告
  • 你好~!欢迎来到萌娘百科镜像站!如需查看或编辑,请联系本站管理员注册账号。
  • 本镜像站和其他萌娘百科的镜像站无关,请注意分别。

Module:FileInfo

猛汉♂百科,万男皆可猛的百科全书!转载请标注来源页面的网页链接,并声明引自猛汉百科。内容不可商用。
跳到导航 跳到搜索
Template-info.svg 模块文档  [创建] [刷新]
  1. local module = {}
  2. module.main = function(frame)
  3. local fileName = frame.args[1]
  4. local name = frame.args[2]
  5. local attrNames = { 'width', 'height', 'size', 'mimeType' }
  6. local title = mw.title.new('File:'..fileName)
  7. if title ~= nil then
  8. for i, v in ipairs(attrNames) do
  9. if v == name then
  10. return title.file[name]
  11. end
  12. end
  13. if (frame.args['w'] or '') ~= 'false' then
  14. error('没有这个文件属性,可用的文件属性包含:width、height、size、mimeType')
  15. end
  16. else
  17. if (frame.args['w'] or '') ~= 'false' then
  18. error('没有这个文件,请检查文件名是否正确!')
  19. end
  20. end
  21. end
  22. return module