html-pipeline 1.0.0 → 1.1.0

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
2
  SHA1:
3
- metadata.gz: 398dde5c696c319791f1591c1df00abde348028b
4
- data.tar.gz: 55dc9f47d97a18ab166a5fb6016fb4de28611c13
3
+ metadata.gz: 255c35bcd09c89964eafb3a2f6a6593acc003a9b
4
+ data.tar.gz: b18754600751cf85ed04a96e44fa16a60070604e
5
5
  SHA512:
6
- metadata.gz: c3f317bb8ca4615276a9ea0caf6f5d48e5bb9fd4d92b1dc5073cf65d7601e155d3e8bc55b12339dc4eb30eb8d82defb1fbc6219408987bf2e7ecb2bf55a2e057
7
- data.tar.gz: 8b40cc7d0b8d3bae252d565e7ac929b4b194659ad2d284657db7ee09a98bda81c14b300484f81a65395dca1847ebc7c138e9fc2a9d67dbab81350c7badfc3f6f
6
+ metadata.gz: 00048b649ab9e2514e26215265e9b137d2654096fa68c8a183623cb1270a26288c0d65377a432c9893528d7ff367e35dc2feaeed987bb0c562c28d7d7a8257b2
7
+ data.tar.gz: a8275a10d2ef7dc1dccbcfa454840914519a7e08baef0739de29bd3b9de1e717798dc22330e02cde9b8c46a3d27341d54447e1b4b556c73e3b7b2f906315cbed
data/CHANGELOG.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.1.0
4
+
5
+ * escape emoji filenames in urls #92 jayroh
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  To upgrade to this release, you will need to include separate gems for each of
6
10
  the filters. See [this section of the README](/README.md#dependencies) for
7
11
  details.
8
12
 
9
- * filter dependencies are no longer included #80 from simeonwillbanks/simple-dependency-management
10
- * Add link_attr option to Autolink filter #89 from excid3/master
11
- * Add ActiveSupport back in as dependency for xml-mini #85 from mojavelinux/xml-mini
13
+ * filter dependencies are no longer included #80 from simeonwillbanks/simple-dependency-management
14
+ * Add link_attr option to Autolink filter #89 from excid3/master
15
+ * Add ActiveSupport back in as dependency for xml-mini #85 from mojavelinux/xml-mini
12
16
 
13
17
  ## 0.3.1
14
18
 
@@ -1,3 +1,5 @@
1
+ require "cgi"
2
+
1
3
  begin
2
4
  require "gemoji"
3
5
  rescue LoadError => _
@@ -42,7 +44,7 @@ module HTML
42
44
 
43
45
  text.gsub EmojiPattern do |match|
44
46
  name = $1
45
- "<img class='emoji' title=':#{name}:' alt=':#{name}:' src='#{File.join(asset_root, "emoji", "#{name}.png")}' height='20' width='20' align='absmiddle' />"
47
+ "<img class='emoji' title=':#{name}:' alt=':#{name}:' src='#{emoji_url(name)}' height='20' width='20' align='absmiddle' />"
46
48
  end
47
49
  end
48
50
 
@@ -53,6 +55,12 @@ module HTML
53
55
  def asset_root
54
56
  context[:asset_root]
55
57
  end
58
+
59
+ private
60
+
61
+ def emoji_url(name)
62
+ File.join(asset_root, "emoji", "#{::CGI.escape(name)}.png")
63
+ end
56
64
  end
57
65
  end
58
66
  end
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Pipeline
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -9,10 +9,16 @@ class HTML::Pipeline::EmojiFilterTest < Test::Unit::TestCase
9
9
  assert_match "https://foo.com/emoji/shipit.png", doc.search('img').attr('src').value
10
10
  end
11
11
 
12
+ def test_uri_encoding
13
+ filter = EmojiFilter.new("<p>:+1:</p>", {:asset_root => 'https://foo.com'})
14
+ doc = filter.call
15
+ assert_match "https://foo.com/emoji/%2B1.png", doc.search('img').attr('src').value
16
+ end
17
+
12
18
  def test_required_context_validation
13
19
  exception = assert_raise(ArgumentError) {
14
20
  EmojiFilter.call("", {})
15
21
  }
16
22
  assert_match /:asset_root/, exception.message
17
23
  end
18
- end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-29 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri