Module:T: Difference between revisions

60 bytes added ,  15 November
no edit summary
(Created page with "-- <nowiki> -- Template:T -- local p = {} function p.main(frame) local args = frame:getParent().args return p._main(args) end function p._main(args) local link = args[1] local uri local targs = {} local ns local i = 1 -- strip transclusion modifiers (mw:Help:Magic words#Transclusion modifiers) link = link :gsub('safesubst:', '') :gsub('subst:', '') :gsub('int:', '') :gsub('msg:', '')...")
 
No edit summary
 
Line 7:
function p.main(frame)
local args = frame:getParent().args
return p._main(args)
end
 
function p._main(args)
local link = args[1]
local uri
Line 29 ⟶ 25:
-- check for valid namespace else prepend Template:
if not (ns == '' or mw.site.namespaces[ns]) or ns == link then
link = 'Template:' .. link
end
Line 49 ⟶ 45:
end
local pipeChar = frame:extensionTag{ name='nowiki', content = '|' }
targs = table.concat(targs, '&#124;'pipeChar)
 
if targs ~= '' then
targs = '&#124;'pipeChar .. targs
end
return '<span class="plainlinks"><code>{{[' .. tostring(uri) .. ' ' .. args[1] .. ']' .. targs .. '}}</code></span>'
 
end