Module:Consecutive links: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(added linkprefix/linkpostfix for stuff you want inside the brackets for specific namespaces,categories, etc)
mNo edit summary
Line 10: Line 10:


local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", linkpostfix .. "]]" .. replacer .. "[[" .. linkprefix)
local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", linkpostfix .. "]]" .. replacer .. "[[" .. linkprefix)
return prefix .. "[[" .. linkprefix and linkprefix or '' .. b .. linkpostfix and linkpostfix or ''.."]]" .. postfix
return prefix .. "[[" .. linkprefix .. b .. linkpostfix .."]]" .. postfix
end
end
return p
return p

Revision as of 19:02, 31 August 2019


local p = {}

function p.parse(frame)
local separator = frame.args[2]
local replacer = frame.args[3]
local prefix = frame.args[4]
local postfix = frame.args[5]
local linkprefix = frame.args[6]
local linkpostfix = frame.args[7]

local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", linkpostfix .. "]]" .. replacer .. "[[" .. linkprefix)
return prefix .. "[[" .. linkprefix .. b .. linkpostfix .."]]" .. postfix
end
return p