Module:Symbol

local p = {} local data = mw.loadData('Module:Symbol/data') local getArgs = require('Module:Arguments').getArgs local mFileLink = require('Module:File link')._main

local i18n = { error = { no_data = 'Found no data', no_input = 'No input given' } }

function p.main(frame) local args = getArgs(frame, {   wrappers = {      'Template:Symbol'    }  }) return p._main(args) end

function p._main(args) assert(args[1], i18n.error.no_input) local symbol_data = data[args[1]:lower] assert(symbol_data, i18n.error.no_data)

-- If there is not file key, that means that there are different states -- for this symbol. if not symbol_data.file then symbol_data = symbol_data[(args[2] or 'yes'):lower] end

-- Create a copy of the symbol table to make it editable. local symbol = {} for k,v in pairs(symbol_data) do   symbol[k] = v  end symbol.size = (args.size or symbol.size or '16px') symbol.alt = args.alt

return mFileLink(symbol) end

return p