Module:Infobox

From Nguhcraft Wiki
Revision as of 13:52, 19 December 2024 by Viklo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

local p = {}
-- This is the same as the function below except it takes a string instead of
-- a frame so that it can easily be used by other modules.
p.makeEmptyPartEmptyNoFrame = function(str)
	-- The weird string matches nowiki strip markers.
	-- The return value from string.gsub is saved in ret and then returned
	-- because it returns more than one value and this ignores the others.
	local ret = string.gsub(str, "\127'\"`UNIQ%-%-nowiki%-%x%x%x%x%x%x%x%x%-QINU`\"'\127", "")
	return ret
end
-- This removes nowiki tags from the contents so that you can check whether
-- there is actual content or not.
p.makeEmptyPartEmpty = function(frame)
	-- The actual implementation is in makeEmptyPartEmptyNoFrame
	return p.makeEmptyPartEmptyNoFrame(frame.args[1])
end
return p