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)
Dump the exact string Module:Studio sessions returns (via update-page on MediaWiki MCP Server)
Magent (talk | contribs)
Narrow down which call eats a following link (via update-page on MediaWiki MCP Server)
Line 9: Line 9:
end
end


function p.raw( frame )
-- The full ask the real module makes, then a link after it.
local who = frame.args[1] or "Harry Clark"
function p.askthenlink( frame )
local raw = frame:callParserFunction( "#ask", {
local raw = frame:callParserFunction( "#ask", {
"[[Has performer::" .. who .. "]]",
"[[Has performer::Harry Clark]]",
"?Has track name=track",
"?Has track name=track",
"?Has track number=number",
"?Has instrument=instrument",
"mainlabel=record",
"mainlabel=record",
"format=plainlist",
"format=plainlist",
Line 22: Line 24:
"limit=200",
"limit=200",
} )
} )
return "<pre>BEFORE: " .. visible( raw )
raw = mw.text.unstrip( raw or "" )
.. "\nAFTER: " .. visible( mw.text.unstrip( raw or "" ) ) .. "</pre>"
raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
return "raw=[" .. visible( raw ) .. "] then a link: [[4masks]] and another [[Studio sessions test]]"
end
end


function p.link( frame )
-- The same, but reading the record out of the row the way the module does.
return "one: [[Studio sessions test]] || two: [[4masks]]"
function p.fromrow( frame )
end
local raw = frame:callParserFunction( "#ask", {
 
"[[Has performer::Harry Clark]]",
-- What does the real module hand back, character for character?
"?Has track name=track",
function p.dump( frame )
"mainlabel=record",
local studio = require( "Module:Studio sessions" )
"format=plainlist",
local out = studio.appearances( frame )
"link=none",
return "<pre>" .. visible( out ) .. "</pre>"
"sep=@@",
"template=Studio appearance row",
"searchlabel=",
"limit=200",
} )
raw = mw.text.unstrip( raw or "" )
raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
local record = raw:match( "^(.-)||" ) or "no match"
record = record:match( "^([^#]*)" ) or record
return "record=[" .. visible( record ) .. "] as a link: [[" .. record .. "]]"
end
end


return p
return p

Revision as of 21:41, 17 September 2026

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

-- Temporary. Delete once Module:Studio sessions is behaving.

local p = {}

local function visible( s )
	s = ( s or "" ):gsub( "\127[^\127]*\127", "<MARKER>" )
	s = s:gsub( "&", "&amp;" ):gsub( "<", "&lt;" ):gsub( ">", "&gt;" )
	return s
end

-- The full ask the real module makes, then a link after it.
function p.askthenlink( frame )
	local raw = frame:callParserFunction( "#ask", {
		"[[Has performer::Harry Clark]]",
		"?Has track name=track",
		"?Has track number=number",
		"?Has instrument=instrument",
		"mainlabel=record",
		"format=plainlist",
		"link=none",
		"sep=@@",
		"template=Studio appearance row",
		"searchlabel=",
		"limit=200",
	} )
	raw = mw.text.unstrip( raw or "" )
	raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
	return "raw=[" .. visible( raw ) .. "] then a link: [[4masks]] and another [[Studio sessions test]]"
end

-- The same, but reading the record out of the row the way the module does.
function p.fromrow( frame )
	local raw = frame:callParserFunction( "#ask", {
		"[[Has performer::Harry Clark]]",
		"?Has track name=track",
		"mainlabel=record",
		"format=plainlist",
		"link=none",
		"sep=@@",
		"template=Studio appearance row",
		"searchlabel=",
		"limit=200",
	} )
	raw = mw.text.unstrip( raw or "" )
	raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
	local record = raw:match( "^(.-)||" ) or "no match"
	record = record:match( "^([^#]*)" ) or record
	return "record=[" .. visible( record ) .. "] as a link: [[" .. record .. "]]"
end

return p