Module:AVDevice: Difference between revisions

Update stylesheet reference to use new shared styles (fixes dark mode) (via update-page on MediaWiki MCP Server)
Add format_family, supported_formats, recording_formats to infobox display (via update-page on MediaWiki MCP Server)
Line 55: Line 55:
else
else
fullDiv:wikitext(valueHtmlOrWikitext)
fullDiv:wikitext(valueHtmlOrWikitext)
end
end
-- Helper function to format comma-separated values as a bulleted list or inline
local function formatList(value, inline)
if not value then return nil end
local items = {}
for item in value:gmatch('[^,]+') do
local trimmed = trim(item)
if trimmed then
table.insert(items, trimmed)
end
end
if #items == 0 then return nil end
if inline or #items <= 3 then
return table.concat(items, ', ')
else
local ul = mw.html.create('ul')
ul:css('margin', '0'):css('padding-left', '1.2em')
for _, item in ipairs(items) do
ul:tag('li'):wikitext(item)
end
return tostring(ul)
end
end
end
end
Line 71: Line 94:
local model_code = trim(args.model_code)
local model_code = trim(args.model_code)
local device_type = trim(args.device_type)
local device_type = trim(args.device_type)
local format_family = trim(args.format_family)
local supported_formats = trim(args.supported_formats)
local recording_formats = trim(args.recording_formats)
local image_main = trim(args.image_main)
local image_main = trim(args.image_main)
local year_released = trim(args.year_released)
local year_released = trim(args.year_released)
Line 133: Line 159:
if device_type then
if device_type then
addRow(container, 'Type', '[[' .. device_type .. ']]', true)
addRow(container, 'Type', '[[' .. device_type .. ']]', true)
end
-- Format family with link to category
if format_family then
addRow(container, 'Format family', '[[:Category:' .. format_family .. ' devices|' .. format_family .. ']]', true)
end
end


Line 155: Line 186:
local ecidWikitext = string.format('[{{fullurl:%s|curid=%d}} EC%d]', pageName, pageId, pageId)
local ecidWikitext = string.format('[{{fullurl:%s|curid=%d}} EC%d]', pageName, pageId, pageId)
addRow(container, 'ECID', frame:preprocess(ecidWikitext), true)
addRow(container, 'ECID', frame:preprocess(ecidWikitext), true)
-- Format compatibility section (only show if tape-based device)
if supported_formats or recording_formats then
addSectionRow(container, 'Format Compatibility')
if supported_formats then
local formattedSupported = formatList(supported_formats, true)
if formattedSupported then
addRow(container, 'Plays', formattedSupported, false)
end
end
if recording_formats then
local formattedRecording = formatList(recording_formats, true)
if formattedRecording then
addRow(container, 'Records', formattedRecording, false)
end
end
end


-- Inputs/Outputs section
-- Inputs/Outputs section
MediaWiki Appliance - Powered by TurnKey Linux