Module:File

-- -- Written by User:KockaAdmiralac local p = {}

local data = mw.loadData('Module:File/Data')

local title = mw.title.getCurrentTitle

local function makeRow(html, title, content) html:tag('tr') :tag('th') :wikitext(title) :done :tag('td') :wikitext(content) :done end

local function category(name) if title.namespace == 6 then return '' else return '' end end

function p.main(frame) local args = frame:getParent.args local html = mw.html.create('table'):attr('class', 'wikitable') if args.description then makeRow(html, 'Description', args.description) end if args.notes then makeRow(html, 'Notes', args.notes) end if args.type then local res = '' for key, value in ipairs(mw.text.split(args.type, ',')) do           value = mw.text.trim(value) local filetype = data.types[value] local cat = data.categories[value] if filetype and category then res = '* ' .. res .. filetype .. category(cat) end if value == 'important' then res = '[[Media:' .. title.text .. '| ]]' .. res end end makeRow(html, 'Type', res) end local source = args.source or '\'\'Unknown\'\'' makeRow(html, 'Source', source) if args.author then makeRow(html, 'Author', args.author) end makeRow(html, 'Licensing', 'This file ' .. (data.license[args.license or 'default'] or data.license.default) .. '.') return tostring(html) end

return p