diff --git a/CHANGELOG.md b/CHANGELOG.md index a494bc0..64804b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### 3.8.0 (unreleased) +- Native regexes: Use native Emoji props for Emoji text presentation - Improve documentation and add detailed table about which regex has which features - Add specs running through `emoji-text.txt` and classify qualification statuses per regex diff --git a/data/generate_constants.rb b/data/generate_constants.rb index 34159f8..ecb7759 100644 --- a/data/generate_constants.rb +++ b/data/generate_constants.rb @@ -68,10 +68,10 @@ def pack_and_join(ords) end end -def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_component:, emoji_presentation:, picto:, picto_no_emoji:) +def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_component:, emoji_presentation:, text_presentation:, picto:, picto_no_emoji:) emoji_presentation_sequence = \ join( - pack_and_join(TEXT_PRESENTATION) + pack(EMOJI_VARIATION_SELECTOR), + text_presentation + pack(EMOJI_VARIATION_SELECTOR), emoji_presentation + "(?!" + pack(TEXT_VARIATION_SELECTOR) + ")" + pack(EMOJI_VARIATION_SELECTOR) + "?", ) @@ -83,7 +83,7 @@ def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_compo text_presentation_sequence = \ join( - pack_and_join(TEXT_PRESENTATION)+ "(?!" + join(emoji_modifier, pack(EMOJI_VARIATION_SELECTOR)) + ")" + pack(TEXT_VARIATION_SELECTOR) + "?", + text_presentation + "(?!" + join(emoji_modifier, pack(EMOJI_VARIATION_SELECTOR)) + ")" + pack(TEXT_VARIATION_SELECTOR) + "?", emoji_presentation + pack(TEXT_VARIATION_SELECTOR), ) @@ -246,6 +246,7 @@ def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_compo emoji_modifier_base: pack_and_join(EMOJI_MODIFIER_BASES), emoji_component: pack_and_join(EMOJI_COMPONENT), emoji_presentation: pack_and_join(EMOJI_PRESENTATION), + text_presentation: pack_and_join(TEXT_PRESENTATION), picto: pack_and_join(EXTENDED_PICTOGRAPHIC), picto_no_emoji: pack_and_join(EXTENDED_PICTOGRAPHIC_NO_EMOJI) ) @@ -257,6 +258,7 @@ def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_compo emoji_modifier_base: "\\p{EBase}", emoji_component: "\\p{EComp}", emoji_presentation: "\\p{EPres}", + text_presentation: "\\p{Emoji}(?