Module:Infobox/split

From Nguhcraft Wiki
Jump to navigation Jump to search

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

local p = {}
-- I don't remember what this is for; might remove it later
p.generateColumns = function(frame)
	local ret = ""
	for i in frame.args do
		ret = ret .. frame:expandTemplate{ title = "User:Viklo/Infobox/split/column", args = { i } }
	end
	return ret
end
-- This removes nowiki tags from column contents so that you can check whether
-- they have actual content or not.
p.makeEmptyColumnEmpty = function(frame)
	-- The weird string matches nowiki strip markers
	local ret = string.gsub(frame.args[1], "\127'\"`UNIQ%-%-nowiki%-%x%x%x%x%x%x%x%x%-QINU`\"'\127", "")
	return ret
end
-- Similar to makeEmptyColumnEmpty, but for the split template and also it
-- removes instances of Template:Infobox/split/newline
p.makeEmptySplitEmpty = function(frame)
	local ret = string.gsub(frame.args[1], "\127'\"`UNIQ%-%-nowiki%-%x%x%x%x%x%x%x%x%-QINU`\"'\127", "")
	-- This removes instances of Template:Infobox/split/newline
	ret = string.gsub(ret, "</tr><tr>", "")
	return ret
end
return p