Module:OOOVehicleInfoBox
Appearance
Documentation for this module may be created at Module:OOOVehicleInfoBox/doc
local p = {}
local function row(label, value)
if not value or value == "" then
return ""
end
return '<div class="ooo-vehicle-row"><span>' .. label .. '</span><span>' .. value .. '</span></div>'
end
function p.render(frame)
local args = frame.args
local name = args.name or ""
local image = args.image or ""
local type = args.type or ""
local level = args.level or ""
local price = args.price or ""
local capacity = args.capacity or ""
local fueluse = args.fueluse or ""
local fueltank = args.fueltank or ""
local power = args.power or ""
local condition = args.condition or ""
local coupler = args.coupler or ""
local html = {}
table.insert(html,'<div class="ooo-vehicle-infobox">')
table.insert(html,'<div class="ooo-vehicle-title">' .. name .. '</div>')
if image ~= "" then
table.insert(html,'<div class="ooo-vehicle-image">[[File:' .. image .. '|250px]]</div>')
end
table.insert(html,'<div class="ooo-vehicle-section">')
table.insert(html,row("Type",type))
table.insert(html,row("Unlock level",level))
table.insert(html,row("Price",price))
table.insert(html,'</div>')
table.insert(html,'<div class="ooo-vehicle-section">')
if capacity ~= "" then
capacity = capacity .. " m³"
end
if fueluse ~= "" then
fueluse = fueluse .. " L/h"
end
if fueltank ~= "" then
fueltank = fueltank .. " L"
end
if condition ~= "" then
condition = condition .. "%"
end
table.insert(html,row("Bucket capacity",capacity))
table.insert(html,row("Fuel use",fueluse))
table.insert(html,row("Fuel tank",fueltank))
table.insert(html,row("Power",power))
table.insert(html,row("Condition",condition))
table.insert(html,'</div>')
if coupler ~= "" then
table.insert(html,'<div class="ooo-vehicle-section">')
table.insert(html,row("Coupler",coupler))
table.insert(html,'</div>')
end
table.insert(html,'</div>')
return table.concat(html)
end
return p