Module:Sandbox/The Earwig/AfC submission

local p = {}

-- local templateRegex = "[Aa][Ff][Cc] submission" local templateRegex = "User:The Earwig/Sandbox/AfC submission"

-- Is this the first submission template on the page? -- Later templates emit nothing, only recording the submission state. local function isMainTemplate(args, text) local match = mw.ustring.match(text, "%{%{%s*"..templateRegex..".-%|%s*ts%s*=([^|}]*)") return match == args.ts end

-- Render the AfC submission template. local function render(frame, args, text) return frame:expandTemplate{ title = "AfC submission", args = args } end

function p.main(frame) local args = frame:getParent.args local text = mw.title.getCurrentTitle:getContent if isMainTemplate(args, text) then return render(frame, args, text) end end

return p