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)
Also test whether a link returned after a #show call still renders (via update-page on MediaWiki MCP Server)
Magent (talk | contribs)
Dump the exact string Module:Studio sessions returns (via update-page on MediaWiki MCP Server)
Line 1: Line 1:
-- Temporary. Shows what the parser hands back to Lua from an #ask, with the
-- Temporary. Delete once Module:Studio sessions is behaving.
-- invisible parts made visible: strip markers as <MARKER>, angle brackets
-- escaped. Delete once Module:Studio sessions is behaving.


local p = {}
local p = {}
Line 16: Line 14:
"[[Has performer::" .. who .. "]]",
"[[Has performer::" .. who .. "]]",
"?Has track name=track",
"?Has track name=track",
"?Has track number=number",
"?Has instrument=instrument",
"mainlabel=record",
"mainlabel=record",
"format=plainlist",
"format=plainlist",
Line 26: Line 22:
"limit=200",
"limit=200",
} )
} )
local unstripped = mw.text.unstrip( raw or "" )
return "<pre>BEFORE: " .. visible( raw )
return "<pre>BEFORE: " .. visible( raw )
.. "\nAFTER:  " .. visible( unstripped ) .. "</pre>"
.. "\nAFTER:  " .. visible( mw.text.unstrip( raw or "" ) ) .. "</pre>"
end
end


-- Does a plain link survive, on its own and after a #show?
function p.link( frame )
function p.link( frame )
local plain = "[[Studio sessions test]]"
return "one: [[Studio sessions test]] || two: [[4masks]]"
 
end
local afterShow = frame:callParserFunction( "#show", {
"Studio sessions test", "?Has license", "link=none", "default=",
} )
afterShow = mw.text.unstrip( afterShow or "" )


return "one: " .. plain
-- What does the real module hand back, character for character?
.. " || two: [[4masks]]"
function p.dump( frame )
.. " || show returned: [" .. visible( afterShow ) .. "]"
local studio = require( "Module:Studio sessions" )
.. " || three: [[Studio sessions test]]"
local out = studio.appearances( frame )
return "<pre>" .. visible( out ) .. "</pre>"
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

function p.raw( frame )
	local who = frame.args[1] or "Harry Clark"
	local raw = frame:callParserFunction( "#ask", {
		"[[Has performer::" .. who .. "]]",
		"?Has track name=track",
		"mainlabel=record",
		"format=plainlist",
		"link=none",
		"sep=@@",
		"template=Studio appearance row",
		"searchlabel=",
		"limit=200",
	} )
	return "<pre>BEFORE: " .. visible( raw )
		.. "\nAFTER:  " .. visible( mw.text.unstrip( raw or "" ) ) .. "</pre>"
end

function p.link( frame )
	return "one: [[Studio sessions test]] || two: [[4masks]]"
end

-- What does the real module hand back, character for character?
function p.dump( frame )
	local studio = require( "Module:Studio sessions" )
	local out = studio.appearances( frame )
	return "<pre>" .. visible( out ) .. "</pre>"
end

return p