Module:Infobox/split: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
-- I don't remember what this is for; might remove it later | |||
p.generateColumns = function(frame) | p.generateColumns = function(frame) | ||
local ret = "" | local ret = "" | ||
Line 7: | Line 8: | ||
return ret | return ret | ||
end | end | ||
-- This removes nowiki tags from column contents so that you can check whether | |||
-- they have actual content or not. | |||
p.makeEmptyColumnEmpty = function(frame) | 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", "") | 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 | return ret | ||
end | end | ||
return p | return p |
Latest revision as of 20:42, 23 October 2024
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