Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 07:46, 31 August 2019 by commons>Sarang (first version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Module documentation[ create · purge ]
This documentation is transcluded from Module:Char/doc.
-- This function can substitute some critical leading characters
-- by their decimal numeric character references
-- to avoid their interpretion as wiki syntax

local ncr = {}

-- global=args[1] / local=frame
function ncr.substitute ( frame )
	local args  = frame.args
	if  args then
       local str = args[1]
	else
       local str = frame
	end
    if  mw.ustring.sub ( str, 1, 1 ) == '#' then 
         return '#' .. mw.ustring.sub( str, 2, #str );
    elseif mw.ustring.sub ( str, 1, 1 ) == '*' then 
         return '*' .. mw.ustring.sub( str, 2, #str );
    elseif mw.ustring.sub ( str, 1, 1 ) == ':' then 
         return ':' .. mw.ustring.sub( str, 2, #str );
    elseif mw.ustring.sub ( str, 1, 1 ) == ';' then 
         return '&#59;' .. mw.ustring.sub( str, 2, #str );
    else
         return str;
    end
end

-- alias function name (abbreviation)
function   ncr.subst      ( frame )
	return ncr.substitute ( frame )
end

return ncr;
Cookies help us deliver our services. By using our services, you agree to our use of cookies.