Module:CRTModel: Difference between revisions
Add Scan Range section to infobox displaying horizontal and vertical scan rates (via update-page on MediaWiki MCP Server) |
Add speaker display section to infobox (via update-page on MediaWiki MCP Server) |
||
| Line 103: | Line 103: | ||
local v_scan_min = trim(args.v_scan_min) | local v_scan_min = trim(args.v_scan_min) | ||
local v_scan_max = trim(args.v_scan_max) | local v_scan_max = trim(args.v_scan_max) | ||
-- Speakers | |||
local speaker_type = trim(args.speaker_type) | |||
local speaker_watts = trim(args.speaker_watts) | |||
local subwoofer = trim(args.subwoofer) | |||
-- Use frame:extensionTag to create a proper <style> tag that won't be escaped | -- Use frame:extensionTag to create a proper <style> tag that won't be escaped | ||
| Line 237: | Line 242: | ||
local weightWikitext = '{{#show: ' .. fullPageName .. ' |?Weight # lb }} / {{#show: ' .. fullPageName .. ' |?Weight # kg }}' | local weightWikitext = '{{#show: ' .. fullPageName .. ' |?Weight # lb }} / {{#show: ' .. fullPageName .. ' |?Weight # kg }}' | ||
addRow(container, 'Weight', frame:preprocess(weightWikitext), true) | addRow(container, 'Weight', frame:preprocess(weightWikitext), true) | ||
end | |||
end | |||
-- Speakers section: show if we have any speaker specs | |||
if speaker_type or speaker_watts or subwoofer then | |||
addSectionRow(container, 'Speakers') | |||
if speaker_type then | |||
addRow(container, 'Type', speaker_type, false) | |||
end | |||
if speaker_watts then | |||
addRow(container, 'Power', speaker_watts, false) | |||
end | |||
if subwoofer then | |||
addRow(container, 'Subwoofer', subwoofer, false) | |||
end | end | ||
end | end | ||
| Line 388: | Line 410: | ||
addSectionRow(container, 'Inputs') | addSectionRow(container, 'Inputs') | ||
addFullRow(container, askHtml, 'padding:0.2em 0.4em;', true) | addFullRow(container, askHtml, 'padding:0.2em 0.4em;', true) | ||
end | |||
-- Outputs section: use count query to check if there are any outputs | |||
local outputsCountWikitext = | |||
'{{#ask:\n' .. | |||
' [[Has CRT model::' .. fullPageName .. ']]\n' .. | |||
' [[Has output signal format::+]]\n' .. | |||
' |format=count\n' .. | |||
'}}' | |||
local outputCount = frame:preprocess(outputsCountWikitext) | |||
local hasOutputs = outputCount and tonumber(trim(outputCount)) and tonumber(trim(outputCount)) > 0 | |||
if hasOutputs then | |||
local outputsAskWikitext = | |||
'{{#ask:\n' .. | |||
' [[Has CRT model::' .. fullPageName .. ']]\n' .. | |||
' [[Has output signal format::+]]\n' .. | |||
' |?Has output type=type\n' .. | |||
' |?Has output signal format=signal\n' .. | |||
' |?Has output connector=connector\n' .. | |||
' |?Has output count=count\n' .. | |||
' |?Has output label=label\n' .. | |||
' |?Has output location=location\n' .. | |||
' |format=ul\n' .. | |||
' |template=CRT output inline\n' .. | |||
' |named args=yes\n' .. | |||
' |searchlabel=\n' .. | |||
'}}' | |||
local outputsHtml = frame:preprocess(outputsAskWikitext) | |||
addSectionRow(container, 'Outputs') | |||
addFullRow(container, outputsHtml, 'padding:0.2em 0.4em;', true) | |||
end | end | ||