lib/unicode/emoji.rb in unicode-emoji-2.0.0 vs lib/unicode/emoji.rb in unicode-emoji-2.1.0
- old
+ new
@@ -27,12 +27,13 @@
EMOJI_PRESENTATION = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:P) }.keys.freeze
TEXT_PRESENTATION = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:E) && !props.include?(:P) }.keys.freeze
EMOJI_COMPONENT = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:C) }.keys.freeze
EMOJI_MODIFIER_BASES = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:B) }.keys.freeze
EMOJI_MODIFIERS = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:M) }.keys.freeze
- # Not needed right now:
- # EXTENDED_PICTOGRAPHIC = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) }.keys.freeze
+
+ EXTENDED_PICTOGRAPHIC = INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) }.keys.freeze
+ EXTENDED_PICTOGRAPHIC_NO_EMOJI= INDEX[:PROPERTIES].select{ |ord, props| props.include?(:X) && !props.include?(:E) }.keys.freeze
EMOJI_KEYCAPS = INDEX[:KEYCAPS].freeze
VALID_REGION_FLAGS = INDEX[:FLAGS].freeze
VALID_SUBDIVISIONS = INDEX[:SD].freeze
RECOMMENDED_SUBDIVISION_FLAGS = INDEX[:TAGS].freeze
RECOMMENDED_ZWJ_SEQUENCES = INDEX[:ZWJ].freeze
@@ -51,16 +52,20 @@
emoji_character = "\\p{Emoji}"
emoji_modifier = "\\p{Emoji Modifier}"
emoji_modifier_base = "\\p{Emoji Modifier Base}"
emoji_component = "\\p{Emoji Component}"
emoji_presentation = "\\p{Emoji Presentation}"
+ picto = "\\p{Extended Pictographic}"
+ picto_no_emoji = "\\p{Extended Pictographic}(?<!\\p{Emoji})"
else
emoji_character = pack_and_join[EMOJI_CHAR]
emoji_modifier = pack_and_join[EMOJI_MODIFIERS]
emoji_modifier_base = pack_and_join[EMOJI_MODIFIER_BASES]
emoji_component = pack_and_join[EMOJI_COMPONENT]
emoji_presentation = pack_and_join[EMOJI_PRESENTATION]
+ picto = pack_and_join[EXTENDED_PICTOGRAPHIC]
+ picto_no_emoji = pack_and_join[EXTENDED_PICTOGRAPHIC_NO_EMOJI]
end
emoji_presentation_sequence = \
join[
pack_and_join[TEXT_PRESENTATION] + pack[EMOJI_VARIATION_SELECTOR],
@@ -193,9 +198,17 @@
# Combined REGEXes which also match for TEXTUAL emoji
REGEX_INCLUDE_TEXT = Regexp.union(REGEX, REGEX_TEXT)
REGEX_VALID_INCLUDE_TEXT = Regexp.union(REGEX_VALID, REGEX_TEXT)
REGEX_WELL_FORMED_INCLUDE_TEXT = Regexp.union(REGEX_WELL_FORMED, REGEX_TEXT)
+
+ REGEX_PICTO = Regexp.compile(
+ picto
+ )
+
+ REGEX_PICTO_NO_EMOJI = Regexp.compile(
+ picto_no_emoji
+ )
def self.properties(char)
ord = get_codepoint_value(char)
props = INDEX[:PROPERTIES][ord]