Module:Operators: Difference between revisions
From Aeronautica Official Wiki
More actions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
Line 6: | Line 5: | ||
local rows = {} | local rows = {} | ||
for i = 1, 50 do | for i = 1, 50 do | ||
local name = args['AirlineName' .. i] | local name = args['AirlineName'..i] | ||
if not (name and name:match('%S')) then break end | if not (name and name:match('%S')) then break end | ||
-- | -- build the forced-200px image cell | ||
local raw = args['Image' .. i] or '' | local raw = args['Image'..i] or '' | ||
local noSize = raw:gsub('|%d+px', '') | |||
local imgCell = noSize:gsub( | |||
'%[%[File:(.-)%]%]', | |||
'[[File:%1|200px]]' | |||
) | |||
rows[#rows+1] = '|-' | rows[#rows+1] = '|-' | ||
rows[#rows+1] = ("| '''%s'''"):format(name) | rows[#rows+1] = ("| '''%s'''"):format(name) | ||
rows[#rows+1] = ("| %s"):format(imgCell) | rows[#rows+1] = ("| %s"):format(imgCell) | ||
rows[#rows+1] = ("| %s"):format(args['Type' .. i] or '') | rows[#rows+1] = ("| %s"):format(args['Type'..i] or '') | ||
rows[#rows+1] = ("| %s"):format(args['Price' .. i] or '') | rows[#rows+1] = ("| %s"):format(args['Price'..i] or '') | ||
rows[#rows+1] = ("| %s"):format(args['Logo' .. i] or '') | rows[#rows+1] = ("| %s"):format(args['Logo'..i] or '') | ||
rows[#rows+1] = ("| %s"):format(args['Description' .. i] or '') | rows[#rows+1] = ("| %s"):format(args['Description'..i] or '') | ||
rows[#rows+1] = ("| %s"):format(args['SpecialLivery' .. i] or '') | rows[#rows+1] = ("| %s"):format(args['SpecialLivery'..i] or '') | ||
rows[#rows+1] = ("| colspan=\"3\" | %s"):format(args['YearsofService' .. i] or '') | rows[#rows+1] = ("| colspan=\"3\" | %s") | ||
:format(args['YearsofService'..i] or '') | |||
end | end | ||
return table.concat(rows, '\n') | return table.concat(rows, '\n') | ||
end | end | ||
return p | return p |
Revision as of 12:17, 27 April 2025
Documentation for this module may be created at Module:Operators/doc
local p = {}
function p.render(frame)
local args = frame:getParent().args
local rows = {}
for i = 1, 50 do
local name = args['AirlineName'..i]
if not (name and name:match('%S')) then break end
-- build the forced-200px image cell
local raw = args['Image'..i] or ''
local noSize = raw:gsub('|%d+px', '')
local imgCell = noSize:gsub(
'%[%[File:(.-)%]%]',
'[[File:%1|200px]]'
)
rows[#rows+1] = '|-'
rows[#rows+1] = ("| '''%s'''"):format(name)
rows[#rows+1] = ("| %s"):format(imgCell)
rows[#rows+1] = ("| %s"):format(args['Type'..i] or '')
rows[#rows+1] = ("| %s"):format(args['Price'..i] or '')
rows[#rows+1] = ("| %s"):format(args['Logo'..i] or '')
rows[#rows+1] = ("| %s"):format(args['Description'..i] or '')
rows[#rows+1] = ("| %s"):format(args['SpecialLivery'..i] or '')
rows[#rows+1] = ("| colspan=\"3\" | %s")
:format(args['YearsofService'..i] or '')
end
return table.concat(rows, '\n')
end
return p