brakeman 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -0
- data/README.md +1 -1
- data/bundle/load.rb +8 -7
- data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/NEWS.md +25 -0
- data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/parser.rb +15 -5
- data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/Changelog.md +4 -0
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/Gemfile +1 -0
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/list_renderer.rb +2 -2
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/menu.rb +7 -5
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline.rb +17 -12
- data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/NEWS.md +24 -0
- data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/baseparser.rb +29 -8
- data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/rexml.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/source.rb +16 -2
- data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/History.rdoc +6 -0
- data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/lib/ruby2ruby.rb +7 -4
- data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/History.rdoc +7 -0
- data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/cell.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/table.rb +2 -0
- data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/version.rb +1 -1
- data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/terminal-table.gemspec +1 -2
- data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/template.rb +151 -24
- data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt.rb +9 -1
- data/bundle/ruby/3.1.0/gems/{unicode-display_width-2.6.0 → unicode-display_width-3.1.4}/CHANGELOG.md +93 -2
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/README.md +194 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/{unicode-display_width-2.6.0 → unicode-display_width-3.1.4}/lib/unicode/display_width/constants.rb +1 -1
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/emoji_support.rb +52 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/reline_ext.rb +14 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width/string_ext.rb +9 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-3.1.4/lib/unicode/display_width.rb +247 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/CHANGELOG.md +191 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/CODE_OF_CONDUCT.md +74 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/Gemfile +7 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/Gemfile.lock +33 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/MIT-LICENSE.txt +20 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/README.md +205 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/data/emoji.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/data/generate_constants.rb +344 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/constants.rb +49 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_basic.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_emoji_keycap.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_mqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_mqe_uqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_picto.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_picto_no_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_possible.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_component.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_modifier.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_modifier_base.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_prop_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_text_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_valid.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_valid_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_well_formed.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated/regex_well_formed_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_basic.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_emoji_keycap.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_mqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_mqe_uqe.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_picto.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_picto_no_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_possible.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_component.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_emoji.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_modifier.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_modifier_base.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_prop_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_text_presentation.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_valid.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_valid_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_well_formed.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/generated_native/regex_well_formed_include_text.rb +8 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/index.rb +14 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/lazy_constants.rb +56 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji/list.rb +13 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/lib/unicode/emoji.rb +111 -0
- data/bundle/ruby/3.1.0/gems/unicode-emoji-4.0.4/unicode-emoji.gemspec +22 -0
- data/lib/brakeman/app_tree.rb +6 -1
- data/lib/brakeman/checks/check_evaluation.rb +39 -20
- data/lib/brakeman/checks/check_weak_rsa_key.rb +1 -1
- data/lib/brakeman/options.rb +4 -0
- data/lib/brakeman/processors/alias_processor.rb +3 -2
- data/lib/brakeman/scanner.rb +22 -13
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman.rb +7 -0
- metadata +229 -173
- data/bundle/ruby/3.1.0/gems/unicode-display_width-2.6.0/README.md +0 -171
- data/bundle/ruby/3.1.0/gems/unicode-display_width-2.6.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/3.1.0/gems/unicode-display_width-2.6.0/lib/unicode/display_width/string_ext.rb +0 -9
- data/bundle/ruby/3.1.0/gems/unicode-display_width-2.6.0/lib/unicode/display_width.rb +0 -123
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/core_ext/array.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/core_ext/string.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/fields_converter.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/input_record_separator.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/row.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/table.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{csv-3.3.2 → csv-3.3.3}/lib/csv/writer.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/AUTHORS +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/COPYING +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/LICENSE +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/TODO +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/highline.gemspec +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/builtin_styles.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/color_scheme.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/compatibility.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/custom_errors.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/import.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/io_console_compatible.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/list.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/menu/item.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/paginator.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question/answer_converter.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/question_asker.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/simulate.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/statement.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/string.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/string_extensions.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/style.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/template_renderer.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/io_console.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/ncurses.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal/unix_stty.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/terminal.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{highline-3.1.1 → highline-3.1.2}/lib/highline/wrapper.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/attlistdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/attribute.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/cdata.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/child.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/comment.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/doctype.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/document.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/dtd/attlistdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/dtd/dtd.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/dtd/elementdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/dtd/entitydecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/dtd/notationdecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/element.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/encoding.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/entity.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/formatters/default.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/formatters/pretty.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/formatters/transitive.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/functions.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/instruction.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/light/node.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/namespace.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/node.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/output.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parent.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parseexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/lightparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/pullparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/sax2parser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/streamparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/treeparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/ultralightparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/parsers/xpathparser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/quickpath.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/sax2listener.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/security.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/streamlistener.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/text.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/undefinednamespaceexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/validation/relaxng.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/validation/validation.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/validation/validationexception.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/xmldecl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/xmltokens.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/xpath.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml/xpath_parser.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{rexml-3.4.0 → rexml-3.4.1}/lib/rexml.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/Manifest.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{ruby2ruby-2.5.1 → ruby2ruby-2.5.2}/README.rdoc +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/Gemfile +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/Manifest +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/README.md +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/Todo.rdoc +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/import.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/row.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/separator.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/style.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/table_helper.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table/util.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{terminal-table-3.0.2 → terminal-table-4.0.0}/lib/terminal-table.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/COPYING +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/_emacs_org.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/_handlebars.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/_jbuilder.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/_org.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/asciidoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/babel.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/builder.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/cli.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/coffee.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/commonmarker.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/creole.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/csv.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/erb.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/erubi.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/etanni.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/haml.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/kramdown.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/liquid.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/livescript.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/mapping.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/markaby.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/nokogiri.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/pandoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/pipeline.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/plain.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/prawn.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/radius.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/rdiscount.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/rdoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/redcarpet.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/redcloth.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/rst-pandoc.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/sass.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/slim.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/string.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/typescript.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{tilt-2.5.0 → tilt-2.6.0}/lib/tilt/yajl.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{unicode-display_width-2.6.0 → unicode-display_width-3.1.4}/MIT-LICENSE.txt +0 -0
- /data/bundle/ruby/3.1.0/gems/{unicode-display_width-2.6.0 → unicode-display_width-3.1.4}/lib/unicode/display_width/index.rb +0 -0
- /data/bundle/ruby/3.1.0/gems/{unicode-display_width-2.6.0 → unicode-display_width-3.1.4}/lib/unicode/display_width/no_string_ext.rb +0 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
# Unicode::Emoji [![[version]](https://badge.fury.io/rb/unicode-emoji.svg)](https://badge.fury.io/rb/unicode-emoji) [![[ci]](https://github.com/janlelis/unicode-emoji/workflows/Test/badge.svg)](https://github.com/janlelis/unicode-emoji/actions?query=workflow%3ATest)
|
2
|
+
|
3
|
+
Provides various sophisticated regular expressions to work with Emoji in strings,
|
4
|
+
incorporating the latest Unicode / Emoji standards.
|
5
|
+
|
6
|
+
Additional features:
|
7
|
+
|
8
|
+
- A categorized list of Emoji (RGI: Recommended for General Interchange)
|
9
|
+
- Retrieve Emoji properties info about specific codepoints (Emoji_Modifier, Emoji_Presentation, etc.)
|
10
|
+
|
11
|
+
Emoji version: **16.0** (September 2024)
|
12
|
+
|
13
|
+
CLDR version (used for sub-region flags): **46** (October 2024)
|
14
|
+
|
15
|
+
## Gemfile
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem "unicode-emoji"
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage – Regex Matching
|
22
|
+
|
23
|
+
The gem includes multiple Emoji regexes, which are compiled out of various Emoji Unicode data sources.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "unicode/emoji"
|
27
|
+
|
28
|
+
string = "String which contains all types of Emoji sequences:
|
29
|
+
|
30
|
+
- Basic Emoji: 😴
|
31
|
+
- Textual Emoji with Emoji variation (VS16): ▶️
|
32
|
+
- Emoji with skin tone modifier: 🛌🏽
|
33
|
+
- Region flag: 🇵🇹
|
34
|
+
- Sub-Region flag: 🏴
|
35
|
+
- Keycap sequence: 2️⃣
|
36
|
+
- Skin tone modifier: 🏻
|
37
|
+
- Sequence using ZWJ (zero width joiner): 🤾🏽♀️
|
38
|
+
"
|
39
|
+
|
40
|
+
string.scan(Unicode::Emoji::REGEX) # => ["😴", "▶️", "🛌🏽", "🇵🇹", "🏴", "2️⃣", "🏻", "🤾🏽♀️"]
|
41
|
+
```
|
42
|
+
|
43
|
+
Depending on your exact usecase, you can choose between multiple levels of Emoji detection:
|
44
|
+
|
45
|
+
### Main Regexes
|
46
|
+
|
47
|
+
Regex | Description | Example Matches | Example Non-Matches
|
48
|
+
------------------------------|-------------|-----------------|--------------------
|
49
|
+
`Unicode::Emoji::REGEX` | **Use this one if unsure!** Matches (non-textual) Basic Emoji and all kinds of *recommended* Emoji sequences (RGI/FQE) | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🤾🏽♀️`, `🏻` | `🤾🏽♀`, `🏌♂️`, `😴︎`, `▶`, `🇵🇵`, `🏴`, `🤠🤢`, `1`, `1⃣`
|
50
|
+
`Unicode::Emoji::REGEX_VALID` | Matches (non-textual) Basic Emoji and all kinds of *valid* Emoji sequences | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀` ,`🏌♂️`, `🤠🤢`, `🏻` | `😴︎`, `▶`, `🇵🇵`, `1`, `1⃣`
|
51
|
+
`Unicode::Emoji::REGEX_WELL_FORMED` | Matches (non-textual) Basic Emoji and all kinds of *well-formed* Emoji sequences | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`,`🏌♂️` , `🤠🤢`, `🇵🇵`, `🏻` | `😴︎`, `▶`, `1`, `1⃣`
|
52
|
+
`Unicode::Emoji::REGEX_POSSIBLE` | Matches all singleton Emoji, all kinds of Emoji sequences, and even non-Emoji singleton components like digits. Only exception: Unqualified keycap sequences are not matched | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🤠🤢`, `🇵🇵`, `😴︎`, `▶`, `🏻`, `1` | `1⃣`
|
53
|
+
|
54
|
+
#### Include Text Emoji
|
55
|
+
|
56
|
+
By default, textual Emoji (emoji characters with text variation selector or those that have a default text presentation) will not be included in the default regexes (except in `REGEX_POSSIBLE`). However, if you wish to match for them too, you can include them in your regex by appending the `_INCLUDE_TEXT` suffix:
|
57
|
+
|
58
|
+
Regex | Description | Example Matches | Example Non-Matches
|
59
|
+
------------------------------|-------------|-----------------|--------------------
|
60
|
+
`Unicode::Emoji::REGEX_INCLUDE_TEXT` | `REGEX` + `REGEX_TEXT` | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🤾🏽♀️`, `😴︎`, `▶`, `1⃣` , `🏻`| `🤾🏽♀`, `🏌♂️`, `🇵🇵`, `🏴`, `🤠🤢`, `1`
|
61
|
+
`Unicode::Emoji::REGEX_VALID_INCLUDE_TEXT` | `REGEX_VALID` + `REGEX_TEXT` | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🤠🤢`, `😴︎`, `▶`, `1⃣` , `🏻` | `🇵🇵`, `1`
|
62
|
+
`Unicode::Emoji::REGEX_WELL_FORMED_INCLUDE_TEXT` | `REGEX_WELL_FORMED` + `REGEX_TEXT` | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🤠🤢`, `🇵🇵`, `😴︎`, `▶`, `1⃣` , `🏻` | `1`
|
63
|
+
|
64
|
+
#### Minimally-qualified and Unqualified Sequences
|
65
|
+
|
66
|
+
Regex | Description | Example Matches | Example Non-Matches
|
67
|
+
------------------------------|-------------|-----------------|--------------------
|
68
|
+
`Unicode::Emoji::REGEX_INCLUDE_MQE` | Like `REGEX`, but additionally includes Emoji with missing Emoji Presentation Variation Selectors, where the first partial Emoji has all required Variation Selectors | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏻` | `🏌♂️`, `😴︎`, `▶`, `🇵🇵`, `🏴`, `🤠🤢`, `1`, `1⃣`
|
69
|
+
`Unicode::Emoji::REGEX_INCLUDE_MQE_UQE` | Like `REGEX`, but additionally includes Emoji with missing Emoji Presentation Variation Selectors | `😴`, `▶️`, `🛌🏽`, `🇵🇹`, `2️⃣`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🏻` | `😴︎`, `▶`, `🇵🇵`, `🏴`, `🤠🤢`, `1`, `1⃣`
|
70
|
+
|
71
|
+
[List of MQE and UQE Emoji sequences](https://character.construction/unqualified-emoji)
|
72
|
+
|
73
|
+
#### Singleton Regexes
|
74
|
+
|
75
|
+
Matches only simple one-codepoint (+ optional variation selector) Emoji:
|
76
|
+
|
77
|
+
Regex | Description | Example Matches | Example Non-Matches
|
78
|
+
------------------------------|-------------|-----------------|--------------------
|
79
|
+
`Unicode::Emoji::REGEX_BASIC` | Matches (non-textual) Basic Emoji, but no sequences at all | `😴`, `▶️`, `🏻` | `😴︎`, `▶`, `🛌🏽`, `🇵🇹`, `🇵🇵`,`2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🤠🤢`, `1`
|
80
|
+
`Unicode::Emoji::REGEX_TEXT` | Matches only textual singleton Emoji | `😴︎`, `▶` | `😴`, `▶️`, `🏻`, `🛌🏽`, `🇵🇹`, `🇵🇵`,`2️⃣`, `🏴`, `🏴`, `🤾🏽♀️`, `🤾🏽♀`, `🏌♂️`, `🤠🤢`, `1`
|
81
|
+
|
82
|
+
Here is a list of all Emoji that can be matched using the two regexes: [character.construction/emoji-vs-text](https://character.construction/emoji-vs-text). The `REGEX_BASIC` regex also matches [visual Emoji components](https://character.construction/emoji-components) (skin tone modifiers and hair components).
|
83
|
+
|
84
|
+
While `REGEX_BASIC` is part of the above regexes, `REGEX_TEXT` is only included in the `*_INCLUDE_TEXT` or `*_UQE` variants.
|
85
|
+
|
86
|
+
### Comparison
|
87
|
+
|
88
|
+
1) Fully-qualified RGI Emoji ZWJ sequence
|
89
|
+
2) Minimally-qualified RGI Emoji ZWJ sequence (lacks Emoji Presentation Selectors, but not in the first Emoji character)
|
90
|
+
3) Unqualified RGI Emoji ZWJ sequence (lacks Emoji Presentation Selector, including in the first Emoji character). Unqualified Emoji include all basic Emoji in Text Presentation (see column 11/12).
|
91
|
+
4) Non-RGI Emoji ZWJ sequence
|
92
|
+
5) Valid Region made from a pair of Regional Indicators
|
93
|
+
6) Any Region made from a pair of Regional Indicators
|
94
|
+
7) RGI Flag Emoji Tag Sequences (England, Scotland, Wales)
|
95
|
+
8) Valid Flag Emoji Tag Sequences (any known subdivision)
|
96
|
+
9) Any Emoji Tag Sequences (any tag sequence with any base)
|
97
|
+
10) Basic Default Emoji Presentation Characters or Text characters with Emoji Presentation Selector
|
98
|
+
11) Basic Default Text Presentation Characters or Basic Emoji with Text Presentation Selector
|
99
|
+
12) Non-Emoji (unqualified) keycap
|
100
|
+
|
101
|
+
Regex | 1 RGI/FQE | 2 RGI/MQE | 3 RGI/UQE | 4 Non-RGI | 5 Valid Region | 6 Any Region | 7 RGI Tag | 8 Valid Tag | 9 Any Tag | 10 Basic Emoji | 11 Basic Text | 12 Text Keycap
|
102
|
+
-|-|-|-|-|-|-|-|-|-|-|-|-
|
103
|
+
REGEX | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌
|
104
|
+
REGEX INCLUDE TEXT | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅
|
105
|
+
REGEX INCLUDE MQE | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌
|
106
|
+
REGEX INCLUDE MQE UQE | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅
|
107
|
+
REGEX VALID | ✅ | ✅ | (✅)¹ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | ❌ | ❌
|
108
|
+
REGEX VALID INCLUDE TEXT | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅
|
109
|
+
REGEX WELL FORMED | ✅ | ✅ | (✅)¹ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌
|
110
|
+
REGEX WELL FORMED INCLUDE TEXT | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
|
111
|
+
REGEX POSSIBLE | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌
|
112
|
+
REGEX BASIC | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌
|
113
|
+
REGEX TEXT | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅
|
114
|
+
|
115
|
+
¹ Matches all unqualified Emoji, except for textual singleton Emoji (see columns 11, 12)
|
116
|
+
|
117
|
+
See [spec files](/spec) for detailed examples about which regex matches which kind of Emoji.
|
118
|
+
|
119
|
+
### Picking the Right Emoji Regex
|
120
|
+
|
121
|
+
- Usually you just want `REGEX` (recommended Emoji set, RGI)
|
122
|
+
- Use `REGEX_INCLUDE_MQE` or `REGEX_INCLUDE_MQE_UQE` if you want to catch Emoji sequences with missing Variation Selectors.
|
123
|
+
- If you want broader matching (any ZWJ sequences, more sub-region flags), choose `REGEX_VALID`
|
124
|
+
- If you need to match any region flag and any tag sequence, choose `REGEX_WELL_FORMED`
|
125
|
+
- Use the `_INCLUDE_TEXT` suffix with any of the above base regexes, if you want to also match basic textual Emoji
|
126
|
+
- And finally, there is also the option to use `REGEX_POSSIBLE`, which is a simplified test for possible Emoji, comparable to `REGEX_WELL_FORMED*`. It might contain false positives, however, the regex is less complex and [suggested in the Unicode standard itself](https://www.unicode.org/reports/tr51/#EBNF_and_Regex) as a first check.
|
127
|
+
|
128
|
+
### Examples
|
129
|
+
|
130
|
+
Desc | Emoji | Escaped | `REGEX` (RGI/FQE) | `REGEX_INCLUDE_MQE` (RGI/MQE) | `REGEX_VALID` | `REGEX_WELL_FORMED` / `REGEX_POSSIBLE`
|
131
|
+
-----|-------|---------|---------------|-----------------------|-----------------------------------|-----------------
|
132
|
+
RGI ZWJ Sequence | 🤾🏽♀️ | `\u{1F93E 1F3FD 200D 2640 FE0F}` | ✅ | ✅ | ✅ | ✅
|
133
|
+
RGI ZWJ Sequence MQE | 🤾🏽♀ | `\u{1F93E 1F3FD 200D 2640}` | ❌ | ✅ | ✅ | ✅
|
134
|
+
Valid ZWJ Sequence, Non-RGI | 🤠🤢 | `\u{1F920 200D 1F922}` | ❌ | ❌ | ✅ | ✅
|
135
|
+
Known Region | 🇵🇹 | `\u{1F1F5 1F1F9}` | ✅ | ✅ | ✅ | ✅
|
136
|
+
Unknown Region | 🇵🇵 | `\u{1F1F5 1F1F5}` | ❌ | ❌ | ❌ | ✅
|
137
|
+
RGI Tag Sequence | 🏴 | `\u{1F3F4 E0067 E0062 E0073 E0063 E0074 E007F}` | ✅ | ✅ | ✅ | ✅
|
138
|
+
Valid Tag Sequence | 🏴 | `\u{1F3F4 E0067 E0062 E0061 E0067 E0062 E007F}` | ❌ | ❌ | ✅ | ✅
|
139
|
+
Well-formed Tag Sequence | 😴 | `\u{1F634 E0067 E0062 E0061 E0061 E0061 E007F}` | ❌ | ❌ | ❌ | ✅
|
140
|
+
|
141
|
+
Please see [the standard](https://www.unicode.org/reports/tr51/#Emoji_Sets) for more details, examples, explanations.
|
142
|
+
|
143
|
+
More info about valid vs. recommended Emoji can also be found in this [blog article on Emojipedia](https://blog.emojipedia.org/unicode-behind-the-curtain/).
|
144
|
+
|
145
|
+
### Emoji Property Regexes
|
146
|
+
|
147
|
+
Ruby includes native regex Emoji properties, as listed in the following table. You can also opt-in to use the `*_PROP_*` regexes to get the Emoji support level of this gem (instead of Ruby's).
|
148
|
+
|
149
|
+
Gem Regex (`Unicode::Emoji`'s Emoji support level) | Native Regex (Ruby's Emoji support level)
|
150
|
+
---------------------------------------------------|------------------------------------------
|
151
|
+
`Unicode::Emoji::REGEX_PROP_EMOJI` | `/\p{Emoji}/`
|
152
|
+
`Unicode::Emoji::REGEX_PROP_MODIFIER` | `/\p{EMod}/`
|
153
|
+
`Unicode::Emoji::REGEX_PROP_MODIFIER_BASE` | `/\p{EBase}/`
|
154
|
+
`Unicode::Emoji::REGEX_PROP_COMPONENT` | `/\p{EComp}/`
|
155
|
+
`Unicode::Emoji::REGEX_PROP_PRESENTATION` | `/\p{EPres}/`
|
156
|
+
`Unicode::Emoji::REGEX_TEXT_PRESENTATION` | `/[\p{Emoji}&&\P{EPres}]/`
|
157
|
+
|
158
|
+
#### Extended Pictographic Regex
|
159
|
+
|
160
|
+
`Unicode::Emoji::REGEX_PICTO` matches single codepoints with the **Extended_Pictographic** property. For example, it will match `✀` BLACK SAFETY SCISSORS.
|
161
|
+
|
162
|
+
`Unicode::Emoji::REGEX_PICTO_NO_EMOJI` matches single codepoints with the **Extended_Pictographic** property, but excludes Emoji characters.
|
163
|
+
|
164
|
+
See [character.construction/picto](https://character.construction/picto) for a list of all non-Emoji pictographic characters.
|
165
|
+
|
166
|
+
## Usage – List
|
167
|
+
|
168
|
+
Use `Unicode::Emoji::LIST` or the **list** method to get a ordered and categorized list of Emoji:
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
Unicode::Emoji.list.keys
|
172
|
+
# => ["Smileys & Emotion", "People & Body", "Component", "Animals & Nature", "Food & Drink", "Travel & Places", "Activities", "Objects", "Symbols", "Flags"]
|
173
|
+
|
174
|
+
Unicode::Emoji.list("Food & Drink").keys
|
175
|
+
# => ["food-fruit", "food-vegetable", "food-prepared", "food-asian", "food-marine", "food-sweet", "drink", "dishware"]
|
176
|
+
|
177
|
+
Unicode::Emoji.list("Food & Drink", "food-asian")
|
178
|
+
=> ["🍱", "🍘", "🍙", "🍚", "🍛", "🍜", "🍝", "🍠", "🍢", "🍣", "🍤", "🍥", "🥮", "🍡", "🥟", "🥠", "🥡"]
|
179
|
+
```
|
180
|
+
|
181
|
+
Please note that categories might change with future versions of the Emoji standard, although this has not happened often.
|
182
|
+
|
183
|
+
A list of all Emoji (generated from this gem) can be found at [character.construction/emoji](https://character.construction/emoji).
|
184
|
+
|
185
|
+
## Usage – Properties Data
|
186
|
+
|
187
|
+
Allows you to access the codepoint data for a single character form Unicode's [emoji-data.txt](https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-data.txt) file:
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
require "unicode/emoji"
|
191
|
+
|
192
|
+
Unicode::Emoji.properties "☝" # => ["Emoji", "Emoji_Modifier_Base"]
|
193
|
+
```
|
194
|
+
|
195
|
+
## Also See
|
196
|
+
|
197
|
+
- [Unicode® Technical Standard #51](https://www.unicode.org/reports/tr51/)
|
198
|
+
- [Emoji categories](https://unicode.org/emoji/charts/emoji-ordering.html)
|
199
|
+
- Ruby gem which displays [Emoji sequence names](https://github.com/janlelis/unicode-sequence_name) ([as website](https://character.construction/name))
|
200
|
+
- Part of [unicode-x](https://github.com/janlelis/unicode-x)
|
201
|
+
|
202
|
+
## MIT
|
203
|
+
|
204
|
+
- Copyright (C) 2017-2024 Jan Lelis <https://janlelis.com>. Released under the MIT license.
|
205
|
+
- Unicode data: https://www.unicode.org/copyright.html#Exhibit1
|
Binary file
|
@@ -0,0 +1,344 @@
|
|
1
|
+
require_relative '../lib/unicode/emoji/constants'
|
2
|
+
require_relative '../lib/unicode/emoji/index'
|
3
|
+
require_relative '../lib/unicode/emoji/lazy_constants'
|
4
|
+
|
5
|
+
include Unicode::Emoji
|
6
|
+
|
7
|
+
def write_regexes(regexes, dirpath)
|
8
|
+
regexes.each do |const_name, regex|
|
9
|
+
write_regex(const_name, regex, dirpath)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def write_regex(const_name, regex, dirpath)
|
14
|
+
filename = const_name.to_s.downcase
|
15
|
+
filepath = File.join(dirpath, "#{filename}.rb")
|
16
|
+
|
17
|
+
File.write(filepath, <<~CONTENT)
|
18
|
+
# This file was generated by a script, please do not edit it by hand.
|
19
|
+
# See `$ rake generate_constants` and data/generate_constants.rb for more info.
|
20
|
+
|
21
|
+
module Unicode
|
22
|
+
module Emoji
|
23
|
+
#{const_name} = #{regex.inspect}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
CONTENT
|
27
|
+
puts "#{const_name} written to #{filepath}"
|
28
|
+
end
|
29
|
+
|
30
|
+
# Converts [1, 2, 3, 5, 6, 20, 21, 22, 23, 100] (it does not need to be sorted) to [[1, 2, 3], [5, 6], [20, 21, 22, 23], [100]]
|
31
|
+
def groupify(arr)
|
32
|
+
arr = arr.sort
|
33
|
+
prev = nil
|
34
|
+
arr.slice_before do |el|
|
35
|
+
(prev.nil? || el != prev + 1).tap { prev = el }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Converts [1, 2, 3, 5, 6, 20, 21, 22, 23, 100] (it does not need to be sorted) to [1..3, 5, 6, 20..23, 100]
|
40
|
+
def rangify(arr)
|
41
|
+
groupify(arr).map do |group|
|
42
|
+
group.size < 3 ? group : Range.new(group.first, group.last)
|
43
|
+
end.flatten
|
44
|
+
end
|
45
|
+
|
46
|
+
def pack(ord)
|
47
|
+
Regexp.escape(Array(ord).pack("U*"))
|
48
|
+
end
|
49
|
+
|
50
|
+
def join(*strings)
|
51
|
+
"(?:" + strings.join("|") + ")"
|
52
|
+
end
|
53
|
+
|
54
|
+
def character_class(ords_with_ranges)
|
55
|
+
"[" + ords_with_ranges.map{ |ord_or_range|
|
56
|
+
ord_or_range.is_a?(Range) ?
|
57
|
+
pack(ord_or_range.first) + "-" + pack(ord_or_range.last) :
|
58
|
+
pack(ord_or_range)
|
59
|
+
}.join +
|
60
|
+
"]"
|
61
|
+
end
|
62
|
+
|
63
|
+
def pack_and_join(ords)
|
64
|
+
if ords.any? { |e| e.is_a?(Array) }
|
65
|
+
join(*ords.map { |ord| pack(ord) })
|
66
|
+
else
|
67
|
+
character_class(rangify(ords))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_component:, emoji_presentation:, text_presentation:, picto:, picto_no_emoji:)
|
72
|
+
visual_component = pack_and_join(VISUAL_COMPONENT)
|
73
|
+
|
74
|
+
emoji_presentation_sequence = \
|
75
|
+
join(
|
76
|
+
text_presentation + pack(EMOJI_VARIATION_SELECTOR),
|
77
|
+
emoji_presentation + "(?!" + pack(TEXT_VARIATION_SELECTOR) + ")" + pack(EMOJI_VARIATION_SELECTOR) + "?",
|
78
|
+
)
|
79
|
+
|
80
|
+
non_component_emoji_presentation_sequence = \
|
81
|
+
"(?!" + emoji_component + ")" + emoji_presentation_sequence
|
82
|
+
|
83
|
+
basic_emoji = \
|
84
|
+
join(
|
85
|
+
non_component_emoji_presentation_sequence,
|
86
|
+
visual_component,
|
87
|
+
)
|
88
|
+
|
89
|
+
text_keycap_sequence = \
|
90
|
+
pack_and_join(EMOJI_KEYCAPS) + pack(EMOJI_KEYCAP_SUFFIX)
|
91
|
+
|
92
|
+
text_presentation_sequence = \
|
93
|
+
join(
|
94
|
+
text_presentation + "(?!" + join(emoji_modifier, pack(EMOJI_VARIATION_SELECTOR)) + ")" + pack(TEXT_VARIATION_SELECTOR) + "?",
|
95
|
+
emoji_presentation + pack(TEXT_VARIATION_SELECTOR),
|
96
|
+
)
|
97
|
+
|
98
|
+
text_emoji = \
|
99
|
+
join(
|
100
|
+
"(?!" + emoji_component + ")" + text_presentation_sequence,
|
101
|
+
text_keycap_sequence,
|
102
|
+
)
|
103
|
+
|
104
|
+
emoji_modifier_sequence = \
|
105
|
+
emoji_modifier_base + emoji_modifier
|
106
|
+
|
107
|
+
emoji_keycap_sequence = \
|
108
|
+
pack_and_join(EMOJI_KEYCAPS) + pack([EMOJI_VARIATION_SELECTOR, EMOJI_KEYCAP_SUFFIX])
|
109
|
+
|
110
|
+
emoji_valid_flag_sequence = \
|
111
|
+
pack_and_join(VALID_REGION_FLAGS)
|
112
|
+
|
113
|
+
emoji_well_formed_flag_sequence = \
|
114
|
+
'\p{RI}{2}'
|
115
|
+
|
116
|
+
emoji_core_sequence = \
|
117
|
+
join(
|
118
|
+
emoji_keycap_sequence,
|
119
|
+
emoji_modifier_sequence,
|
120
|
+
non_component_emoji_presentation_sequence,
|
121
|
+
)
|
122
|
+
|
123
|
+
# Sort to make sure complex sequences match first
|
124
|
+
emoji_rgi_tag_sequence = \
|
125
|
+
pack_and_join(RECOMMENDED_SUBDIVISION_FLAGS.sort_by(&:length).reverse)
|
126
|
+
|
127
|
+
emoji_valid_tag_sequence = \
|
128
|
+
"(?:" +
|
129
|
+
pack(EMOJI_TAG_BASE_FLAG) +
|
130
|
+
"(?:" + VALID_SUBDIVISIONS.sort_by(&:length).reverse.map{ |sd|
|
131
|
+
sd.tr("\u{30}-\u{39}\u{61}-\u{7A}", "\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}")
|
132
|
+
}.join("|") + ")" +
|
133
|
+
pack(CANCEL_TAG) +
|
134
|
+
")"
|
135
|
+
|
136
|
+
emoji_well_formed_tag_sequence = \
|
137
|
+
"(?:" +
|
138
|
+
join(
|
139
|
+
non_component_emoji_presentation_sequence,
|
140
|
+
emoji_modifier_sequence,
|
141
|
+
) +
|
142
|
+
pack_and_join(SPEC_TAGS) + "{1,30}" +
|
143
|
+
pack(CANCEL_TAG) +
|
144
|
+
")"
|
145
|
+
|
146
|
+
# Sort to make sure complex sequences match first
|
147
|
+
emoji_rgi_zwj_sequence = \
|
148
|
+
pack_and_join(RECOMMENDED_ZWJ_SEQUENCES.sort_by(&:length).reverse)
|
149
|
+
|
150
|
+
# FQE+MQE: Make VS16 optional after ZWJ has appeared
|
151
|
+
emoji_rgi_include_mqe_zwj_sequence = emoji_rgi_zwj_sequence.gsub(
|
152
|
+
/#{ pack(ZWJ) }[^|]+?\K#{ pack(EMOJI_VARIATION_SELECTOR) }/,
|
153
|
+
pack(EMOJI_VARIATION_SELECTOR) + "?"
|
154
|
+
)
|
155
|
+
|
156
|
+
# FQE+MQE+UQE: Make all VS16 optional
|
157
|
+
emoji_rgi_include_mqe_uqe_zwj_sequence = emoji_rgi_zwj_sequence.gsub(
|
158
|
+
pack(EMOJI_VARIATION_SELECTOR),
|
159
|
+
pack(EMOJI_VARIATION_SELECTOR) + "?",
|
160
|
+
)
|
161
|
+
|
162
|
+
emoji_valid_zwj_element = \
|
163
|
+
join(
|
164
|
+
emoji_modifier_sequence,
|
165
|
+
emoji_presentation_sequence,
|
166
|
+
emoji_character,
|
167
|
+
)
|
168
|
+
|
169
|
+
emoji_valid_zwj_sequence = \
|
170
|
+
"(?:" +
|
171
|
+
"(?:" + emoji_valid_zwj_element + pack(ZWJ) + ")+" + emoji_valid_zwj_element +
|
172
|
+
")"
|
173
|
+
|
174
|
+
emoji_rgi_sequence = \
|
175
|
+
join(
|
176
|
+
emoji_rgi_zwj_sequence,
|
177
|
+
emoji_rgi_tag_sequence,
|
178
|
+
emoji_valid_flag_sequence,
|
179
|
+
emoji_core_sequence,
|
180
|
+
visual_component,
|
181
|
+
)
|
182
|
+
|
183
|
+
emoji_rgi_sequence_include_text = \
|
184
|
+
join(
|
185
|
+
emoji_rgi_zwj_sequence,
|
186
|
+
emoji_rgi_tag_sequence,
|
187
|
+
emoji_valid_flag_sequence,
|
188
|
+
emoji_core_sequence,
|
189
|
+
visual_component,
|
190
|
+
text_emoji,
|
191
|
+
)
|
192
|
+
|
193
|
+
emoji_rgi_include_mqe_sequence = \
|
194
|
+
join(
|
195
|
+
emoji_rgi_include_mqe_zwj_sequence,
|
196
|
+
emoji_rgi_tag_sequence,
|
197
|
+
emoji_valid_flag_sequence,
|
198
|
+
emoji_core_sequence,
|
199
|
+
visual_component,
|
200
|
+
)
|
201
|
+
|
202
|
+
emoji_rgi_include_mqe_uqe_sequence = \
|
203
|
+
join(
|
204
|
+
emoji_rgi_include_mqe_uqe_zwj_sequence,
|
205
|
+
text_emoji, # also uqe
|
206
|
+
emoji_rgi_tag_sequence,
|
207
|
+
emoji_valid_flag_sequence,
|
208
|
+
emoji_core_sequence,
|
209
|
+
visual_component,
|
210
|
+
)
|
211
|
+
|
212
|
+
emoji_valid_sequence = \
|
213
|
+
join(
|
214
|
+
emoji_valid_zwj_sequence,
|
215
|
+
emoji_valid_tag_sequence,
|
216
|
+
emoji_valid_flag_sequence,
|
217
|
+
emoji_core_sequence,
|
218
|
+
visual_component,
|
219
|
+
)
|
220
|
+
|
221
|
+
emoji_valid_sequence_include_text = \
|
222
|
+
join(
|
223
|
+
emoji_valid_zwj_sequence,
|
224
|
+
emoji_valid_tag_sequence,
|
225
|
+
emoji_valid_flag_sequence,
|
226
|
+
emoji_core_sequence,
|
227
|
+
visual_component,
|
228
|
+
text_emoji,
|
229
|
+
)
|
230
|
+
|
231
|
+
emoji_well_formed_sequence = \
|
232
|
+
join(
|
233
|
+
emoji_valid_zwj_sequence,
|
234
|
+
emoji_well_formed_tag_sequence,
|
235
|
+
emoji_well_formed_flag_sequence,
|
236
|
+
emoji_core_sequence,
|
237
|
+
visual_component,
|
238
|
+
)
|
239
|
+
|
240
|
+
emoji_well_formed_sequence_include_text = \
|
241
|
+
join(
|
242
|
+
emoji_valid_zwj_sequence,
|
243
|
+
emoji_well_formed_tag_sequence,
|
244
|
+
emoji_well_formed_flag_sequence,
|
245
|
+
emoji_core_sequence,
|
246
|
+
visual_component,
|
247
|
+
text_emoji,
|
248
|
+
)
|
249
|
+
|
250
|
+
emoji_possible_modification = \
|
251
|
+
join(
|
252
|
+
emoji_modifier,
|
253
|
+
pack([EMOJI_VARIATION_SELECTOR, EMOJI_KEYCAP_SUFFIX]) + "?",
|
254
|
+
"[-]+" # raw tags
|
255
|
+
)
|
256
|
+
|
257
|
+
emoji_possible_zwj_element = \
|
258
|
+
join(
|
259
|
+
emoji_well_formed_flag_sequence,
|
260
|
+
emoji_character + emoji_possible_modification + "?"
|
261
|
+
)
|
262
|
+
|
263
|
+
emoji_possible = \
|
264
|
+
emoji_possible_zwj_element + "(?:" + pack(ZWJ) + emoji_possible_zwj_element + ")*"
|
265
|
+
|
266
|
+
regexes = {}
|
267
|
+
|
268
|
+
# Matches basic singleton emoji and all kind of sequences, but restrict zwj and tag sequences to known sequences (rgi)
|
269
|
+
regexes[:REGEX] = Regexp.compile(emoji_rgi_sequence)
|
270
|
+
|
271
|
+
# rgi + singleton text
|
272
|
+
regexes[:REGEX_INCLUDE_TEXT] = Regexp.compile(emoji_rgi_sequence_include_text)
|
273
|
+
|
274
|
+
# Matches basic singleton emoji and all kind of sequences, but restrict zwj and tag sequences to known sequences (rgi)
|
275
|
+
# Also make VS16 optional if not at first emoji character
|
276
|
+
regexes[:REGEX_INCLUDE_MQE] = Regexp.compile(emoji_rgi_include_mqe_sequence)
|
277
|
+
|
278
|
+
# Matches basic singleton emoji and all kind of sequences, but restrict zwj and tag sequences to known sequences (rgi)
|
279
|
+
# Also make VS16 optional even at first emoji character
|
280
|
+
regexes[:REGEX_INCLUDE_MQE_UQE] = Regexp.compile(emoji_rgi_include_mqe_uqe_sequence)
|
281
|
+
|
282
|
+
# Matches basic singleton emoji and all kind of valid sequences
|
283
|
+
regexes[:REGEX_VALID] = Regexp.compile(emoji_valid_sequence)
|
284
|
+
|
285
|
+
# valid + singleton text
|
286
|
+
regexes[:REGEX_VALID_INCLUDE_TEXT] = Regexp.compile(emoji_valid_sequence_include_text)
|
287
|
+
|
288
|
+
# Matches basic singleton emoji and all kind of sequences
|
289
|
+
regexes[:REGEX_WELL_FORMED] = Regexp.compile(emoji_well_formed_sequence)
|
290
|
+
|
291
|
+
# well-formed + singleton text
|
292
|
+
regexes[:REGEX_WELL_FORMED_INCLUDE_TEXT] = Regexp.compile(emoji_well_formed_sequence_include_text)
|
293
|
+
|
294
|
+
# Quick test which might lead to false positves
|
295
|
+
# See https://www.unicode.org/reports/tr51/#EBNF_and_Regex
|
296
|
+
regexes[:REGEX_POSSIBLE] = Regexp.compile(emoji_possible)
|
297
|
+
|
298
|
+
# Matches only basic single, non-textual emoji, ignores some components like simple digits
|
299
|
+
regexes[:REGEX_BASIC] = Regexp.compile(basic_emoji)
|
300
|
+
|
301
|
+
# Matches only basic single, textual emoji, ignores components like modifiers or simple digits
|
302
|
+
regexes[:REGEX_TEXT] = Regexp.compile(text_emoji)
|
303
|
+
regexes[:REGEX_TEXT_PRESENTATION] = Regexp.compile(text_presentation)
|
304
|
+
|
305
|
+
# Export regexes for Emoji properties so they can be used with newer Unicode than Ruby's
|
306
|
+
regexes[:REGEX_PROP_EMOJI] = Regexp.compile(emoji_character)
|
307
|
+
regexes[:REGEX_PROP_MODIFIER] = Regexp.compile(emoji_modifier)
|
308
|
+
regexes[:REGEX_PROP_MODIFIER_BASE] = Regexp.compile(emoji_modifier_base)
|
309
|
+
regexes[:REGEX_PROP_COMPONENT] = Regexp.compile(emoji_component)
|
310
|
+
regexes[:REGEX_PROP_PRESENTATION] = Regexp.compile(emoji_presentation)
|
311
|
+
|
312
|
+
# Same goes for ExtendedPictographic
|
313
|
+
regexes[:REGEX_PICTO] = Regexp.compile(picto)
|
314
|
+
regexes[:REGEX_PICTO_NO_EMOJI] = Regexp.compile(picto_no_emoji)
|
315
|
+
|
316
|
+
# Emoji keycaps
|
317
|
+
regexes[:REGEX_EMOJI_KEYCAP] = Regexp.compile(emoji_keycap_sequence)
|
318
|
+
|
319
|
+
regexes
|
320
|
+
end
|
321
|
+
|
322
|
+
regexes = compile(
|
323
|
+
emoji_character: pack_and_join(EMOJI_CHAR),
|
324
|
+
emoji_modifier: pack_and_join(EMOJI_MODIFIERS),
|
325
|
+
emoji_modifier_base: pack_and_join(EMOJI_MODIFIER_BASES),
|
326
|
+
emoji_component: pack_and_join(EMOJI_COMPONENT),
|
327
|
+
emoji_presentation: pack_and_join(EMOJI_PRESENTATION),
|
328
|
+
text_presentation: pack_and_join(TEXT_PRESENTATION),
|
329
|
+
picto: pack_and_join(EXTENDED_PICTOGRAPHIC),
|
330
|
+
picto_no_emoji: pack_and_join(EXTENDED_PICTOGRAPHIC_NO_EMOJI)
|
331
|
+
)
|
332
|
+
write_regexes(regexes, File.expand_path("../lib/unicode/emoji/generated", __dir__))
|
333
|
+
|
334
|
+
native_regexes = compile(
|
335
|
+
emoji_character: "\\p{Emoji}",
|
336
|
+
emoji_modifier: "\\p{EMod}",
|
337
|
+
emoji_modifier_base: "\\p{EBase}",
|
338
|
+
emoji_component: "\\p{EComp}",
|
339
|
+
emoji_presentation: "\\p{EPres}",
|
340
|
+
text_presentation: "[\\p{Emoji}&&\\P{EPres}]",
|
341
|
+
picto: "\\p{ExtPict}",
|
342
|
+
picto_no_emoji: "[\\p{ExtPict}&&\\P{Emoji}]"
|
343
|
+
)
|
344
|
+
write_regexes(native_regexes, File.expand_path("../lib/unicode/emoji/generated_native", __dir__))
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unicode
|
4
|
+
module Emoji
|
5
|
+
VERSION = "4.0.4"
|
6
|
+
EMOJI_VERSION = "16.0"
|
7
|
+
CLDR_VERSION = "46"
|
8
|
+
DATA_DIRECTORY = File.expand_path('../../../data', __dir__).freeze
|
9
|
+
INDEX_FILENAME = (DATA_DIRECTORY + "/emoji.marshal.gz").freeze
|
10
|
+
|
11
|
+
# Unicode properties, see https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-data.txt
|
12
|
+
PROPERTY_NAMES = {
|
13
|
+
E: "Emoji",
|
14
|
+
B: "Emoji_Modifier_Base",
|
15
|
+
M: "Emoji_Modifier",
|
16
|
+
C: "Emoji_Component",
|
17
|
+
P: "Emoji_Presentation",
|
18
|
+
X: "Extended_Pictographic",
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
# Variation Selector 16 (VS16), enables emoji presentation mode for preceding codepoint
|
22
|
+
EMOJI_VARIATION_SELECTOR = 0xFE0F
|
23
|
+
|
24
|
+
# Variation Selector 15 (VS15), enables text presentation mode for preceding codepoint
|
25
|
+
TEXT_VARIATION_SELECTOR = 0xFE0E
|
26
|
+
|
27
|
+
# First codepoint of tag-based subdivision flags
|
28
|
+
EMOJI_TAG_BASE_FLAG = 0x1F3F4
|
29
|
+
|
30
|
+
# Last codepoint of tag-based subdivision flags
|
31
|
+
CANCEL_TAG = 0xE007F
|
32
|
+
|
33
|
+
# Tags characters allowed in tag-based subdivision flags
|
34
|
+
SPEC_TAGS = [*0xE0030..0xE0039, *0xE0061..0xE007A].freeze
|
35
|
+
|
36
|
+
# Combining Enclosing Keycap character
|
37
|
+
EMOJI_KEYCAP_SUFFIX = 0x20E3
|
38
|
+
|
39
|
+
# Zero-width-joiner to enable combination of multiple Emoji in a sequence
|
40
|
+
ZWJ = 0x200D
|
41
|
+
|
42
|
+
# Two regional indicators make up a region
|
43
|
+
REGIONAL_INDICATORS = [*0x1F1E6..0x1F1FF].freeze
|
44
|
+
|
45
|
+
# The current list of Emoji components that should have a visual representation
|
46
|
+
# Currently skin tone modifiers + hair components
|
47
|
+
VISUAL_COMPONENT = [*0x1F3FB..0x1F3FF, *0x1F9B0..0x1F9B3].freeze
|
48
|
+
end
|
49
|
+
end
|