Module:AVBrandList: Difference between revisions
Update to query brands directly from AV device pages (like AVDeviceTypeList does for types) instead of requiring brand category pages - this ensures all brands appear including Victor (via update-page on MediaWiki MCP Server) Tag: Reverted |
Revert to category-based approach for consistency with CRT brands - requires brand category pages but is more reliable and scalable (via update-page on MediaWiki MCP Server) Tag: Manual revert |
||
| Line 1: | Line 1: | ||
-- Module:AVBrandList | -- Module:AVBrandList | ||
-- Dynamically generates a list of AV device brand buttons by querying | -- Dynamically generates a list of AV device brand buttons by querying | ||
-- | -- pre-computed brand category pages with semantic properties. | ||
-- | -- Much faster than scanning all AV device pages. | ||
local p = {} | local p = {} | ||
| Line 19: | Line 18: | ||
local linkType = trim(args.link) | local linkType = trim(args.link) | ||
-- Query | -- Query brand category pages (fast - only queries category pages, not all AV devices) | ||
local queryWikitext = | local queryWikitext = | ||
'{{#ask:\n' .. | '{{#ask:\n' .. | ||
' [[ | ' [[Is AV brand category::Yes]]\n' .. | ||
' |?Brand name\n' .. | |||
' |? | |||
' |format=broadtable\n' .. | ' |format=broadtable\n' .. | ||
' |headers=hide\n' .. | ' |headers=hide\n' .. | ||
' |link=none\n' .. | ' |link=none\n' .. | ||
' |mainlabel=-\n' .. | ' |mainlabel=-\n' .. | ||
' |limit= | ' |limit=500\n' .. | ||
' |searchlabel=\n' .. | ' |searchlabel=\n' .. | ||
'}}' | '}}' | ||
| Line 35: | Line 33: | ||
local queryResult = frame:preprocess(queryWikitext) | local queryResult = frame:preprocess(queryWikitext) | ||
-- Extract | -- Extract brand names from result | ||
local brandsList = {} | local brandsList = {} | ||
| Line 42: | Line 39: | ||
for cellContent in queryResult:gmatch('<td[^>]*>(.-)</td>') do | for cellContent in queryResult:gmatch('<td[^>]*>(.-)</td>') do | ||
local brand = trim(cellContent:gsub('<[^>]+>', '')) | local brand = trim(cellContent:gsub('<[^>]+>', '')) | ||
if brand and brand ~= '' | if brand and brand ~= '' then | ||
table.insert(brandsList, brand) | table.insert(brandsList, brand) | ||
end | end | ||