Module:Infobox: Difference between revisions
Jump to navigation
Jump to search
imported the makeEmptyColumnEmpty function from Module/Infobox/split |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | 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 | -- This removes nowiki tags from the contents so that you can check whether | ||
-- there is actual content or not. | -- there is actual content or not. | ||
p.makeEmptyPartEmpty = function(frame) | p.makeEmptyPartEmpty = function(frame) | ||
-- The | -- The actual implementation is in makeEmptyPartEmptyNoFrame | ||
return p.makeEmptyPartEmptyNoFrame(frame.args[1]) | |||
end | end | ||
return p | return p | ||
Latest revision as of 13:52, 19 December 2024
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