Module:Main: Difference between revisions
Content deleted Content added
replace old tax function |
refactor to use a shared fallback_pages function |
||
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
end
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▼
▲ else
▲ 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 61 ⟶ 51:
end
function p.get_tax_message( frame )
Line 68 ⟶ 56:
local language = frame.args.language
local country = frame.args.country
local p1 = mw.title.new( 'Template:Tax/' .. tax_message .. '/' .. language ) -- custom message▼
local p2 = mw.title.new( 'Template:Tax/' .. country .. '/' .. language ) -- special countries e.g. FR/NL▼
local p3 = mw.title.new( 'Template:Tax/Default/' .. language )▼
▲ local p4 = mw.title.new( 'Template:Tax/LinkOnly' )
if ( country == 'US' ) then
page =
else
▲
'Template:Tax/LinkOnly'
})
end
|