Module:AVDevice: Difference between revisions

Add format_family, supported_formats, recording_formats to infobox display (via update-page on MediaWiki MCP Server)
Major update: Add semantic queries for structured inputs, outputs, voltage ranges, archival links; add TV system and power spec display (via update-page on MediaWiki MCP Server)
Line 100: Line 100:
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 signal_standard = trim(args.signal_standard)
local av_system = trim(args.av_system)
local video_inputs = trim(args.video_inputs)
local tuner_system = trim(args.tuner_system)
local video_outputs = trim(args.video_outputs)
local frequency = trim(args.frequency)
local audio_inputs = trim(args.audio_inputs)
local power_avg = trim(args.power_avg)
local audio_outputs = trim(args.audio_outputs)
local power_max = trim(args.power_max)
local features = trim(args.features)
local features = trim(args.features)
local height = trim(args.height)
local height = trim(args.height)
Line 110: Line 110:
local depth = trim(args.depth)
local depth = trim(args.depth)
local weight = trim(args.weight)
local weight = trim(args.weight)
local power_voltage = trim(args.power_voltage)
local power_wattage = trim(args.power_wattage)


-- Use frame:extensionTag to create a proper <style> tag
-- Use frame:extensionTag to create a proper <style> tag
Line 179: Line 177:
end
end


if signal_standard then
-- AV System support
addRow(container, 'Signal standard', signal_standard, false)
if av_system then
local formattedAV = formatList(av_system, true)
if formattedAV then
addRow(container, 'AV system', formattedAV, false)
end
end
end


Line 206: Line 208:
end
end


-- Inputs/Outputs section
-- Connectivity section - query structured inputs and outputs
if video_inputs or video_outputs or audio_inputs or audio_outputs then
local inputsQueryWikitext =
'{{#ask:\n' ..
' [[Has AV device::' .. fullPageName .. ']]\n' ..
' [[Has video signal format::+]]\n' ..
' |?Has input label=Label\n' ..
' |?Has video signal format=Signal\n' ..
' |?Has connector type=Connector\n' ..
' |?Has input count=Count\n' ..
' |?Has input location=Location\n' ..
' |?Has audio type=Audio\n' ..
' |format=count\n' ..
'}}'
local inputCount = frame:preprocess(inputsQueryWikitext)
local hasInputs = inputCount and tonumber(trim(inputCount)) and tonumber(trim(inputCount)) > 0
 
local outputsQueryWikitext =
'{{#ask:\n' ..
' [[Has AV device::' .. fullPageName .. ']]\n' ..
' [[Has output signal format::+]]\n' ..
' |format=count\n' ..
'}}'
local outputCount = frame:preprocess(outputsQueryWikitext)
local hasOutputs = outputCount and tonumber(trim(outputCount)) and tonumber(trim(outputCount)) > 0
 
if hasInputs or hasOutputs then
addSectionRow(container, 'Connectivity')
addSectionRow(container, 'Connectivity')
if video_inputs then
if hasInputs then
addRow(container, 'Video in', video_inputs, false)
local inputsListWikitext =
'{{#ask:\n' ..
' [[Has AV device::' .. fullPageName .. ']]\n' ..
' [[Has video signal format::+]]\n' ..
' |?Has input count=\n' ..
' |?Has video signal format=\n' ..
' |?Has connector type=\n' ..
' |?Has input location=\n' ..
' |format=template\n' ..
' |template=AV device input row\n' ..
' |named args=yes\n' ..
' |link=none\n' ..
'}}'
local inputsResult = frame:preprocess(inputsListWikitext)
if inputsResult and trim(inputsResult) then
addRow(container, 'Inputs', inputsResult, true)
end
end
end
if video_outputs then
 
addRow(container, 'Video out', video_outputs, false)
if hasOutputs then
end
local outputsListWikitext =
if audio_inputs then
'{{#ask:\n' ..
addRow(container, 'Audio in', audio_inputs, false)
' [[Has AV device::' .. fullPageName .. ']]\n' ..
end
' [[Has output signal format::+]]\n' ..
if audio_outputs then
' |?Has output count=\n' ..
addRow(container, 'Audio out', audio_outputs, false)
' |?Has output signal format=\n' ..
' |?Has output connector=\n' ..
' |?Has output location=\n' ..
' |format=template\n' ..
' |template=AV device output row\n' ..
' |named args=yes\n' ..
' |link=none\n' ..
'}}'
local outputsResult = frame:preprocess(outputsListWikitext)
if outputsResult and trim(outputsResult) then
addRow(container, 'Outputs', outputsResult, true)
end
end
end
end
end
Line 247: Line 300:
end
end


-- Power section
-- Power section - query voltage ranges and display power specs
if power_voltage or power_wattage then
local voltageQueryWikitext =
'{{#ask:\n' ..
' [[Has AV device::' .. pageName .. ']]\n' ..
' [[Voltage min::+]]\n' ..
' |?Voltage min\n' ..
' |?Voltage max\n' ..
' |format=template\n' ..
' |template=AV device voltage row\n' ..
' |named args=yes\n' ..
' |link=none\n' ..
'}}'
local voltageResult = frame:preprocess(voltageQueryWikitext)
local hasVoltage = voltageResult and trim(voltageResult) and trim(voltageResult) ~= ''
 
if hasVoltage or frequency or power_avg or power_max then
addSectionRow(container, 'Power')
addSectionRow(container, 'Power')
if power_voltage then
addRow(container, 'Voltage', power_voltage, false)
if hasVoltage then
addRow(container, 'Voltage', voltageResult, true)
end
end
if power_wattage then
addRow(container, 'Wattage', power_wattage, false)
if frequency then
local formattedFreq = formatList(frequency, true)
if formattedFreq then
addRow(container, 'AC frequency', formattedFreq, false)
end
end
if power_avg or power_max then
local powerStr = ''
if power_avg and power_max then
powerStr = power_avg .. 'W (avg) / ' .. power_max .. 'W (max)'
elseif power_avg then
powerStr = power_avg .. 'W'
elseif power_max then
powerStr = power_max .. 'W (max)'
end
addRow(container, 'Power', powerStr, false)
end
end
end
-- Archival Links section - query AV link subobjects
local linksQueryWikitext =
'{{#ask:\n' ..
' [[AV device::' .. fullPageName .. ']]\n' ..
' [[Model link URL::+]]\n' ..
' |?Model link type\n' ..
' |?Model link source\n' ..
' |?Model link URL\n' ..
' |format=count\n' ..
'}}'
local linkCount = frame:preprocess(linksQueryWikitext)
local hasLinks = linkCount and tonumber(trim(linkCount)) and tonumber(trim(linkCount)) > 0
if hasLinks then
addSectionRow(container, 'Links')
local linksListWikitext =
'{{#ask:\n' ..
' [[AV device::' .. fullPageName .. ']]\n' ..
' [[Model link URL::+]]\n' ..
' |?Model link type\n' ..
' |?Model link source\n' ..
' |?Model link URL\n' ..
' |format=template\n' ..
' |template=AV device link row\n' ..
' |named args=yes\n' ..
' |link=none\n' ..
'}}'
local linksResult = frame:preprocess(linksListWikitext)
local linksDiv = container:tag('div')
css(linksDiv, 'grid-column: 1 / -1; padding:0.2em 0.4em;')
linksDiv:wikitext(linksResult)
end
end


MediaWiki Appliance - Powered by TurnKey Linux