FANDOM


-- <pre>
local p = {}
 
-- {{#invoke:striplinks|internal|This is [[some]] text with [[Help:Wikitext|links]]}} -> This is some text with links
function p.internal( frame )
	local link = mw.text.trim( frame.args[1] )
 
	link = link:gsub("(%[%[.-%]%])", function( match )
		local text = match:sub(3,-3) -- Strip the link brackets
		local pipe = text:find('%|')
		return pipe and text:sub( pipe + 1 ) or text
	end)
 
	return link
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.