himg 0.0.2 → 0.0.4
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 +4 -4
- data/.rubocop.yml +20 -0
- data/Appraisals +7 -0
- data/CHANGELOG.md +22 -0
- data/Cargo.lock +1 -1
- data/README.md +42 -14
- data/Rakefile +8 -2
- data/Steepfile +0 -10
- data/ext/himg/Cargo.toml +1 -1
- data/ext/himg/examples/file.rs +2 -1
- data/ext/himg/src/html_to_image.rs +19 -7
- data/ext/himg/src/lib.rs +39 -39
- data/ext/himg/src/options.rs +1 -0
- data/ext/himg/src/renderer.rs +28 -0
- data/ext/himg/src/writer.rs +8 -7
- data/gemfiles/plain_ruby.gemfile +0 -7
- data/gemfiles/plain_ruby.gemfile.lock +10 -21
- data/gemfiles/rails_6.gemfile +0 -6
- data/gemfiles/rails_6.gemfile.lock +18 -28
- data/gemfiles/rails_7_0.gemfile +0 -6
- data/gemfiles/rails_7_0.gemfile.lock +18 -28
- data/gemfiles/rails_7_1.gemfile +0 -6
- data/gemfiles/rails_7_1.gemfile.lock +18 -28
- data/gemfiles/rails_7_2.gemfile +0 -6
- data/gemfiles/rails_7_2.gemfile.lock +18 -28
- data/gemfiles/rails_8.gemfile +0 -6
- data/gemfiles/rails_8.gemfile.lock +18 -28
- data/lib/himg/railtie/template_handler.rb +8 -4
- data/lib/himg/railtie.rb +21 -3
- data/lib/himg/version.rb +1 -1
- data/lib/himg.rb +5 -1
- metadata +12 -26
- data/.standard.yml +0 -3
- data/test.html.rbd +0 -5
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
himg (0.0.
|
4
|
+
himg (0.0.4)
|
5
5
|
rb_sys (~> 0.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -74,10 +74,14 @@ GEM
|
|
74
74
|
base64 (0.2.0)
|
75
75
|
bigdecimal (1.4.4)
|
76
76
|
builder (3.3.0)
|
77
|
+
bump (0.10.0)
|
77
78
|
concurrent-ruby (1.3.4)
|
78
79
|
crass (1.0.6)
|
79
80
|
csv (3.3.4)
|
80
81
|
date (3.4.1)
|
82
|
+
debug (1.10.0)
|
83
|
+
irb (~> 1.10)
|
84
|
+
reline (>= 0.3.8)
|
81
85
|
diff-lcs (1.6.1)
|
82
86
|
drb (2.2.1)
|
83
87
|
erubi (1.13.1)
|
@@ -129,21 +133,21 @@ GEM
|
|
129
133
|
net-smtp (0.5.1)
|
130
134
|
net-protocol
|
131
135
|
nio4r (2.7.4)
|
132
|
-
nokogiri (1.18.
|
136
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
133
137
|
racc (~> 1.4)
|
134
|
-
nokogiri (1.18.
|
138
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
135
139
|
racc (~> 1.4)
|
136
|
-
nokogiri (1.18.
|
140
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
137
141
|
racc (~> 1.4)
|
138
|
-
nokogiri (1.18.
|
142
|
+
nokogiri (1.18.8-arm-linux-musl)
|
139
143
|
racc (~> 1.4)
|
140
|
-
nokogiri (1.18.
|
144
|
+
nokogiri (1.18.8-arm64-darwin)
|
141
145
|
racc (~> 1.4)
|
142
|
-
nokogiri (1.18.
|
146
|
+
nokogiri (1.18.8-x86_64-darwin)
|
143
147
|
racc (~> 1.4)
|
144
|
-
nokogiri (1.18.
|
148
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
145
149
|
racc (~> 1.4)
|
146
|
-
nokogiri (1.18.
|
150
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
147
151
|
racc (~> 1.4)
|
148
152
|
parallel (1.27.0)
|
149
153
|
parser (3.3.8.0)
|
@@ -240,10 +244,6 @@ GEM
|
|
240
244
|
rubocop-ast (1.44.1)
|
241
245
|
parser (>= 3.3.7.2)
|
242
246
|
prism (~> 1.4)
|
243
|
-
rubocop-performance (1.25.0)
|
244
|
-
lint_roller (~> 1.1)
|
245
|
-
rubocop (>= 1.75.0, < 2.0)
|
246
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
247
247
|
ruby-progressbar (1.13.0)
|
248
248
|
securerandom (0.4.1)
|
249
249
|
sprockets (4.2.2)
|
@@ -254,18 +254,6 @@ GEM
|
|
254
254
|
actionpack (>= 6.1)
|
255
255
|
activesupport (>= 6.1)
|
256
256
|
sprockets (>= 3.0.0)
|
257
|
-
standard (1.49.0)
|
258
|
-
language_server-protocol (~> 3.17.0.2)
|
259
|
-
lint_roller (~> 1.0)
|
260
|
-
rubocop (~> 1.75.2)
|
261
|
-
standard-custom (~> 1.0.0)
|
262
|
-
standard-performance (~> 1.8)
|
263
|
-
standard-custom (1.0.2)
|
264
|
-
lint_roller (~> 1.0)
|
265
|
-
rubocop (~> 1.50)
|
266
|
-
standard-performance (1.8.0)
|
267
|
-
lint_roller (~> 1.1)
|
268
|
-
rubocop-performance (~> 1.25.0)
|
269
257
|
steep (1.10.0)
|
270
258
|
activesupport (>= 5.1)
|
271
259
|
concurrent-ruby (>= 1.1.10)
|
@@ -314,16 +302,18 @@ PLATFORMS
|
|
314
302
|
DEPENDENCIES
|
315
303
|
appraisal
|
316
304
|
bigdecimal (~> 1.4)
|
305
|
+
bump
|
317
306
|
concurrent-ruby (= 1.3.4)
|
307
|
+
debug
|
318
308
|
drb
|
319
309
|
himg!
|
320
310
|
irb
|
321
311
|
rails (~> 6.0)
|
322
|
-
rake
|
312
|
+
rake
|
323
313
|
rake-compiler
|
324
|
-
rspec
|
314
|
+
rspec
|
325
315
|
rspec-rails (~> 6.0)
|
326
|
-
|
316
|
+
rubocop
|
327
317
|
steep
|
328
318
|
|
329
319
|
BUNDLED WITH
|
data/gemfiles/rails_7_0.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
himg (0.0.
|
4
|
+
himg (0.0.4)
|
5
5
|
rb_sys (~> 0.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -80,10 +80,14 @@ GEM
|
|
80
80
|
base64 (0.2.0)
|
81
81
|
bigdecimal (1.4.4)
|
82
82
|
builder (3.3.0)
|
83
|
+
bump (0.10.0)
|
83
84
|
concurrent-ruby (1.3.4)
|
84
85
|
crass (1.0.6)
|
85
86
|
csv (3.3.4)
|
86
87
|
date (3.4.1)
|
88
|
+
debug (1.10.0)
|
89
|
+
irb (~> 1.10)
|
90
|
+
reline (>= 0.3.8)
|
87
91
|
diff-lcs (1.6.1)
|
88
92
|
drb (2.2.1)
|
89
93
|
erubi (1.13.1)
|
@@ -135,21 +139,21 @@ GEM
|
|
135
139
|
net-smtp (0.5.1)
|
136
140
|
net-protocol
|
137
141
|
nio4r (2.7.4)
|
138
|
-
nokogiri (1.18.
|
142
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
139
143
|
racc (~> 1.4)
|
140
|
-
nokogiri (1.18.
|
144
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
141
145
|
racc (~> 1.4)
|
142
|
-
nokogiri (1.18.
|
146
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
143
147
|
racc (~> 1.4)
|
144
|
-
nokogiri (1.18.
|
148
|
+
nokogiri (1.18.8-arm-linux-musl)
|
145
149
|
racc (~> 1.4)
|
146
|
-
nokogiri (1.18.
|
150
|
+
nokogiri (1.18.8-arm64-darwin)
|
147
151
|
racc (~> 1.4)
|
148
|
-
nokogiri (1.18.
|
152
|
+
nokogiri (1.18.8-x86_64-darwin)
|
149
153
|
racc (~> 1.4)
|
150
|
-
nokogiri (1.18.
|
154
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
151
155
|
racc (~> 1.4)
|
152
|
-
nokogiri (1.18.
|
156
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
153
157
|
racc (~> 1.4)
|
154
158
|
parallel (1.27.0)
|
155
159
|
parser (3.3.8.0)
|
@@ -246,24 +250,8 @@ GEM
|
|
246
250
|
rubocop-ast (1.44.1)
|
247
251
|
parser (>= 3.3.7.2)
|
248
252
|
prism (~> 1.4)
|
249
|
-
rubocop-performance (1.25.0)
|
250
|
-
lint_roller (~> 1.1)
|
251
|
-
rubocop (>= 1.75.0, < 2.0)
|
252
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
253
253
|
ruby-progressbar (1.13.0)
|
254
254
|
securerandom (0.4.1)
|
255
|
-
standard (1.49.0)
|
256
|
-
language_server-protocol (~> 3.17.0.2)
|
257
|
-
lint_roller (~> 1.0)
|
258
|
-
rubocop (~> 1.75.2)
|
259
|
-
standard-custom (~> 1.0.0)
|
260
|
-
standard-performance (~> 1.8)
|
261
|
-
standard-custom (1.0.2)
|
262
|
-
lint_roller (~> 1.0)
|
263
|
-
rubocop (~> 1.50)
|
264
|
-
standard-performance (1.8.0)
|
265
|
-
lint_roller (~> 1.1)
|
266
|
-
rubocop-performance (~> 1.25.0)
|
267
255
|
steep (1.10.0)
|
268
256
|
activesupport (>= 5.1)
|
269
257
|
concurrent-ruby (>= 1.1.10)
|
@@ -312,16 +300,18 @@ PLATFORMS
|
|
312
300
|
DEPENDENCIES
|
313
301
|
appraisal
|
314
302
|
bigdecimal (~> 1.4)
|
303
|
+
bump
|
315
304
|
concurrent-ruby (= 1.3.4)
|
305
|
+
debug
|
316
306
|
drb
|
317
307
|
himg!
|
318
308
|
irb
|
319
309
|
rails (~> 7.0.0)
|
320
|
-
rake
|
310
|
+
rake
|
321
311
|
rake-compiler
|
322
|
-
rspec
|
312
|
+
rspec
|
323
313
|
rspec-rails (~> 7.0)
|
324
|
-
|
314
|
+
rubocop
|
325
315
|
steep
|
326
316
|
|
327
317
|
BUNDLED WITH
|
data/gemfiles/rails_7_1.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
himg (0.0.
|
4
|
+
himg (0.0.4)
|
5
5
|
rb_sys (~> 0.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -93,11 +93,15 @@ GEM
|
|
93
93
|
benchmark (0.4.0)
|
94
94
|
bigdecimal (3.1.9)
|
95
95
|
builder (3.3.0)
|
96
|
+
bump (0.10.0)
|
96
97
|
concurrent-ruby (1.3.5)
|
97
98
|
connection_pool (2.5.1)
|
98
99
|
crass (1.0.6)
|
99
100
|
csv (3.3.4)
|
100
101
|
date (3.4.1)
|
102
|
+
debug (1.10.0)
|
103
|
+
irb (~> 1.10)
|
104
|
+
reline (>= 0.3.8)
|
101
105
|
diff-lcs (1.6.1)
|
102
106
|
drb (2.2.1)
|
103
107
|
erubi (1.13.1)
|
@@ -148,21 +152,21 @@ GEM
|
|
148
152
|
net-smtp (0.5.1)
|
149
153
|
net-protocol
|
150
154
|
nio4r (2.7.4)
|
151
|
-
nokogiri (1.18.
|
155
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
152
156
|
racc (~> 1.4)
|
153
|
-
nokogiri (1.18.
|
157
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
154
158
|
racc (~> 1.4)
|
155
|
-
nokogiri (1.18.
|
159
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
156
160
|
racc (~> 1.4)
|
157
|
-
nokogiri (1.18.
|
161
|
+
nokogiri (1.18.8-arm-linux-musl)
|
158
162
|
racc (~> 1.4)
|
159
|
-
nokogiri (1.18.
|
163
|
+
nokogiri (1.18.8-arm64-darwin)
|
160
164
|
racc (~> 1.4)
|
161
|
-
nokogiri (1.18.
|
165
|
+
nokogiri (1.18.8-x86_64-darwin)
|
162
166
|
racc (~> 1.4)
|
163
|
-
nokogiri (1.18.
|
167
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
164
168
|
racc (~> 1.4)
|
165
|
-
nokogiri (1.18.
|
169
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
166
170
|
racc (~> 1.4)
|
167
171
|
parallel (1.27.0)
|
168
172
|
parser (3.3.8.0)
|
@@ -265,24 +269,8 @@ GEM
|
|
265
269
|
rubocop-ast (1.44.1)
|
266
270
|
parser (>= 3.3.7.2)
|
267
271
|
prism (~> 1.4)
|
268
|
-
rubocop-performance (1.25.0)
|
269
|
-
lint_roller (~> 1.1)
|
270
|
-
rubocop (>= 1.75.0, < 2.0)
|
271
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
272
272
|
ruby-progressbar (1.13.0)
|
273
273
|
securerandom (0.4.1)
|
274
|
-
standard (1.49.0)
|
275
|
-
language_server-protocol (~> 3.17.0.2)
|
276
|
-
lint_roller (~> 1.0)
|
277
|
-
rubocop (~> 1.75.2)
|
278
|
-
standard-custom (~> 1.0.0)
|
279
|
-
standard-performance (~> 1.8)
|
280
|
-
standard-custom (1.0.2)
|
281
|
-
lint_roller (~> 1.0)
|
282
|
-
rubocop (~> 1.50)
|
283
|
-
standard-performance (1.8.0)
|
284
|
-
lint_roller (~> 1.1)
|
285
|
-
rubocop-performance (~> 1.25.0)
|
286
274
|
steep (1.10.0)
|
287
275
|
activesupport (>= 5.1)
|
288
276
|
concurrent-ruby (>= 1.1.10)
|
@@ -330,14 +318,16 @@ PLATFORMS
|
|
330
318
|
|
331
319
|
DEPENDENCIES
|
332
320
|
appraisal
|
321
|
+
bump
|
322
|
+
debug
|
333
323
|
himg!
|
334
324
|
irb
|
335
325
|
rails (~> 7.1.0)
|
336
|
-
rake
|
326
|
+
rake
|
337
327
|
rake-compiler
|
338
|
-
rspec
|
328
|
+
rspec
|
339
329
|
rspec-rails (~> 7.0)
|
340
|
-
|
330
|
+
rubocop
|
341
331
|
steep
|
342
332
|
|
343
333
|
BUNDLED WITH
|
data/gemfiles/rails_7_2.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
himg (0.0.
|
4
|
+
himg (0.0.4)
|
5
5
|
rb_sys (~> 0.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -87,11 +87,15 @@ GEM
|
|
87
87
|
benchmark (0.4.0)
|
88
88
|
bigdecimal (3.1.9)
|
89
89
|
builder (3.3.0)
|
90
|
+
bump (0.10.0)
|
90
91
|
concurrent-ruby (1.3.5)
|
91
92
|
connection_pool (2.5.1)
|
92
93
|
crass (1.0.6)
|
93
94
|
csv (3.3.4)
|
94
95
|
date (3.4.1)
|
96
|
+
debug (1.10.0)
|
97
|
+
irb (~> 1.10)
|
98
|
+
reline (>= 0.3.8)
|
95
99
|
diff-lcs (1.6.1)
|
96
100
|
drb (2.2.1)
|
97
101
|
erubi (1.13.1)
|
@@ -142,21 +146,21 @@ GEM
|
|
142
146
|
net-smtp (0.5.1)
|
143
147
|
net-protocol
|
144
148
|
nio4r (2.7.4)
|
145
|
-
nokogiri (1.18.
|
149
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
146
150
|
racc (~> 1.4)
|
147
|
-
nokogiri (1.18.
|
151
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
148
152
|
racc (~> 1.4)
|
149
|
-
nokogiri (1.18.
|
153
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
150
154
|
racc (~> 1.4)
|
151
|
-
nokogiri (1.18.
|
155
|
+
nokogiri (1.18.8-arm-linux-musl)
|
152
156
|
racc (~> 1.4)
|
153
|
-
nokogiri (1.18.
|
157
|
+
nokogiri (1.18.8-arm64-darwin)
|
154
158
|
racc (~> 1.4)
|
155
|
-
nokogiri (1.18.
|
159
|
+
nokogiri (1.18.8-x86_64-darwin)
|
156
160
|
racc (~> 1.4)
|
157
|
-
nokogiri (1.18.
|
161
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
158
162
|
racc (~> 1.4)
|
159
|
-
nokogiri (1.18.
|
163
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
160
164
|
racc (~> 1.4)
|
161
165
|
parallel (1.27.0)
|
162
166
|
parser (3.3.8.0)
|
@@ -259,24 +263,8 @@ GEM
|
|
259
263
|
rubocop-ast (1.44.1)
|
260
264
|
parser (>= 3.3.7.2)
|
261
265
|
prism (~> 1.4)
|
262
|
-
rubocop-performance (1.25.0)
|
263
|
-
lint_roller (~> 1.1)
|
264
|
-
rubocop (>= 1.75.0, < 2.0)
|
265
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
266
266
|
ruby-progressbar (1.13.0)
|
267
267
|
securerandom (0.4.1)
|
268
|
-
standard (1.49.0)
|
269
|
-
language_server-protocol (~> 3.17.0.2)
|
270
|
-
lint_roller (~> 1.0)
|
271
|
-
rubocop (~> 1.75.2)
|
272
|
-
standard-custom (~> 1.0.0)
|
273
|
-
standard-performance (~> 1.8)
|
274
|
-
standard-custom (1.0.2)
|
275
|
-
lint_roller (~> 1.0)
|
276
|
-
rubocop (~> 1.50)
|
277
|
-
standard-performance (1.8.0)
|
278
|
-
lint_roller (~> 1.1)
|
279
|
-
rubocop-performance (~> 1.25.0)
|
280
268
|
steep (1.10.0)
|
281
269
|
activesupport (>= 5.1)
|
282
270
|
concurrent-ruby (>= 1.1.10)
|
@@ -325,14 +313,16 @@ PLATFORMS
|
|
325
313
|
|
326
314
|
DEPENDENCIES
|
327
315
|
appraisal
|
316
|
+
bump
|
317
|
+
debug
|
328
318
|
himg!
|
329
319
|
irb
|
330
320
|
rails (~> 7.2.0)
|
331
|
-
rake
|
321
|
+
rake
|
332
322
|
rake-compiler
|
333
|
-
rspec
|
323
|
+
rspec
|
334
324
|
rspec-rails (~> 7.0)
|
335
|
-
|
325
|
+
rubocop
|
336
326
|
steep
|
337
327
|
|
338
328
|
BUNDLED WITH
|
data/gemfiles/rails_8.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
himg (0.0.
|
4
|
+
himg (0.0.4)
|
5
5
|
rb_sys (~> 0.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -87,11 +87,15 @@ GEM
|
|
87
87
|
benchmark (0.4.0)
|
88
88
|
bigdecimal (3.1.9)
|
89
89
|
builder (3.3.0)
|
90
|
+
bump (0.10.0)
|
90
91
|
concurrent-ruby (1.3.5)
|
91
92
|
connection_pool (2.5.1)
|
92
93
|
crass (1.0.6)
|
93
94
|
csv (3.3.4)
|
94
95
|
date (3.4.1)
|
96
|
+
debug (1.10.0)
|
97
|
+
irb (~> 1.10)
|
98
|
+
reline (>= 0.3.8)
|
95
99
|
diff-lcs (1.6.1)
|
96
100
|
drb (2.2.1)
|
97
101
|
erubi (1.13.1)
|
@@ -142,21 +146,21 @@ GEM
|
|
142
146
|
net-smtp (0.5.1)
|
143
147
|
net-protocol
|
144
148
|
nio4r (2.7.4)
|
145
|
-
nokogiri (1.18.
|
149
|
+
nokogiri (1.18.8-aarch64-linux-gnu)
|
146
150
|
racc (~> 1.4)
|
147
|
-
nokogiri (1.18.
|
151
|
+
nokogiri (1.18.8-aarch64-linux-musl)
|
148
152
|
racc (~> 1.4)
|
149
|
-
nokogiri (1.18.
|
153
|
+
nokogiri (1.18.8-arm-linux-gnu)
|
150
154
|
racc (~> 1.4)
|
151
|
-
nokogiri (1.18.
|
155
|
+
nokogiri (1.18.8-arm-linux-musl)
|
152
156
|
racc (~> 1.4)
|
153
|
-
nokogiri (1.18.
|
157
|
+
nokogiri (1.18.8-arm64-darwin)
|
154
158
|
racc (~> 1.4)
|
155
|
-
nokogiri (1.18.
|
159
|
+
nokogiri (1.18.8-x86_64-darwin)
|
156
160
|
racc (~> 1.4)
|
157
|
-
nokogiri (1.18.
|
161
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
158
162
|
racc (~> 1.4)
|
159
|
-
nokogiri (1.18.
|
163
|
+
nokogiri (1.18.8-x86_64-linux-musl)
|
160
164
|
racc (~> 1.4)
|
161
165
|
parallel (1.27.0)
|
162
166
|
parser (3.3.8.0)
|
@@ -259,24 +263,8 @@ GEM
|
|
259
263
|
rubocop-ast (1.44.1)
|
260
264
|
parser (>= 3.3.7.2)
|
261
265
|
prism (~> 1.4)
|
262
|
-
rubocop-performance (1.25.0)
|
263
|
-
lint_roller (~> 1.1)
|
264
|
-
rubocop (>= 1.75.0, < 2.0)
|
265
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
266
266
|
ruby-progressbar (1.13.0)
|
267
267
|
securerandom (0.4.1)
|
268
|
-
standard (1.49.0)
|
269
|
-
language_server-protocol (~> 3.17.0.2)
|
270
|
-
lint_roller (~> 1.0)
|
271
|
-
rubocop (~> 1.75.2)
|
272
|
-
standard-custom (~> 1.0.0)
|
273
|
-
standard-performance (~> 1.8)
|
274
|
-
standard-custom (1.0.2)
|
275
|
-
lint_roller (~> 1.0)
|
276
|
-
rubocop (~> 1.50)
|
277
|
-
standard-performance (1.8.0)
|
278
|
-
lint_roller (~> 1.1)
|
279
|
-
rubocop-performance (~> 1.25.0)
|
280
268
|
steep (1.10.0)
|
281
269
|
activesupport (>= 5.1)
|
282
270
|
concurrent-ruby (>= 1.1.10)
|
@@ -325,14 +313,16 @@ PLATFORMS
|
|
325
313
|
|
326
314
|
DEPENDENCIES
|
327
315
|
appraisal
|
316
|
+
bump
|
317
|
+
debug
|
328
318
|
himg!
|
329
319
|
irb
|
330
320
|
rails (~> 8.0)
|
331
|
-
rake
|
321
|
+
rake
|
332
322
|
rake-compiler
|
333
|
-
rspec
|
323
|
+
rspec
|
334
324
|
rspec-rails (~> 7.0)
|
335
|
-
|
325
|
+
rubocop
|
336
326
|
steep
|
337
327
|
|
338
328
|
BUNDLED WITH
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module Himg
|
2
2
|
class Railtie
|
3
|
+
# Handles .himg templates by calling through to Himg.render
|
3
4
|
class TemplateHandler
|
4
|
-
def self.call(
|
5
|
+
def self.call(_template, source)
|
5
6
|
<<-CODE
|
6
|
-
Himg.render(#{source.inspect})
|
7
|
+
Himg.render(#{source.inspect})
|
7
8
|
CODE
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
12
|
+
# Handles .himg.erb templates by pre-processing with Erb, possibly appending
|
13
|
+
# to @output_buffer or calling .safe_append, and then passing the result to
|
14
|
+
# Himg.render
|
11
15
|
class ErbTemplateHandler
|
12
16
|
def self.call(template, source)
|
13
17
|
erb_handler = ActionView::Template.registered_template_handler(:erb)
|
@@ -17,7 +21,7 @@ module Himg
|
|
17
21
|
output = begin
|
18
22
|
#{preprocessed_view_code}
|
19
23
|
end
|
20
|
-
Himg.render(output)
|
24
|
+
Himg.render(output)
|
21
25
|
CODE
|
22
26
|
end
|
23
27
|
end
|
@@ -25,4 +29,4 @@ module Himg
|
|
25
29
|
end
|
26
30
|
|
27
31
|
ActionView::Template.register_template_handler :himg, Himg::Railtie::TemplateHandler
|
28
|
-
ActionView::Template.register_template_handler
|
32
|
+
ActionView::Template.register_template_handler "himg.erb", Himg::Railtie::ErbTemplateHandler
|
data/lib/himg/railtie.rb
CHANGED
@@ -1,8 +1,26 @@
|
|
1
1
|
module Himg
|
2
|
+
# Himg::Railtie
|
3
|
+
#
|
4
|
+
# Allows you to render Png images directly from rails using HTML based templates.
|
5
|
+
#
|
6
|
+
# View templates can be registered with `.himg` and will be converted from
|
7
|
+
# HTML to an image, or with `.himg.erb` to insert dynamic content. A renderer
|
8
|
+
# also allows direct rendering of HTML without going through a template.
|
9
|
+
#
|
10
|
+
# Example usage:
|
11
|
+
# - `show.himg.erb` renders an image based on controller data.
|
12
|
+
# - `render himg: '<div>My Data</div>'` generates an image from HTML.
|
13
|
+
#
|
14
|
+
# This works by registering a template handler, which will be called by Rails'
|
15
|
+
# default_render method when a view template exists matching the current action
|
16
|
+
# in a request where the format extension is .himg or a png is requested.
|
17
|
+
#
|
18
|
+
# The direct render works similarly, but instead of checking the request format
|
19
|
+
# it looks for the :himg key passed into a Rails render function.
|
2
20
|
class Railtie < Rails::Railtie
|
3
21
|
initializer "himg.configure_rails_initialization" do
|
4
22
|
ActiveSupport.on_load(:action_view) do
|
5
|
-
require
|
23
|
+
require "himg/railtie/template_handler"
|
6
24
|
end
|
7
25
|
end
|
8
26
|
|
@@ -11,9 +29,9 @@ module Himg
|
|
11
29
|
end
|
12
30
|
|
13
31
|
initializer "himg.controller_renderer" do
|
14
|
-
ActionController::Renderers.add :himg do |obj,
|
32
|
+
ActionController::Renderers.add :himg do |obj, _options|
|
15
33
|
png_data = Himg.render(obj)
|
16
|
-
send_data png_data
|
34
|
+
send_data png_data, type: "image/png", disposition: "inline"
|
17
35
|
end
|
18
36
|
end
|
19
37
|
end
|
data/lib/himg/version.rb
CHANGED
data/lib/himg.rb
CHANGED
@@ -16,5 +16,9 @@ end
|
|
16
16
|
#
|
17
17
|
# Converts HTML to an Image for a minimal subset of HTML and CSS
|
18
18
|
module Himg
|
19
|
-
|
19
|
+
class Error < StandardError; end
|
20
|
+
|
21
|
+
def self.render(html, width: 720, height: 405, truncate: true)
|
22
|
+
render_to_string(html, "width" => width, "height" => height, "truncate" => truncate)
|
23
|
+
end
|
20
24
|
end
|