Module:Main: Difference between revisions
Content deleted Content added
new tax message function |
refactor to use a shared fallback_pages function |
||
(One intermediate revision 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
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▼
▲ 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 ▲ end
local expanded = frame:expandTemplate{ title = page, args = frame.args }
Line 61 ⟶ 51:
end
▲function p.get_tax_message_new( frame )
local tax_message = frame.args.tax_message
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
▲
end
Line 89 ⟶ 72:
return expanded
▲end
▲function p.get_tax_message( frame )
▲ end
▲ end
▲ local p2 = mw.title.new( 'Template:Tax/LinkOnly' )
▲ end
end
|