Module:Template link general: Difference between revisions
m
30 revisions imported from wikipedia:Module:Template_link_general
mNo edit summary |
m (30 revisions imported from wikipedia:Module:Template_link_general) |
||
(19 intermediate revisions by 5 users not shown) | |||
Line 52:
if not _ne(textPart) then
if titleObj ~= nil then
textPart = titleObj
else
-- redlink
textPart =
end
end
if _ne(args.subst) then
-- HACK: the ns thing above is probably broken
textPart = 'subst:' .. textPart
end
Line 77 ⟶ 78:
function p.main(frame)
local args = getArgs(frame
trim = true,
removeBlanks = false
})
return p._main(args)
end
Line 94 ⟶ 98:
-- Build the arguments
local textPart = ""
local textPartBuffer = ""
while args[i] do
local val = mw.text.unstripNoWiki(args[ii])▼
textPartBuffer = textPartBuffer .. '|'
if val ~= "" then
if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end▼
if _ne(args.nowiki) then
textPart = textPart .. '|' .. val▼
-- 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
end
▲ if italic then val = '<span style="font-style:italic;">' .. val .. '</span>' end
textPartBuffer = ""
end
i = i+1
end
-- final wrap
local ret = titlePart .. textPart
if not dontBrace then ret = nw('{{') .. ret .. nw('}}') end
if _ne(args.a) then ret = nw('
if _ne(args.kbd) then ret = '<kbd>' .. ret .. '</kbd>' end
if code then
Line 120 ⟶ 132:
span:wikitext(ret)
--]]
if _ne(args.debug) then ret = ret .. '\n<pre>' .. mw.text.encode(mw.dumpObject(args)) .. '</pre>' end
return ret
end
|