twemoji 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6d99142db0577c1c16412687c04c81c52d8d4372
4
- data.tar.gz: 9ad40fa9de8509c0a9cff45852f099fe64074b07
2
+ SHA256:
3
+ metadata.gz: d66c0459eba2a74b47f2dc8027c9696e4a19fccbb4e4734340f0f77667da4cd9
4
+ data.tar.gz: 377cdea67fe500c751f9e1cc050706305ff50251d68153074530687b75b36698
5
5
  SHA512:
6
- metadata.gz: 366f5d48207bdd6b49d0c4d653d6f2280c7d79bfeb2ac886ebd98d46f4406263354b9d93fe9672752fffb0b053e7a9a4780b968c88bdf357cc960431e32c88bb
7
- data.tar.gz: be663fad90a83816cbf15ff6d063d598fc2865bd356540361a64da2fd69ac0239da3aaacb566365b2e149d3197dd1dec24e399b94a6e2aa17985fde96fc8358e
6
+ metadata.gz: 6ab7a53adcceda2450fb78793696f7c067274d4fbc756c8f1574bc4739df042d324bece5276ea449bc87fb5cfd154e85efc2b71934c14ef721cda25247291aa6
7
+ data.tar.gz: 29dee191ffe0551c6eccec1c43a194732e3d8f31c5f2e3b7fc3e08f32064068a95caa7fd3bb65224030e59dcc55ff469c363da9fdedc61ea006021dd1de7b40d
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.1.5 - 2019.06.02
6
+
7
+ - Introduced `Twemoji::Utils::Unicode.unpack` [#51](https://github.com/jollygoodcode/twemoji/pull/51)
8
+ - Do not set attribute on generated element if not specified [#49](https://github.com/jollygoodcode/twemoji/pull/49)
9
+
5
10
  ## 3.1.4 - 2017.07.22
6
11
 
7
12
  - Fixes woman skin 6 emoji [#44](https://github.com/jollygoodcode/twemoji/pull/44)
data/README.md CHANGED
@@ -297,7 +297,7 @@ To properly support emoji, the document character must be set to UTF-8. This can
297
297
 
298
298
  ## Attribution Requirements
299
299
 
300
- **IMPORTANT:** Please follow the [Attribution Requirements](https://github.com/twitter/twemoji#attribution-requirements) as stated on the official Twemoji (JS) repo.
300
+ **IMPORTANT:** Please follow the [Attribution Requirements](https://github.com/twitter/twemoji#attribution-requirements) as stated on the official Twemoji (JavaScript) repo.
301
301
 
302
302
  ## Contributing
303
303
 
@@ -5,6 +5,7 @@ require "json"
5
5
  require "twemoji/version"
6
6
  require "twemoji/map"
7
7
  require "twemoji/configuration"
8
+ require "twemoji/utils/unicode"
8
9
 
9
10
  # Twemoji is a Ruby implementation, parses your text, replace emoji text
10
11
  # with corresponding emoji image. Default emoji images are from Twiiter CDN.
@@ -309,7 +310,7 @@ module Twemoji
309
310
  # @return String representation of unicode codepoint
310
311
  # @private
311
312
  def self.unicode_to_str(unicode)
312
- unicode.split("").map { |r| "%x" % r.ord }.join("-")
313
+ Twemoji::Utils::Unicode.unpack(unicode)
313
314
  end
314
315
 
315
316
  # Coverts hash of attributes into HTML attributes.
@@ -318,7 +319,7 @@ module Twemoji
318
319
  # @return [String] HTML attributes suitable for use in tag
319
320
  # @private
320
321
  def self.hash_to_html_attrs(hash)
321
- hash.map { |attr, value| %(#{attr}="#{value}") }.join(" ")
322
+ hash.reject { |key, value| value.nil? || value == '' }.map { |attr, value| %(#{attr}="#{value}") }.join(" ")
322
323
  end
323
324
 
324
325
  # Return sorted codepoint values by descending length.
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Twemoji
4
+ module Utils
5
+ module Unicode
6
+ # Convert raw unicode to string key version.
7
+ #
8
+ # e.g. 🇲🇾 converts to "1f1f2-1f1fe"
9
+ #
10
+ # @param unicode [String] Unicode codepoint.
11
+ # @param connector [String] (optional) connector to join codepoints
12
+ #
13
+ # @return [String] codepoints of unicode join by connector argument, defaults to "-".
14
+ def self.unpack(unicode, connector: "-")
15
+ unicode.split("").map { |r| "%x" % r.ord }.join(connector)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Twemoji
4
- VERSION = "3.1.4"
4
+ VERSION = "3.1.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twemoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juanito
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-24 00:00:00.000000000 Z
12
+ date: 2019-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -49,6 +49,7 @@ files:
49
49
  - lib/twemoji/map.rb
50
50
  - lib/twemoji/png.rb
51
51
  - lib/twemoji/svg.rb
52
+ - lib/twemoji/utils/unicode.rb
52
53
  - lib/twemoji/version.rb
53
54
  - twemoji.gemspec
54
55
  homepage: https://github.com/jollygoodcode/twemoji
@@ -70,8 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
71
  - !ruby/object:Gem::Version
71
72
  version: '0'
72
73
  requirements: []
73
- rubyforge_project:
74
- rubygems_version: 2.6.12
74
+ rubygems_version: 3.0.3
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: 'A RubyGem to convert :heart: to Twitter cdn url'