Permanently protected module

Module:Normalized pagename

From Yugipedia
Revision as of 18:20, 3 June 2019 by Dinoguy1000 (talk | contribs) (Protected "Module:Normalized pagename": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Module documentation[view] [edit] [history] [purge]

Implements {{Normalized pagename}}.

-- <pre>

--
-- implements {{Normalized pagename}}
--

local mArguments --lazily initialize
local p = {}

function p.main( frame )
	mArguments = mArguments or require( 'Module:Arguments' )
	local args = mArguments.getArgs( frame, { parentOnly = true } )
	
	local pagename = args[1] or mw.title.getCurrentTitle().prefixedText
	
	pagename = pagename
		:gsub( '&#34;', '"' )
		:gsub( '&quot;', '"' )
		:gsub( '&#38;', '&' )
		:gsub( '&amp;', '&' )
		:gsub( '&#39;', "'" )
		:gsub( '&apos;', "'" )
		:gsub( '&#42;', '*' )
		:gsub( '&#59;', ';' )
		:gsub( '&#61;', '=' )
	
	return pagename
end

return p

-- </pre>