Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Operators: Difference between revisions

From Aeronautica Official Wiki
Mapper (talk | contribs)
No edit summary
Mapper (talk | contribs)
Undo revision 359 by Mapper (talk)
Tag: Undo
Line 1: Line 1:
-- Module:Operators
local p = {}
local p = {}


Line 5: Line 6:
   local rows = {}
   local rows = {}


  -- table start + headers
  rows[#rows+1] = '{| class="article-table" style="font-size:75%;text-align:center"'
  rows[#rows+1] = '! colspan="11" style="text-align:center; background-color:#879fcb; color:black; font-size:130%; padding:1.3em"|Current Lore Operators'
  rows[#rows+1] = '|-'
  rows[#rows+1] = '! style="background:#1b1b1b" | Airline'
  rows[#rows+1] = '! style="background:#1b1b1b" | Image'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 0px 30px"" |Livery'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 0px 30px"" |Price'
  rows[#rows+1] = '!style = "background-color: #1b1b1b;" |Logo'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 10px 50px;" |Description'
  rows[#rows+1] = '!style = "background-color: #1b1b1b;" |Special Livery'
  rows[#rows+1] = '!colspan="3" style = "background-color: #1b1b1b;padding: 0px 30px" |Years of Service'
  -- loop through 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
     -- prepare the image cell, force 200px
     local raw = args['Image'..i] or ''
     local raw = args['Image' .. i] or ''
     local noSize = raw:gsub('|%d+px', '')
     local imgCell
    local imgCell = noSize:gsub(
    if raw:match('%[%[File:') then
      '%[%[File:(.-)%]%]',
      -- strip out any existing "|###px" then re-insert "|200px"
       '[[File:%1|200px]]'
      local noSize = raw:gsub('|%d+px', '')
     )
      imgCell = noSize:gsub('%[%[File:(.-)%]%]', '[[File:%1|200px]]')
    else
       -- assume they just passed a filename like "MyPic.png"
      imgCell = '[[File:' .. raw .. '|200px]]'
     end


     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")
     rows[#rows+1] = ("| colspan=\"3\" | %s"):format(args['YearsofService' .. i] or '')
      :format(args['YearsofService'..i] or '')
   end
   end


  rows[#rows+1] = '|}'
   return table.concat(rows, '\n')
   return table.concat(rows, '\n')
end
end


return p
return p

Revision as of 12:18, 27 April 2025

Documentation for this module may be created at Module:Operators/doc

-- Module:Operators
local p = {}

function p.render(frame)
  local args = frame:getParent().args
  local rows = {}

  -- table start + headers
  rows[#rows+1] = '{| class="article-table" style="font-size:75%;text-align:center"'
  rows[#rows+1] = '! colspan="11" style="text-align:center; background-color:#879fcb; color:black; font-size:130%; padding:1.3em"|Current Lore Operators'
  rows[#rows+1] = '|-'
  rows[#rows+1] = '! style="background:#1b1b1b" | Airline'
  rows[#rows+1] = '! style="background:#1b1b1b" | Image'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 0px 30px"" |Livery'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 0px 30px"" |Price'
  rows[#rows+1] = '!style = "background-color: #1b1b1b;" |Logo'
  rows[#rows+1] = '!style = "background-color: #1b1b1b; padding: 10px 50px;" |Description'
  rows[#rows+1] = '!style = "background-color: #1b1b1b;" |Special Livery'
  rows[#rows+1] = '!colspan="3" style = "background-color: #1b1b1b;padding: 0px 30px" |Years of Service'

  -- loop through rows
  for i = 1, 50 do
    local name = args['AirlineName' .. i]
    if not (name and name:match('%S')) then break end

    -- prepare the image cell, force 200px
    local raw = args['Image' .. i] or ''
    local imgCell
    if raw:match('%[%[File:') then
      -- strip out any existing "|###px" then re-insert "|200px"
      local noSize = raw:gsub('|%d+px', '')
      imgCell = noSize:gsub('%[%[File:(.-)%]%]', '[[File:%1|200px]]')
    else
      -- assume they just passed a filename like "MyPic.png"
      imgCell = '[[File:' .. raw .. '|200px]]'
    end

    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

  rows[#rows+1] = '|}'
  return table.concat(rows, '\n')
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.