Documentation for Module:Symbol Jump to code ↴ [ edit | purge ]

▶️ Planeshift.
The documentation for this module can be found at Template:Symbol.
You may be forwarded to another wiki language, in case a translation is not available.


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 = {
  return p._main(args)

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()]

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

  return mFileLink(symbol)

return p