Module:Main: Difference between revisions
Content deleted Content added
moved to Template:Tax |
refactor to use a shared fallback_pages function |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2:
local p = {} -- p stands for package
-- Given an array of titles as strings, check them in order and return the first page which exists
function p.fallback_pages( list )
for key, value in ipairs( list ) do
return p
function p.get_appeal( frame )
Line 8 ⟶ 18:
local language = frame.args.language
local country = frame.args.country
local
'Template:Appeal/' .. appeal_name .. '/' .. language .. '/' .. country ▲ if p1.exists then
page = p1▼
▲ end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
Line 37:
local language = frame.args.language
local country = frame.args.country
local
'Template:Infobox/' .. infobox_name .. '/' .. language .. '/' .. country ▲ else
▲ end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
Line 66 ⟶ 56:
local language = frame.args.language
local country = frame.args.country
if (
▲ end
▲ end
local p1 = mw.title.new( 'Template:Tax/' .. tax_message .. '/' .. language )▼
▲ local p2 = mw.title.new( 'Template:Tax/LinkOnly' )
else
'Template:Tax/' .. country .. '/' .. language, -- special countries e.g. FR/NL
'Template:Tax/Default/' .. language,
'Template:Tax/LinkOnly'
})
end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
return expanded
end
|