auto_html 2.1.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c4554b35676a92a446754ad032d363e1f4be41613ae4923f376ddbb8229a334
4
- data.tar.gz: 32062562a065326482d93d164caa849ff81029eb872ee66d973d435e528f99bb
3
+ metadata.gz: 6549389d8a083211fdc93c7fcdcef5672f2a23e4219c8a0036b0080fb84ac08e
4
+ data.tar.gz: aa24b74473cbd2ffea2d040624d196b200b0f9c7a74b02c2fba9d70b6ee04926
5
5
  SHA512:
6
- metadata.gz: f22718875cce1764c67e795badf8dca2596697d22e9cd3b31d08b71a2abfe0d2b1c726eefee905b263ecf7352cb2e12c5a8aae4fbc1808e1169b45e2f350e3a2
7
- data.tar.gz: ad11106a8df96b900a20df3a0665ec7b9227ba8a92a1728725381d540a11c8df41057dba72feeb9f22fefab82749336038d74c4bd6efa718d263da440eb82452
6
+ metadata.gz: 0fe713ca85d17d9cf8bdb05ac4fc7193c1a734792ee805f19f88a9e3b6eb20151add13223be617a561ae2af8941dccff403233d7690a175fbd7b9cca6394d62d
7
+ data.tar.gz: 806088dee5fac451ef324bf86f16e04f636313eb271c64400d4e2566d337e627026e0e8db71cfdb5d69a125090a6593c16c1b5aa678fdae9fa13cff57fddf0e2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AutoHtml
2
2
 
3
- AutoHtml is a collection of filters that transforms plain text into HTML code. See [live demo](https://autohtml.rors.org).
3
+ AutoHtml is a collection of filters that transforms plain text into HTML code. See [live demo](https://autohtml.makeme.tools).
4
4
 
5
5
  ## Installation
6
6
 
@@ -33,8 +33,8 @@ AutoHtml uses concepts found in "Pipes and Filters" processing design pattern:
33
33
 
34
34
  ```ruby
35
35
  link_filter = AutoHtml::Link.new(target: '_blank')
36
- link_filter.call('Checkout out my blog: http://rors.org')
37
- # => 'Checkout out my blog: <a target="blank" href="http://rors.org">http://rors.org</a>'
36
+ link_filter.call('Checkout out auto_html: https://github.com/dejan/auto_html')
37
+ # => 'Checkout out my blog: <a target="blank" href="https://github.com/dejan/auto_html">https://github.com/dejan/auto_html</a>'
38
38
 
39
39
  emoji_filter = AutoHtml::Emoji.new
40
40
  emoji_filter.call(':point_left: yo!')
@@ -42,14 +42,14 @@ emoji_filter.call(':point_left: yo!')
42
42
 
43
43
  # Use Pipeline to combine filters
44
44
  base_format = AutoHtml::Pipeline.new(link_filter, emoji_filter)
45
- base_format.call('Checkout out my blog: http://rors.org :point_left: yo!')
46
- # => 'Checkout out my blog: <a href="http://rors.org">http://rors.org</a> <img src="/images/emoji/unicode/1f448.png" class="emoji" title=":point_left:" alt=":point_left:" height="20" witdh="20" align="absmiddle" /> yo!'
45
+ base_format.call('Checkout out auto_html: https://github.com/dejan/auto_html :point_left: yo!')
46
+ # => 'Checkout out my blog: <a href="https://github.com/dejan/auto_html">https://github.com/dejan/auto_html</a> <img src="/images/emoji/unicode/1f448.png" class="emoji" title=":point_left:" alt=":point_left:" height="20" witdh="20" align="absmiddle" /> yo!'
47
47
 
48
48
  # A pipeline can be reused in another pipeline. Note that the order of filters is important - ie you want
49
49
  # `Image` before `Link` filter so that URL of the image gets transformed to `img` tag and not `a` tag.
50
50
  comment_format = AutoHtml::Pipeline.new(AutoHtml::Markdown.new, AutoHtml::Image.new, base_format)
51
- comment_format.call("Hello!\n\n Checkout out my blog: http://rors.org :point_left: yo! \n\n http://gifs.joelglovier.com/boom/booyah.gif")
52
- # => "<p>Hello!</p>\n\n<p>Checkout out my blog: <a href="<img src="http://rors.org" target="_blank">http://rors.org</a> <img src="/images/emoji/unicode/1f448.png" />" class="emoji" title=":point_left:" alt=":point_left:" height="20" witdh="20" align="absmiddle" /> yo! </p>\n\n<p><a href="<img src="http://gifs.joelglovier.com/boom/booyah.gif" />" target="_blank"><img src="http://gifs.joelglovier.com/boom/booyah.gif" /></a></p>\n"
51
+ comment_format.call("Hello!\n\n Checkout out auto_html: https://github.com/dejan/auto_html :point_left: yo! \n\n http://gifs.joelglovier.com/boom/booyah.gif")
52
+ # => "<p>Hello!</p>\n\n<p>Checkout out my blog: <a href="<img src="https://github.com/dejan/auto_html" target="_blank">https://github.com/dejan/auto_html</a> <img src="/images/emoji/unicode/1f448.png" />" class="emoji" title=":point_left:" alt=":point_left:" height="20" witdh="20" align="absmiddle" /> yo! </p>\n\n<p><a href="<img src="http://gifs.joelglovier.com/boom/booyah.gif" />" target="_blank"><img src="http://gifs.joelglovier.com/boom/booyah.gif" /></a></p>\n"
53
53
  ```
54
54
 
55
55
  ## Bundled filters
@@ -89,6 +89,26 @@ comment = Comment.new(text: 'Hey!')
89
89
  comment.text_html # => '<p>Hey!</p>'
90
90
  ```
91
91
 
92
+ ## Development
93
+
94
+ ### Install dependencies
95
+
96
+ ```sh
97
+ bundle install
98
+ ```
99
+
100
+ ### Run Rubocop
101
+
102
+ ```sh
103
+ rake rubocop
104
+ ```
105
+
106
+ ### Run tests
107
+
108
+ ```sh
109
+ rake spec
110
+ ```
111
+
92
112
  ## Licence
93
113
 
94
114
  AutoHtml is released under the [MIT License](https://raw.githubusercontent.com/dejan/auto_html/master/MIT-LICENSE).
@@ -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|svg)(\?\S+)?}i
20
+ %r{(?<!src=")https?://.+?\.(jpg|jpeg|bmp|gif|png|svg|webp)(\?\S+)?}i
21
21
  end
22
22
  end
23
23
  end
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe AutoHtml::Image do
6
6
  it 'transforms an image link to image tag' do
7
- result = subject.call('http://rors.org/images/rails.png')
8
- expect(result).to eq('<img src="http://rors.org/images/rails.png" />')
7
+ result = subject.call('https://example.org/images/rails.png')
8
+ expect(result).to eq('<img src="https://example.org/images/rails.png" />')
9
9
  end
10
10
 
11
11
  it 'transforms image link with a param to image tag' do
@@ -30,8 +30,8 @@ RSpec.describe AutoHtml::Image do
30
30
  end
31
31
 
32
32
  it 'transforms an image link within text to image tag' do
33
- result = subject.call('Which do you prefer, this one http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG, or this one http://rors.org/images/rails.png?')
34
- expect(result).to eq('Which do you prefer, this one <img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" />, or this one <img src="http://rors.org/images/rails.png" />?')
33
+ result = subject.call('Which do you prefer, this one http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG, or this one https://example.org/images/rails.png?')
34
+ expect(result).to eq('Which do you prefer, this one <img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" />, or this one <img src="https://example.org/images/rails.png" />?')
35
35
  end
36
36
 
37
37
  it 'transforms an image link with a lot of param to image tag' do
@@ -40,14 +40,14 @@ RSpec.describe AutoHtml::Link do
40
40
 
41
41
  it 'transforms with target options' do
42
42
  filter = described_class.new(target: '_blank')
43
- result = filter.call('http://rors.org')
44
- expect(result).to eq '<a href="http://rors.org" target="_blank">http://rors.org</a>'
43
+ result = filter.call('https://example.org')
44
+ expect(result).to eq '<a href="https://example.org" target="_blank">https://example.org</a>'
45
45
  end
46
46
 
47
47
  it 'transforms with rel options' do
48
48
  filter = described_class.new(rel: 'nofollow')
49
- result = filter.call('http://rors.org')
50
- expect(result).to eq '<a href="http://rors.org" rel="nofollow">http://rors.org</a>'
49
+ result = filter.call('https://example.org')
50
+ expect(result).to eq '<a href="https://example.org" rel="nofollow">https://example.org</a>'
51
51
  end
52
52
 
53
53
  it 'transforms with short_domains options' do
@@ -58,7 +58,7 @@ RSpec.describe AutoHtml::Link do
58
58
 
59
59
  it 'transforms with target and rel options' do
60
60
  filter = described_class.new(target: '_blank', rel: 'nofollow')
61
- result = filter.call('http://rors.org')
62
- expect(result).to eq '<a href="http://rors.org" target="_blank" rel="nofollow">http://rors.org</a>'
61
+ result = filter.call('https://example.org')
62
+ expect(result).to eq '<a href="https://example.org" target="_blank" rel="nofollow">https://example.org</a>'
63
63
  end
64
64
  end
@@ -6,14 +6,14 @@ RSpec.describe AutoHtml::Pipeline do
6
6
  subject { described_class.new(AutoHtml::SimpleFormat.new, AutoHtml::Image.new, AutoHtml::Link.new) }
7
7
 
8
8
  it 'does not transforms input when no filters provided' do
9
- input = 'Hey check out my blog => http://rors.org'
9
+ input = 'Hey check out my blog => https://example.org'
10
10
  result = described_class.new.call(input)
11
11
  expect(result).to eq input
12
12
  end
13
13
 
14
14
  it 'transforms input using provided filters' do
15
- result = subject.call 'Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org'
16
- expect(result).to eq '<p>Check the logo: <img src="http://rors.org/images/rails.png" />. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a></p>'
15
+ result = subject.call 'Check the logo: https://example.org/images/rails.png. Visit: http://rubyonrails.org'
16
+ expect(result).to eq '<p>Check the logo: <img src="https://example.org/images/rails.png" />. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a></p>'
17
17
  end
18
18
 
19
19
  it 'is blank if input is blank' do
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe AutoHtml::SimpleFormat do
6
6
  it 'formats input using simple rules' do
7
- result = subject.call('Hey check out my blog => http://rors.org')
8
- expect(result).to eq '<p>Hey check out my blog => http://rors.org</p>'
7
+ result = subject.call('Hey check out my blog => https://example.org')
8
+ expect(result).to eq '<p>Hey check out my blog => https://example.org</p>'
9
9
 
10
10
  expect(subject.call("crazy\r\n cross\r platform linebreaks")).to eq "<p>crazy\n<br /> cross\n<br /> platform linebreaks</p>"
11
11
  expect(subject.call("A paragraph\n\nand another one!")).to eq "<p>A paragraph</p>\n\n<p>and another one!</p>"
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.1.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dejan Simic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2025-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemoji
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.5
47
+ version: 3.3.9
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.2.5
54
+ version: 3.3.9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rinku
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,62 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 13.0.6
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 13.0.6
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.3'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.3'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec_junit_formatter
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.2'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.2'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.23'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.23'
125
69
  description: Collection of filters for transforming text into HTML code
126
70
  email: desimic@gmail.com
127
71
  executables: []
@@ -153,7 +97,7 @@ licenses:
153
97
  - MIT
154
98
  metadata:
155
99
  rubygems_mfa_required: 'true'
156
- post_install_message:
100
+ post_install_message:
157
101
  rdoc_options: []
158
102
  require_paths:
159
103
  - lib
@@ -168,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
112
  - !ruby/object:Gem::Version
169
113
  version: '0'
170
114
  requirements: []
171
- rubygems_version: 3.2.3
172
- signing_key:
115
+ rubygems_version: 3.5.20
116
+ signing_key:
173
117
  specification_version: 4
174
118
  summary: Plain text to HTML conversion
175
119
  test_files: []