Module:Consecutive links

From Caves of Qud Wiki
Revision as of 18:59, 31 August 2019 by Teamtoto (talk | contribs) (added linkprefix/linkpostfix for stuff you want inside the brackets for specific namespaces,categories, etc)
Jump to navigation Jump to search

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 and linkprefix or '' .. b .. linkpostfix and linkpostfix or ''.."]]" .. postfix
end
return p