Module:Higher education task force test: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Tag: Reverted
Line 8:
Internal function to retrieve data for a task force.
]]----------------------------------------------------------------------------
function p._oldmain_main(args, data)
local dataModule = require('Module:Higher education task force/data')
local taskForceCode = args.code or args[1]
Line 26:
]]----------------------------------------------------------------------------
 
function p.olddmainmain(frame)
local args = getArgs(frame, { parentFirst = true })
return p._main(args)
Line 53:
taskforcesStr = args["HETF_TASKFORCES_TO_EXPAND"]
if not taskforcesStr then
return "oops"
end
 
Line 61:
 
for _, code in ipairs(taskforceCodes) do
local tfData = p._oldmain_main({code})
if tfData then
trable = p.tab2arg(trable,string.format("|tf %d=%dyes", tfCounter,tfCounter))
Line 72:
end
end
trable = p.tab2arg(trable,"|CLASS=B")
frame.args=trable
return frame
end
function p.fudgeTaskforceCategories(frame)
local args = getArgs(frame, { parentFirst = true })
local taskforcesStr = ""
taskforcesStr = args["HETF_TASKFORCES_TO_EXPAND"]
if not taskforcesStr then
return ""
end
local class=""
local cat=""
 
 
local taskforceCodes = mw.text.split(taskforcesStr, ",", true, true) -- Split by comma, trim whitespace, remove empty strings
local tfCounter = 1
local trable=args
 
for _, code in ipairs(taskforceCodes) do
local tfData = p._oldmain({code})
if tfData then
cat = cat .. "[[Category:"..tfData.name.."]]"
tfCounter = tfCounter + 1
end
end
return cat
end
 
-- More or less a wrapper for WikiProject Banner with some argument sweetening
function p.mainhetf_banner(frame)
local ortv = banner.main(frame)
local oframe=frame
local retvframe=p.fudgeTaskforceParameters(frame)
 
local ret=banner.main(retv,retv,false)
ret=ret .. p.fudgeTaskforceCategories(frame)
 
return retbanner.main(oframe)
end