-- This module converts support characters from half-width to full-width, and vice versa.-- See [[Halfwidth and fullwidth forms]] for an explanation of half- and full-width characters.-- @todo FIXME: Needs more characters adding, needs support for diacritic marks.localdata=mw.loadData('Module:Convert character width/data')localp={}-- Converts one half-width character to one full-width character.localfunctiongetFull(s)returndata[s]orsend-- Converts one full-width character to one half-width character.localfunctiongetHalf(s)forhalf,fullinpairs(data)doifs==fullthenreturnhalfendendreturnsend-- Converts multiple half-width characters to full-width characters.functionp.full(frame)locals=type(frame)=='table'andframe.argsandframe.args[1]orframes=type(s)=='number'andtostring(s)orsiftype(s)~='string'thenreturnendreturn(mw.ustring.gsub(s,'.',getFull))end-- Converts multiple full-width characters to half-width characters.functionp.half(frame)locals=type(frame)=='table'andframe.argsandframe.args[1]orframes=type(s)=='number'andtostring(s)orsiftype(s)~='string'thenreturnendreturn(mw.ustring.gsub(s,'.',getHalf))endreturnp