Content deleted Content added
No edit summary |
MusikBot II (talk | contribs) m Protected "Module:Higher education task force": High-risk template or module: 5198 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 21:
end
--[[------------------------<
Gets the
]]----------------------------------------------------------------------------
function p.main(frame)
local args = getArgs(frame, { parentFirst = true })
return p._main(args)
end
-- Takes an input string "r" in the form "|a=b" (no spaces around the =) used in templates and adds it to the table
function p.tab2arg(trable,r)
local t = mw.text.split(r, "=", true, true) -- Split by comma, trim whitespace, remove empty strings
Line 109 ⟶ 40:
end
-- Adds an element to a table (syntactic sugar)
function p.ma1(frame,s1,s2)
frame[s1]=s2
end
--[[ pulls out our specially named parameter from the list of template-like args, and expands
it into the appropriate task force table entries
]]--
function p.fudgeTaskforceParameters(frame)
local args = getArgs(frame, { parentFirst = true })
local taskforcesStr = ""
taskforcesStr = args["
if not taskforcesStr then
return "oops"
Line 123 ⟶ 57:
local taskforceCodes = mw.text.split(taskforcesStr, ",", true, true) -- Split by comma, trim whitespace, remove empty strings
local tfCounter = 1
local trable=args
Line 131 ⟶ 64:
if tfData then
trable = p.tab2arg(trable,string.format("|tf %d=%dyes", tfCounter,tfCounter))
trable = p.tab2arg(trable,string.format("|TF_%d_LINK=%s", tfCounter, tfData.link))
trable = p.tab2arg(trable,string.format("|TF_%d_NAME=%s", tfCounter, tfData.name))
trable = p.tab2arg(trable,string.format("|TF_%d_NESTED=%s", tfCounter, tfData.nested))
trable = p.tab2arg(trable,string.format("|TF_%d_IMAGE=%s", tfCounter, tfData.image))
trable = p.tab2arg(trable,string.format("|TF_%d_MAIN_CAT=%s", tfCounter, tfData.category))
tfCounter = tfCounter + 1
end
Line 149 ⟶ 76:
end
-- More or less a wrapper for WikiProject Banner with some argument sweetening
function p.
local oframe=frame
frame=p.fudgeTaskforceParameters(frame)
Line 162 ⟶ 89:
return str[1]
end
|