Module:Template link general: Difference between revisions

m
m (Changed protection level for "Module:Template link general": High-risk Lua module: Used by Template:Template link expanded ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)))
 
(4 intermediate revisions by one other user not shown)
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 = 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
-- Unstrip nowiki tags first because calling nw on something that already contains nowiki tags will
-- mangle the nowiki strip marker and result in literal UNIQ...QINU showing up
val = nw(mw.text.unstripNoWiki(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