jemoji 0.0.3 → 0.0.4

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 -18
  3. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3d0dbf1ee5c96ae67ab8a94896e7e9744073713
4
- data.tar.gz: 08bb97a063306db98db09c281c010bbc3f7cfdf2
3
+ metadata.gz: fc0388a3f8a499afea1a950de9647cec225449d6
4
+ data.tar.gz: fc34c19e8e9ba199b7a9b1ff6b3c1c472a35c7b6
5
5
  SHA512:
6
- metadata.gz: de2051fa5df9e251b45eeea9a8c3845f392f156b67ac9f746753672026090921d0f6b43e65cb6d1acf851492975576bd8904e4887598628b95d664e549931e2b
7
- data.tar.gz: ba45a8ac1153c1c57eb8a47a5d1326368c51df6237bc61a43bd998a11ed4698bb0e2556a2e8089250dc6355972858601edd46b432ea6833695d60ab59298fffd
6
+ metadata.gz: 352fbe67d9f95eb5228d4c38471937578518e47f735c21398ebb329fa40d82e4dc0155327c5c7e66cd7ea2bf44726e593069918a29fdc98dab35540e58bb4296
7
+ data.tar.gz: 8224506745f11bbc71f764526bd2912272f34375be51d2c881a956dee785e8a5698e0479eab7ff77430d05392bcdc0d36013af06f1877e343a65479a0ee5411c
data/lib/jemoji.rb CHANGED
@@ -1,26 +1,18 @@
1
1
  require 'jekyll'
2
2
  require 'gemoji'
3
+ require 'html/pipeline'
3
4
 
4
5
  module Jekyll
5
6
  class Jemoji < Jekyll::Generator
7
+
8
+ TAG = "jekyll_jemoji"
9
+
6
10
  def src
7
11
  @src ||=
8
12
  if @site.config.key?("emoji") && @site.config["emoji"].key?("src")
9
13
  @site.config["emoji"]["src"]
10
14
  else
11
- "https://github.global.ssl.fastly.net/images/icons/emoji"
12
- end
13
- end
14
-
15
- def emoji
16
- @emoji ||= Emoji.names
17
- end
18
-
19
- def regex
20
- @regex ||=
21
- begin
22
- emoji_escaped = emoji.map { |emoji| Regexp.escape(emoji) }
23
- Regexp.new ":(#{emoji_escaped.join("|")}):"
15
+ "https://github.global.ssl.fastly.net/images/icons"
24
16
  end
25
17
  end
26
18
 
@@ -31,11 +23,11 @@ module Jekyll
31
23
  end
32
24
 
33
25
  def emojify(page)
34
- page.content.gsub!(regex) { img($1) }
35
- end
36
-
37
- def img(name)
38
- "<img src=\"#{src}/#{name}.png\" alt=\"#{name}\" class=\"emoji\" height=\"20\" />"
26
+ filter = HTML::Pipeline::EmojiFilter.new(
27
+ "<#{TAG}>#{page.content}</#{TAG}>",
28
+ { :asset_root => src }
29
+ )
30
+ page.content = filter.call.search(TAG).children.to_s
39
31
  end
40
32
  end
41
33
  end
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.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-18 00:00:00.000000000 Z
11
+ date: 2014-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: html-pipeline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: ''
42
56
  email: support@github.com
43
57
  executables: []