Module:BrandSeries: Difference between revisions

Add debug output to see query results (via update-page on MediaWiki MCP Server)
Fix parameter passing - check frame.args first, then parent (via update-page on MediaWiki MCP Server)
Line 14: Line 14:


function p.seriesTable(frame)
function p.seriesTable(frame)
local args = frame.args
-- Try to get brand from frame.args first (direct #invoke call)
local parent = frame:getParent()
-- then from parent.args (called through a template)
if parent then
local brand = trim(frame.args.brand) or trim(frame.args[1])
args = parent.args
if not brand then
local parent = frame:getParent()
if parent then
brand = trim(parent.args.brand) or trim(parent.args[1])
end
end
end
local brand = trim(args.brand) or trim(args[1])
if not brand then
if not brand then
Line 34: Line 37:
-- DEBUG: show raw query result
-- DEBUG: show raw query result
local debug = '<pre>Query: ' .. crtQuery .. '\n\nResult length: ' .. tostring(#(crtResult or '')) .. '\n\nFirst 2000 chars:\n' .. (crtResult or ''):sub(1, 2000) .. '</pre>'
local debug = '<pre>Brand: ' .. brand .. '\n\nQuery: ' .. crtQuery .. '\n\nResult length: ' .. tostring(#(crtResult or '')) .. '\n\nFirst 2000 chars:\n' .. (crtResult or ''):sub(1, 2000) .. '</pre>'
-- Count occurrences of each series by parsing HTML table
-- Count occurrences of each series by parsing HTML table
MediaWiki Appliance - Powered by TurnKey Linux