Module:Sandbox
Documentation for this module may be created at Module:Sandbox/doc
local p = {} -- p stands for package
function p.get_appeal( frame )
local appeal_name = string.gsub( frame.args.appeal , 'Appeal%-', '' )
local language = frame.args.language
local country = frame.args.country
local p1 = mw.title.new( 'Template:Appeal/' .. appeal_name .. '/' .. language .. '/' .. country )
local p2 = mw.title.new( 'Template:Appeal/' .. appeal_name .. '/' .. language )
local p3 = mw.title.new( 'Template:Appeal/' .. appeal_name .. '/en' )
local p4 = mw.title.new( 'Template:Appeal/default/' .. language )
if p1.exists then
page = p1
elseif p2.exists then
page = p2
elseif p3.exists then
page = p3
else
page = p4
end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
return expanded
end
return p