prawn-markup 0.3.7 → 1.0.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: 3224b605102e828f529ef5acdd6ba99910237a58e7a609a631c670b1bb025559
4
- data.tar.gz: fc939e927be4748051a2ab4d9f0b8c4155aacd1234c3c7dc41eb1e9861d5533c
3
+ metadata.gz: 7bf5359f2a3cd6a08af1cb55a8f698a0ff16105d27a8de7c1e747f9f2ea521a1
4
+ data.tar.gz: 3bd829e28c2bc4bc079834a9b0a21eb7d93ce57cfd3d511f2e511f2c8bd0cd4a
5
5
  SHA512:
6
- metadata.gz: 5099a48640adb9c06a706cd63bf70767365f74361e1c80dc0501fda5c0e23999d6d7ff1264edfe8aaf45aa05af06dfb285d8d9324f8e6a750b9817184c676dcc
7
- data.tar.gz: b6725ba940801a114a41d3645605406f947c4f6dcb0e35bc7901ee12cc10241591aee889bfae956ab11f26e7a835e45aa5a18395f712748b4cd0d08e14b7c838
6
+ metadata.gz: b0e6c543856fb3fdd86e9d873b093faec9ac91049489512dc16cbc23fee6f77a33b7eff48d152fda4f0d4dd4d12374de05efed01a4e295cf1adccc42a7699280
7
+ data.tar.gz: b5a02c1fa07ad2b2326e981f41b551d7f57b033ac196e94798f9d3250ed9ba76dd889709b77838c0eb8feebb5d7034309a03548ce5b0773d8c04d4c61103d335
data/README.md CHANGED
@@ -46,7 +46,7 @@ This gem parses the given HTML and layouts the following elements in a vertical
46
46
 
47
47
  All other elements are ignored, their content is added to the parent element. With a few exceptions, no CSS is processed. One exception is the `width` property of `img`, `td` and `th`, which may contain values in `cm`, `mm`, `px`, `pt`, `%` or `auto`. Another exception is the `rgb` or `cmyk` properties of the Prawn-specific `color` tag.
48
48
 
49
- If no explicit loader is given (see above), images are loaded from `http(s)` addresses or may be contained in the `src` attribute as base64 encoded data URIs. Prawn only supports `PNG` and `JPG`.
49
+ If no explicit loader is given (see below), images are loaded from `http(s)` addresses or may be contained in the `src` attribute as base64 encoded data URIs. Prawn only supports `PNG` and `JPG`.
50
50
 
51
51
  ## Example
52
52
 
@@ -95,7 +95,7 @@ Beside these options handled by Prawn / prawn-table, the following values may be
95
95
  - `:placeholder`
96
96
  - `:too_large`: If the list content does not fit into the current bounding box, this text/callable is rendered instead. Defaults to '[list content too large]'.
97
97
  - `:image`
98
- - `:loader`: A callable that accepts the `src` attribute as an argument an returns a value understood by Prawn's `image` method. Loads `http(s)` URLs and base64 encoded data URIs by default.
98
+ - `:loader`: A callable that accepts the `src` attribute as an argument an returns a value understood by Prawn's `image` method (e.g. an `IO` object). If no loader is configured or if it returns `nil`, `http(s)` URLs and base64 encoded data URIs are loaded.
99
99
  - `:placeholder`: If an image is not supported, this text/callable is rendered instead. Defaults to '[unsupported image]'.
100
100
  - `:iframe`
101
101
  - `:placeholder`: If the HTML contains IFrames, this text/callable is rendered instead.
@@ -57,10 +57,14 @@ module Prawn
57
57
  end
58
58
 
59
59
  def load_image(src)
60
+ custom_load_image(src) ||
61
+ decode_base64_image(src) ||
62
+ load_remote_image(src)
63
+ end
64
+
65
+ def custom_load_image(src)
60
66
  if options[:image] && options[:image][:loader]
61
67
  options[:image][:loader].call(src)
62
- else
63
- decode_base64_image(src) || load_remote_image(src)
64
68
  end
65
69
  end
66
70
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prawn
4
4
  module Markup
5
- VERSION = '0.3.7'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
data/prawn-markup.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'byebug'
32
+ spec.add_development_dependency 'matrix'
32
33
  spec.add_development_dependency 'pdf-inspector'
33
34
  spec.add_development_dependency 'rake'
34
35
  spec.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Zumkehr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: matrix
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: pdf-inspector
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
216
  - !ruby/object:Gem::Version
203
217
  version: '0'
204
218
  requirements: []
205
- rubygems_version: 3.3.19
219
+ rubygems_version: 3.3.26
206
220
  signing_key:
207
221
  specification_version: 4
208
222
  summary: Parse simple HTML markup to include in Prawn PDFs