Module:Template link general: Difference between revisions

update from sandbox to avoid redundant code
m (1 revision imported)
(update from sandbox to avoid redundant code)
Line 98: Line 98:
-- Build the arguments
-- Build the arguments
local textPart = ""
local textPart = ""
for i = 2, 11 do
local textPartBuffer = ""
local ii = tostring(i)
local i = 2
local val = args[ii]
while args[i] do
if val ~= nil then val = mw.text.unstripNoWiki(val) else break end
local val = mw.text.trim(mw.text.unstripNoWiki(args[i]))
if _ne(args.nowiki) then val = nw(val) end
textPartBuffer = textPartBuffer .. '|'
if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end
if val ~= "" then
textPart = textPart .. '&#124;' .. val
if _ne(args.nowiki) then val = nw(val) end
if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end
textPart = textPart .. textPartBuffer .. val
textPartBuffer = ""
end
i = i+1
end
end
if _ne(args['12']) then textPart = textPart .. '&#124;…' end
 
-- final wrap
-- final wrap
local ret = titlePart .. textPart
local ret = titlePart .. textPart
Anonymous user