View source for Module:Char
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
-- This function can substitute some critical leading characters
-- by their decimal numeric character references
-- to avoid their interpretion as wiki syntax
local ncr = {}
-- function: removes characters at the start of the string: '#', '*', ':', ';'
function ncr.subst ( frame )
local gpar = frame.args
local char = ''
if gpar then char = mw.text.trim ( gpar[1] )-- global
else char = mw.text.trim ( frame ) -- local
end
if mw.ustring.sub ( char, 1, 1 ) == '#' then
return '#' .. mw.ustring.sub( char, 2, #char );
elseif mw.ustring.sub ( char, 1, 1 ) == '*' then
return '*' .. mw.ustring.sub( char, 2, #char );
elseif mw.ustring.sub ( char, 1, 1 ) == ':' then
return ':' .. mw.ustring.sub( char, 2, #char );
elseif mw.ustring.sub ( char, 1, 1 ) == ';' then
return ';' .. mw.ustring.sub( char, 2, #char );
000
1:0
Template used on this page:
Return to Module:Char.