Module:Flag

From Dota 2 Wiki
Jump to: navigation, search

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

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


Dependencies

local p = {}
local data = mw.loadData('Module:Flag/data')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')


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

function p._main(args)
  if args[1] then
    local country = data[string.lower(args[1])] or args[1] or 'World'
    local size = args[2] or '25px'
  
    if yesno(args.name) then
      return string.format('[[File:Flag %s.png|%s|%s]] %s', country, size, country, country)
    else
      return string.format('[[File:Flag %s.png|%s|%s]]', country, size, country)
    end
  else
    return '[[File:Flag World.png|25px|World]]'
  end
end


return p