auto_html 2.0.2 → 2.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
  SHA256:
3
- metadata.gz: f0bf51223467c7efbbf7f743e446137634deb7370ecbf73cedbfb8d434bb04f8
4
- data.tar.gz: e5a1b45c89fdc951906e7e80ce9a9c863edeeb0cf7a5707afe2e1b9bffa96292
3
+ metadata.gz: fe9d59c6aaaa2ac3a738aaceeab582872044be2d3983957e6cc3f973023fa10a
4
+ data.tar.gz: 4667fc4cd2183f36a8141446050b8ab31abbbdd6ef06ae8bf547fd75a43660db
5
5
  SHA512:
6
- metadata.gz: 85b635283440e12428cfd5ad9e42fc12a90224a433c3cf31222d7321bfc4bdaffa3c39ace46bfdda54ca87808cae8e4a4a8442694c1f30666469c3017b9cb252
7
- data.tar.gz: '08720ba6a147ab68def101baddf20c7a867ba3edaea3a13ccc6de3ee99e05f34a02f01d10c98d7a8a0e851933af6b117dce774341657002b1a59a34c9dddedff'
6
+ metadata.gz: b091f4972d71693b18ffb2d19ecc9fa9361d4f0787a7a75bc0c9f10aee59b7d3dc346909a741485ef7ce2e82e2c9960e5cc45d8ad38f53a0e4fed8a590bb7f46
7
+ data.tar.gz: 4d79645b12e7ff1e7884f460b36c9d95496698780f2854183afdaa719b585d98f328fdb99355dc08949c7696dfb420195c1113b53e751bf0267f77a291bc2dd3
data/README.md CHANGED
@@ -56,7 +56,7 @@ comment_format.call("Hello!\n\n Checkout out my blog: http://rors.org :point_lef
56
56
 
57
57
  Bellow is the list of bundled filters along with their optional arguments on initialization and their default values.
58
58
 
59
- * `AutoHtml::Emoji`, width: 20, height: 20, asset_root: '/images'
59
+ * `AutoHtml::Emoji`
60
60
  * `AutoHtml::HtmlEscape`
61
61
  * `AutoHtml::Image`, proxy: nil, alt: nil
62
62
  * `AutoHtml::Link`, target: nil, rel: nil
@@ -5,26 +5,10 @@ require 'gemoji'
5
5
  module AutoHtml
6
6
  # Emoji filter
7
7
  class Emoji
8
- def initialize(asset_root: '/images', width: 20, height: 20)
9
- @asset_root = asset_root
10
- @width = width
11
- @height = height
12
- end
13
-
14
8
  def call(text)
15
9
  text.gsub(self.class.emoji_pattern) do
16
10
  name = Regexp.last_match(1)
17
- alt = ":#{name}:"
18
- html_options = {
19
- src: emoji_url(name),
20
- class: 'emoji',
21
- title: alt,
22
- alt: alt,
23
- height: @width,
24
- witdh: @height,
25
- align: 'absmiddle'
26
- }
27
- TagHelper.tag(:img, html_options)
11
+ ::Emoji.find_by_alias(name).raw
28
12
  end
29
13
  end
30
14
 
@@ -36,19 +20,5 @@ module AutoHtml
36
20
  def self.emoji_names
37
21
  ::Emoji.all.map(&:aliases).flatten.sort
38
22
  end
39
-
40
- private
41
-
42
- def emoji_url(name)
43
- File.join(@asset_root, asset_path(name))
44
- end
45
-
46
- def asset_path(name)
47
- File.join('emoji', emoji_filename(name))
48
- end
49
-
50
- def emoji_filename(name)
51
- ::Emoji.find_by_alias(name).image_filename
52
- end
53
23
  end
54
24
  end
@@ -17,7 +17,7 @@ module AutoHtml
17
17
  private
18
18
 
19
19
  def image_pattern
20
- %r{(?<!src=")https?://.+?\.(jpg|jpeg|bmp|gif|png)(\?\S+)?}i
20
+ %r{(?<!src=")https?://.+?\.(jpg|jpeg|bmp|gif|png|svg)(\?\S+)?}i
21
21
  end
22
22
  end
23
23
  end
@@ -4,9 +4,6 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe AutoHtml::Emoji do
6
6
  it 'converts emoji to HTML' do
7
- expect(subject.call(':joy:')).to eq(
8
- '<img src="/images/emoji/unicode/1f602.png" class="emoji" title=":joy:" '\
9
- 'alt=":joy:" height="20" witdh="20" align="absmiddle" />'
10
- )
7
+ expect(subject.call(':joy:')).to eq('😂')
11
8
  end
12
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dejan Simic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2021-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemoji
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
19
+ version: 4.0.0.rc2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.1'
26
+ version: 4.0.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redcarpet
29
29
  requirement: !ruby/object:Gem::Requirement