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)
Narrow down which call eats a following link (via update-page on MediaWiki MCP Server)
Magent (talk | contribs)
Test whether template= in the query is what breaks links afterwards (via update-page on MediaWiki MCP Server)
Line 9: Line 9:
end
end


-- The full ask the real module makes, then a link after it.
local function ask( frame, extra )
function p.askthenlink( frame )
local args = {
local raw = frame:callParserFunction( "#ask", {
"[[Has performer::Harry Clark]]",
"[[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",
"link=none",
"link=none",
"sep=@@",
"template=Studio appearance row",
"searchlabel=",
"searchlabel=",
"limit=200",
"limit=200",
} )
}
raw = mw.text.unstrip( raw or "" )
for _, one in ipairs( extra ) do
raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
table.insert( args, one )
return "raw=[" .. visible( raw ) .. "] then a link: [[4masks]] and another [[Studio sessions test]]"
end
local raw = frame:callParserFunction( "#ask", args )
return mw.text.unstrip( raw or "" )
end
end


-- The same, but reading the record out of the row the way the module does.
-- With a row template, as the real module does.
function p.fromrow( frame )
function p.withtemplate( frame )
local raw = frame:callParserFunction( "#ask", {
local raw = ask( frame, { "format=plainlist", "sep=@@", "template=Studio appearance row" } )
"[[Has performer::Harry Clark]]",
return "got " .. visible( raw ) .. " -- link after: [[4masks]]"
"?Has track name=track",
end
"mainlabel=record",
 
"format=plainlist",
-- Without one: the values come back separated by SMW's own punctuation.
"link=none",
function p.notemplate( frame )
"sep=@@",
local raw = ask( frame, { "format=list", "sep=@@", "propsep=||" } )
"template=Studio appearance row",
return "got " .. visible( raw ) .. " -- link after: [[4masks]]"
"searchlabel=",
end
"limit=200",
 
} )
-- No query at all, for a baseline.
raw = mw.text.unstrip( raw or "" )
function p.noask( frame )
raw = raw:gsub( "\127[^\127]*\127", "" ):gsub( "<[^>]+>", "" )
return "got nothing -- link after: [[4masks]]"
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:42, 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

local function ask( frame, extra )
	local args = {
		"[[Has performer::Harry Clark]]",
		"?Has track name=track",
		"mainlabel=record",
		"link=none",
		"searchlabel=",
		"limit=200",
	}
	for _, one in ipairs( extra ) do
		table.insert( args, one )
	end
	local raw = frame:callParserFunction( "#ask", args )
	return mw.text.unstrip( raw or "" )
end

-- With a row template, as the real module does.
function p.withtemplate( frame )
	local raw = ask( frame, { "format=plainlist", "sep=@@", "template=Studio appearance row" } )
	return "got " .. visible( raw ) .. " -- link after: [[4masks]]"
end

-- Without one: the values come back separated by SMW's own punctuation.
function p.notemplate( frame )
	local raw = ask( frame, { "format=list", "sep=@@", "propsep=||" } )
	return "got " .. visible( raw ) .. " -- link after: [[4masks]]"
end

-- No query at all, for a baseline.
function p.noask( frame )
	return "got nothing -- link after: [[4masks]]"
end

return p