shrugs / V-A-P-O-R-W-A-V-E

:surfer: ALL ABOUT THAT AESTHETIC
MIT License
24 stars 1 forks source link

Feature Request: emoji support #1

Closed emilypries closed 8 years ago

emilypries commented 8 years ago

Lack of emoji support makes vaporwave borderline u n u s a b l e for Slack purposes

shrugs commented 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?

shrugs commented 8 years ago

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

emilypries commented 8 years ago

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).

shrugs commented 8 years ago

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.

emilypries commented 8 years ago

Ooh that is neat!