Module:Consecutive links: Difference between revisions

add support for text prefix outside of link
mNo edit summary
(add support for text prefix outside of link)
Line 19: Line 19:
local linkprefix = args[6] or ''
local linkprefix = args[6] or ''
local linkpostfix = args[7] or ''
local linkpostfix = args[7] or ''
local textprefixindicator = args[8] or ''
local textprefix = args[9] or ''


local b = p.split(args[1], separator)
local b = p.split(args[1], separator)
Line 26: Line 28:
if type == 'links' then
if type == 'links' then
   returnstrformat = function(linkprefix, word, linkpostfix)
   returnstrformat = function(linkprefix, word, linkpostfix)
     return '[[' .. linkprefix .. word  .. linkpostfix .. ']]'
  fronttext = ''
  if textprefixindicator ~= '' and string.sub(word, 1, string.len(textprefixindicator)) == textprefixindicator then
  word = string.sub(word, string.len(textprefixindicator) + 1)
  fronttext = textprefix
  end
     return fronttext .. '[[' .. linkprefix .. word  .. linkpostfix .. ']]'
     end
     end
elseif type == 'templates' then
elseif type == 'templates' then