Module:SourceFilter: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
No edit summary
(unecassary)
 
Line 11: Line 11:
end
end
util_vars.setVar("SourceHideDiv", numArgs)
util_vars.setVar("SourceHideDiv", numArgs)
return frame:preprocess(outputText)
return outputText
end
end


Line 20: Line 20:
outputText = outputText .. "</div>"
outputText = outputText .. "</div>"
end
end
return frame:preprocess(outputText)
return outputText
end
end


return p
return p

Latest revision as of 09:56, 25 June 2022

Documentation for this module may be created at Module:SourceFilter/doc

local util_vars = require('Module:VarsUtil')
local p = {}

function p.startFilterBlock(frame)
	local args = frame:getParent().args
	local outputText = ""
	local numArgs = 0
	for _ in pairs(args) do numArgs = numArgs + 1 end
	for count = 1, numArgs do
		outputText = outputText .. "<div class=\"mw-collapsible\" id=\"mw-customcollapsible-" .. args[count] .. "\">"
	end
	util_vars.setVar("SourceHideDiv", numArgs)
	return outputText
end

function p.endFilterBlock(frame)
	local outputText = ""
	local divs = util_vars.getVar("SourceHideDiv")
	for count = 1, divs do
		outputText = outputText .. "</div>"
	end
	return outputText
end

return p