Module:AVDevice: Difference between revisions
Add audio properties to input query for displaying audio information in infobox (via update-page on MediaWiki MCP Server) |
Add MSRP field to infobox, displayed in Overview section after Years (via update-page on MediaWiki MCP Server) |
||
| Line 79: | Line 79: | ||
return tostring(ul) | return tostring(ul) | ||
end | end | ||
end | |||
-- Helper to format MSRP with dollar sign and commas | |||
local function formatMSRP(value) | |||
if not value then return nil end | |||
local num = tonumber(value) | |||
if not num then return '$' .. value end | |||
-- Format with commas | |||
local formatted = string.format("%.2f", num) | |||
local intPart, decPart = formatted:match("^(%d+)%.(%d+)$") | |||
if intPart then | |||
local reversed = intPart:reverse() | |||
local withCommas = reversed:gsub("(%d%d%d)", "%1,"):reverse():gsub("^,", "") | |||
return '$' .. withCommas .. '.' .. decPart | |||
end | |||
return '$' .. formatted | |||
end | end | ||
| Line 161: | Line 177: | ||
local year_released = trim(args.year_released) | local year_released = trim(args.year_released) | ||
local year_discontinued = trim(args.year_discontinued) | local year_discontinued = trim(args.year_discontinued) | ||
local msrp = trim(args.msrp) | |||
local av_system = trim(args.av_system) | local av_system = trim(args.av_system) | ||
local tuner_system = trim(args.tuner_system) | local tuner_system = trim(args.tuner_system) | ||
| Line 236: | Line 253: | ||
end | end | ||
addRow(container, 'Years', yearStr, false) | addRow(container, 'Years', yearStr, false) | ||
end | |||
-- MSRP | |||
if msrp then | |||
addRow(container, 'MSRP', formatMSRP(msrp), false) | |||
end | end | ||