jemoji 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jemoji.rb +10 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91990a892c727f2bfcc86896ba1e1b933359797e
4
- data.tar.gz: 0eb796bc7e2ff08d0bfdd966cda80b218d788d2b
3
+ metadata.gz: 663ba1344d48de42b117da24d79b0e704fdf101b
4
+ data.tar.gz: 1449d59da2f9d1118d5ba371f3f21f56335f1ca6
5
5
  SHA512:
6
- metadata.gz: d27bb29fa64b66c398fb459615a456ba1bbe208e17921e088b333f17cb08c9b7981f10f93b9ec22338ce3a01f1c8bdcc7a121bd68549353d322b27866c1893b2
7
- data.tar.gz: 776114cace33d8566ca59578e1c664b5e07202d4fce8bf9e99f69680affd539e221b767408e04cfce23d93fc458d3fe261eb937735963b6b5d273c8f0c96e1d2
6
+ metadata.gz: f26f33f454aa288847d00f52117fafc08bd53707cd9af7bb182805b8af6a69fd9f8d556d7f0038606189d62cad8881c53d42f312a264de7c524e5aac6311e5ef
7
+ data.tar.gz: 4f76cade7b1f987455ecfee964ec92223348b07472d2b90d29c6e6904d48e5f88803b534abf95f7ead21e0882a5639ed8927d43fd3a657b5f09b0292eb646f78
@@ -5,11 +5,20 @@ require 'html/pipeline'
5
5
  module Jekyll
6
6
  class Emoji
7
7
  GITHUB_DOT_COM_ASSET_ROOT = "https://assets.github.com/images/icons/".freeze
8
+ BODY_START_TAG = "<body".freeze
8
9
 
9
10
  class << self
10
11
  def emojify(doc)
12
+ return unless doc.output =~ HTML::Pipeline::EmojiFilter.emoji_pattern
11
13
  src = emoji_src(doc.site.config)
12
- doc.output = filter_with_emoji(src).call(doc.output)[:output].to_s
14
+ if doc.output.include? BODY_START_TAG
15
+ parsed_doc = Nokogiri::HTML::Document.parse(doc.output)
16
+ body = parsed_doc.at_css('body')
17
+ body.children = filter_with_emoji(src).call(body.inner_html)[:output].to_s
18
+ doc.output = parsed_doc.to_html
19
+ else
20
+ doc.output = filter_with_emoji(src).call(doc.output)[:output].to_s
21
+ end
13
22
  end
14
23
 
15
24
  # Public: Create or fetch the filter for the given {{src}} asset root.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jemoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll