@@ -9,12 +9,8 @@ module EmojiTestParser
99 "\u{1F3FE} " , # medium-dark skin tone
1010 "\u{1F3FF} " , # dark skin tone
1111 ]
12- HAIR_MODIFIERS = [
13- "\u{1F9B0} " , # red-haired
14- "\u{1F9B1} " , # curly-haired
15- "\u{1F9B2} " , # bald
16- "\u{1F9B3} " , # white-haired
17- ]
12+ SKIN_TONES_RE = /(#{ SKIN_TONES . join ( "|" ) } )/o
13+ SKIP_TYPES = [ "unqualified" , "component" ]
1814
1915 module_function
2016
@@ -52,12 +48,12 @@ def parse_file(io)
5248 else
5349 row , desc = line . split ( "#" , 2 )
5450 desc = desc . strip . split ( " " , 2 ) [ 1 ]
55- codepoints , _ = row . split ( ";" , 2 )
51+ codepoints , qualification = row . split ( ";" , 2 )
52+ next if SKIP_TYPES . include? ( qualification . strip )
5653 emoji_raw = codepoints . strip . split . map { |c | c . hex } . pack ( "U*" )
57- next if HAIR_MODIFIERS . include? ( emoji_raw )
5854 emoji_normalized = emoji_raw
5955 . gsub ( VARIATION_SELECTOR_16 , "" )
60- . gsub ( /( #{ SKIN_TONES . join ( "|" ) } )/o , "" )
56+ . gsub ( SKIN_TONES_RE , "" )
6157 emoji_item = emoji_map [ emoji_normalized ]
6258 if SKIN_TONES . any? { |s | emoji_raw . include? ( s ) }
6359 emoji_item [ :skin_tones ] = true if emoji_item
@@ -91,7 +87,7 @@ def parse_file(io)
9187 html_output = true
9288 end
9389
94- _ , categories = EmojiTestParser . parse
90+ _ , categories = EmojiTestParser . parse ( File . expand_path ( "../../vendor/unicode-emoji-test.txt" , __FILE__ ) )
9591
9692 trap ( :PIPE ) { abort }
9793
0 commit comments