Module:Sandbox/Aidan9382: Difference between revisions

Content deleted Content added
?
that's cool
 
(2 intermediate revisions by the same user not shown)
Line 23:
mw.log("Aidan9382 | Unable to load Benchmarker (unexpected arg setup)")
end
end
 
function p.DebugPage(frame) -- Used from template invocation to do a page-wide analysis
if rawget(_G, "_DoingPageDebug") == true then
mw.log("Preventing recursion loop in DebugPage logic")
return
end
local page = frame.args[1]
local content = mw.title.new(page).content
local Hook = require("Module:Sandbox/Aidan9382/Benchmarker")
Hook(function()
mw.log("Performing DebugPage on " .. page)
frame:preprocess(content)
end, "DebugPage")() -- Hacky way to get the logic to work
return "DebugPage complete"
end
 
function p.parentingLogic(frame)
--Note: Not even sure this thing goes beyond 1 parent, but have overcomplicated code anyways
local parentChain = {}
local newframe = frame
while true do
local parent = newframe:getParent()
if not parent then
break
end
newframe = parent
parentChain[#parentChain+1] = parent
end
local parentText = ""
for i,p in next,parentChain do
parentText = parentText .. " parent"..i.."="..p:getTitle()
end
return "frame="..frame:getTitle()..parentText.." mw.gct="..mw.title.getCurrentTitle().text
end
 
p["module-use"] = function(frame)
local parentLogicStuff = p.parentingLogic(frame)
local testlogic = "\n\n"
local i = 1
while true do
local c = frame.args["_test"..i]
if c then
testlogic = testlogic .. "_test"..i.."="..c
else
break
end
i = i + 1
end
return parentLogicStuff..testlogic
end
 
Line 130 ⟶ 80:
else
return "{{DEFAULTSORT:XYZ}}"
end
end
 
function p.magicWordTests2(frame)
local args = frame.args
if args.process == "y" then
frame:preprocess("{{#assessment:Testing|B|Low}}")
elseif args.returnprocess == "y" then
return frame:preprocess("{{#assessment:Testing|B|Low}}")
else
return "{{#assessment:Testing|B|Low}}"
end
end