Closed emilypries closed 8 years ago
I guess one option is to write a function that scans the input string and looks for [^| ]:
.
outString = ''
isEscapingEmoji = false
for char, i in string:
if isEscapingEmoji:
outString += char
continue
if (i ==0 and char == ':') or (char === ':' and string[i-1] === ' ')
isEscapingEmoji = true
else if isEscapingEmoji and char === ':'
isescapingEmoji = false
else
outString += stringUtils.convert_to_full_width(char)
or something like that. thoughts?
Another option could be to regex match emoji substrings, remove them from the string, convert the entire string, and then re-insert them at the original indexs. this is probably better than writing a parser
Regex match for sure. Alternative to keeping track of original indices (or original indices*space scalar) is to vaporize the longest non-emoji-containing substrings and then just concatenate in order (including non-vaporized emoji substrings).
the neat thing is that we're just converting from halfwidth characters to fullwidth (which gives the impression of the space between the characters), so we don't really need to keep track of index*space scalar, assuming indexing unicode strings in javascript is the same as indexing ascii strings.
Going to sleep now, I may have an initial PR tomorrow depending on how shitpost-y I feel.
Ooh that is neat!
Lack of emoji support makes vaporwave borderline u n u s a b l e for Slack purposes