Fandom

Narutopedia

Module:Tlx

6,238pages on
this wiki
Add New Page
Talk0
local p = {}
 
-- Credit: Layton Wikia
function p.tlx( frame )
	local a = frame:getParent().args
	local page = a[1]
	if not page then return '' end
 
	local prefix = a.prefix and a.prefix .. ':' or ''
	local ns = 'Template:' --Default
 
	-- Check Namespace
	if a.prefix == '#invoke' then ns = 'Module:'
	elseif a.subst == 'true' then prefix = 'subst:'
	else
		local pageNs = page:match('^(.-):')
		if pageNs and ( pageNs == '' or mw.site.namespaces[pageNs] ) then
			ns = ''
		end
	end
 
	-- Build Output
	local out = { '{{',prefix,'[[',ns,page,'|',page,']]' }
 
	local i = 2
	while a[i] ~= nil do
		local arg = a[i]
		if arg then
			local f = arg:find('=')
			if f then
				out[#out+1] = '|' .. arg:sub(0,f) .. '<span style="color:#999;">&lt;' .. arg:sub(f+1) .. '&gt;</span>'
			else
				out[#out+1] = '|<span style="color:#999;">&lt;' .. arg .. '&gt;</span>'
			end
		end
		i = i + 1
	end
 
	out[#out+1] = '}}'
 
	if a.style == 'code' then
		out[1] = '<code>{{'
		out[#out+1] = '</code>'
	end
 
	return table.concat(out)
end
 
return p
--[[Category:Lua Modules]]

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki