Module:Studio debug
From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Documentation for this module may be created at Module:Studio debug/doc
-- Temporary. Shows what the parser hands back to Lua from an #ask, with the
-- invisible parts made visible: strip markers as <MARKER>, angle brackets
-- escaped. Delete once Module:Studio sessions is behaving.
local p = {}
local function visible( s )
s = ( s or "" ):gsub( "\127[^\127]*\127", "<MARKER>" )
s = s:gsub( "&", "&" ):gsub( "<", "<" ):gsub( ">", ">" )
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
-- Does a plain link survive, on its own and after a #show?
function p.link( frame )
local plain = "[[Studio sessions test]]"
local afterShow = frame:callParserFunction( "#show", {
"Studio sessions test", "?Has license", "link=none", "default=",
} )
afterShow = mw.text.unstrip( afterShow or "" )
return "one: " .. plain
.. " || two: [[4masks]]"
.. " || show returned: [" .. visible( afterShow ) .. "]"
.. " || three: [[Studio sessions test]]"
end
return p