Module:String2/sandbox: Difference between revisions

Content deleted Content added
sync
use mw.text.decode
Line 309:
]]
function p.hyphen_to_dash( str )
str = str:gsub mw.text.decode('&[nm]dash;'str, {['–']true = '–', ['—'] = '—'}); -- replace — and –html entities with their characters; semicolon mucks up the text.split
 
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
 
str = str:gsub (' ', ' '); -- replace   entity with generic keyboard space character
local out = {};