Module:OOOInfoBox: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 213: | Line 213: | ||
if caption and caption ~= '' then | if caption and caption ~= '' then | ||
-- Section title | |||
add_group_header(box, 'Description') | |||
-- Section content | |||
local tr = box:tag('tr') | |||
tr:tag('td') | |||
:attr('colspan','2') | |||
:css('text-align','left') | |||
:css('padding','4px 4px') | |||
:wikitext(caption) | |||
end | |||
-- ------------------------------------------------------------------------- | -- ------------------------------------------------------------------------- | ||
| Line 224: | Line 231: | ||
-- ------------------------------------------------------------------------- | -- ------------------------------------------------------------------------- | ||
add_group(box,'General',{ | add_group(box,'General Information',{ | ||
{'Art Number', art}, | {'Art Number', art}, | ||
{'Category', pick(args,data,'category')}, | {'Category', pick(args,data,'category')}, | ||
{'Subcategory',pick(args,data,'subcategory')}, | {'Subcategory',pick(args,data,'subcategory')}, | ||
{'Price', pick(args,data,'price')}, | {'Price', format_price(pick(args,data,'price'))}, | ||
}) | }) | ||
-- ------------------------------------------------------------------------- | |||
-- Vehicle | |||
-- ------------------------------------------------------------------------- | |||
local function format_capacity(v) | |||
local n = tonumber(v) | |||
if not n then return v end | |||
return string.format("%.1f%s", n/1000, U.m3) | |||
end | |||
local function format_fuel_use(v) | |||
local n = tonumber(v) | |||
if not n or n < 0 then return nil end | |||
return tostring(n) .. " L/h" | |||
end | |||
local function format_fuel_capacity(v) | |||
local n = tonumber(v) | |||
if not n then return nil end | |||
return tostring(n) .. " L" | |||
end | |||
local function format_weight(v) | |||
local n = tonumber(v) | |||
if not n then return v end | |||
local s = tostring(math.floor(n)) | |||
s = s:reverse():gsub("(%d%d%d)", "%1 "):reverse():gsub("^ ", "") | |||
return s .. " kg" | |||
end | |||
add_group(box,'Vehicle Details',{ | |||
{'Unlock Level', pick(args,data,'level')}, | |||
{'Weight', format_weight(pick(args,data,'weight'))}, | |||
{'Capacity', format_capacity(pick(args,data,'capacity'))}, | |||
{'Fuel Tank', format_fuel_capacity(pick(args,data,'fuelCapacity'))}, | |||
{'Fuel Usage', format_fuel_use(pick(args,data,'fuelBaseUse'))}, | |||
}) | |||
-- ------------------------------------------------------------------------- | -- ------------------------------------------------------------------------- | ||
| Line 243: | Line 288: | ||
-- ------------------------------------------------------------------------- | -- ------------------------------------------------------------------------- | ||
if domain ~= 'Vehicles' then | |||
add_group(box,'Performance',{ | add_group(box,'Performance',{ | ||
{'Throughput (m³/h)', pick(args,data,'throughput_m3h')}, | {'Throughput (m³/h)', pick(args,data,'throughput_m3h')}, | ||
{'Capacity', pick(args,data,'capacity')}, | {'Capacity', pick(args,data,'capacity')}, | ||
}) | }) | ||
end | |||
-- ------------------------------------------------------------------------- | -- ------------------------------------------------------------------------- | ||
| Line 275: | Line 322: | ||
add_group(box,'Dimensions',{ | add_group(box,'Dimensions',{ | ||
{'Overall', join_dims(size_w,size_l,size_h,U.m), 'Width × Length | {'Overall (W × H × L)', join_dims(size_w,size_l,size_h,U.m), 'Width × Height × Length'}, | ||
{'Note', size_note}, | {'Note', size_note}, | ||
}) | }) | ||