Module:Country

local util_args = require('Module:ArgsUtil') local LOOKUP = mw.loadData('Module:Countrynames')

local p = {}

function p.main(frame) -- this should only be invoked, never called directly from another module local args = frame if frame == mw.getCurrentFrame then args = require('Module:ProcessArgs').merge(true) else frame = mw.getCurrentFrame end if not args[1] or args[1] == '' then return '' end local style = args[2] or 'name' return p[style](args[1]) end

function p.default(str) -- deprecated but leaving here for compatibility local vars = util_args.lookupVars(str, LOOKUP) return vars.name end

function p.name(str) local vars = util_args.lookupVars(str, LOOKUP) return vars.name end

function p.rightlong(str) -- text to the right of the image local vars = util_args.lookupVars(str, LOOKUP) if vars.flag then return (' %s'):format(			vars.flag,			vars.name,			vars.name		) end return vars.name end

function p.localization(str) local vars = util_args.lookupVars(str, LOOKUP) return vars.adjective end

function p.onlyimage(str) local vars = util_args.lookupVars(str, LOOKUP) return vars.flag and string.format(		,		vars.flag,		vars.name	) or  end

function p.namethe(str) local vars = util_args.lookupVars(str, LOOKUP, DEFAULT) return (vars.the and 'the ' or '') .. (vars.name or '') end

return p