Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Turns wikitext into plain text, removing link markup, bold and italic marks, and HTML tags. Used by the infoboxes to build automatic short descriptions, so a homeworld written as [[Halcyon#Nereid|Nereid]] becomes just "Nereid".

{{#invoke:Plain|text|some [[linked]] text}} gives "some linked text".


-- Turns wikitext into plain text: [[Page|label]] -> label, [[Page]] -> Page,
-- and removes bold/italic marks and HTML tags.
-- Used by the infoboxes to build automatic short descriptions.
-- Usage: {{#invoke:Plain|text|some [[linked]] text}}
local p = {}

function p.text( frame )
	local s = frame.args[ 1 ] or ''
	s = s:gsub( '%[%[[^%]|]*|([^%]]*)%]%]', '%1' )
	s = s:gsub( '%[%[([^%]]*)%]%]', '%1' )
	s = s:gsub( "'''?", '' )
	s = s:gsub( '<[^>]->', '' )
	return mw.text.trim( s )
end

return p