Module:Studio debug: Difference between revisions

From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Jump to navigationJump to search
Magent (talk | contribs)
Isolate the licence lookup (via update-page on MediaWiki MCP Server)
Magent (talk | contribs)
Finished with it; left blank for deletion (via update-page on MediaWiki MCP Server)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
-- Temporary. Delete once Module:Studio sessions is behaving.
-- Spent. This was a scratch module for one afternoon's debugging of
-- Module:Studio sessions, and it answered its question: a template-formatted
-- #ask comes back wrapped in a literal [[SMW::off]] ... [[SMW::on]], which was
-- ending up inside the record's name.
--
-- Safe to delete. Nothing calls it.


local p = {}
return {}
 
local function rows( frame )
local raw = frame:callParserFunction( "#ask", {
"[[Has performer::Harry Clark]]",
"?Has track name=track",
"?Has track number=number",
"?Has instrument=instrument",
"mainlabel=record",
"link=none",
"searchlabel=",
"limit=200",
"format=plainlist",
"sep=@@",
"template=Studio appearance row",
} )
raw = mw.text.unstrip( raw or "" )
raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
local record = raw:match( "^(.-)||" ) or ""
return record:match( "^([^#]*)" ) or record
end
 
-- Query, then link. No licence lookup.
function p.nolicence( frame )
local record = rows( frame )
return '<div style="font-weight:600;">[[' .. record .. "]]</div>"
end
 
-- Query, then ask the record for its licence, then link.
function p.withlicence( frame )
local record = rows( frame )
local licence = frame:callParserFunction( "#show", {
record, "?Has license", "link=none", "default=",
} )
licence = mw.text.unstrip( licence or "" )
licence = licence:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
return '<div style="font-weight:600;">[[' .. record .. "]]</div> licence=[" .. licence .. "]"
end
 
return p

Latest revision as of 21:45, 17 September 2026

Documentation for this module may be created at Module:Studio debug/doc

-- Spent. This was a scratch module for one afternoon's debugging of
-- Module:Studio sessions, and it answered its question: a template-formatted
-- #ask comes back wrapped in a literal [[SMW::off]] ... [[SMW::on]], which was
-- ending up inside the record's name.
--
-- Safe to delete. Nothing calls it.

return {}