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)
Temporary: show what an #ask called from Lua actually returns (via create-page on MediaWiki MCP Server)
 
Magent (talk | contribs)
Finished with it; left blank for deletion (via update-page on MediaWiki MCP Server)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- Temporary. Shows what the parser hands back to Lua from an #ask, with the
-- Spent. This was a scratch module for one afternoon's debugging of
-- invisible parts made visible: strip markers as <MARKER>, angle brackets
-- Module:Studio sessions, and it answered its question: a template-formatted
-- escaped. Delete once Module:Studio sessions is behaving.
-- #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 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",
"?Has track number=number",
"?Has instrument=instrument",
"mainlabel=record",
"format=plainlist",
"link=none",
"sep=@@",
"template=Studio appearance row",
"searchlabel=",
"limit=200",
} )
local unstripped = mw.text.unstrip( raw or "" )
return "<pre>BEFORE: " .. visible( raw )
.. "\nAFTER:  " .. visible( unstripped ) .. "</pre>"
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 {}