Module:Consecutive links: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(revert previous two changes)
(added linkprefix/linkpostfix for stuff you want inside the brackets for specific namespaces,categories, etc)
Line 6: Line 6:
local prefix = frame.args[4]
local prefix = frame.args[4]
local postfix = frame.args[5]
local postfix = frame.args[5]
local b = string.gsub(frame.args[1], "%s*" .. separator .. "%s*", "]]" .. replacer .. "[[")
local linkprefix = frame.args[6]
return prefix .. "[[" .. b .. "]]" .. postfix
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
end
return p
return p

Revision as of 18:59, 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 and linkprefix or '' .. b .. linkpostfix and linkpostfix or ''.."]]" .. postfix
end
return p