Module:Consecutive links: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
m (i can't spell)
(ignores white space and can specify what the replacer char can be)
Line 3: Line 3:
function p.parse(frame)
function p.parse(frame)
local separator = frame.args[2]
local separator = frame.args[2]
local b = string.gsub(frame.args[1], separator, "]]" .. separator .. "[[")
local replacer = frame.args[3]
local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", "]]" .. replacer .. "[[")
return "[[".. b .. "]]"
return "[[".. b .. "]]"
end
end
return p
return p

Revision as of 18:51, 23 July 2019


local p = {}

function p.parse(frame)
local separator = frame.args[2]
local replacer = frame.args[3]
local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", "]]" .. replacer .. "[[")
return "[[".. b .. "]]"
end
return p