prawn-svg 0.28.0 → 0.29.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 11124a9218699a441e76a217c95fe1753777e96298f8d5ac4839cac9dc766705
|
4
|
+
data.tar.gz: bc62cefeb7ffbceae1ddfe3f541a23ab7d7a16307b6666bc3c537fe839cd20c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd293d3c50672c0995c106295d9b83c1106261d02302c6f46a95e3d6f6e1f656685537ba69885aa171f615fb4bf1022f2499cfcf54f1b14588bf5776ca622077
|
7
|
+
data.tar.gz: d4f103286a0090992d8608ff63e671a2879016f3f0f1713588634aba2b2fad6ac67f72b98dfec0d4d7ef737adc83078e36829ebad69e1655f1f2d9c4397dfbd5
|
@@ -36,10 +36,10 @@ module Prawn::SVG::Calculators
|
|
36
36
|
@x_offset, @y_offset, @viewport_width, @viewport_height = values.map {|value| value.to_f}
|
37
37
|
|
38
38
|
if @viewport_width > 0 && @viewport_height > 0
|
39
|
-
# If neither the width nor height was specified, use the entire
|
39
|
+
# If neither the width nor height was specified, use the entire width and the viewbox ratio
|
40
|
+
# to determine the height.
|
40
41
|
if @output_width.nil? && @output_height.nil?
|
41
42
|
@output_width = container_width
|
42
|
-
@output_height = container_height
|
43
43
|
end
|
44
44
|
|
45
45
|
# If one of the output dimensions is missing, calculate it from the other one
|
@@ -32,13 +32,14 @@ module Prawn::SVG::CSS
|
|
32
32
|
rule_set.each_declaration { |*data| declarations << data }
|
33
33
|
|
34
34
|
rule_set.selectors.each do |selector_text|
|
35
|
-
selector = Prawn::SVG::CSS::SelectorParser.parse(selector_text)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
if selector = Prawn::SVG::CSS::SelectorParser.parse(selector_text)
|
36
|
+
xpath = css_selector_to_xpath(selector)
|
37
|
+
specificity = calculate_specificity(selector)
|
38
|
+
specificity << order
|
39
|
+
order += 1
|
40
40
|
|
41
|
-
|
41
|
+
xpath_styles << [xpath, declarations, specificity]
|
42
|
+
end
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
data/lib/prawn/svg/version.rb
CHANGED
@@ -31,8 +31,8 @@ describe Prawn::SVG::Calculators::DocumentSizing do
|
|
31
31
|
describe "#calculate" do
|
32
32
|
it "calculates the document sizing measurements for a given set of inputs" do
|
33
33
|
sizing.calculate
|
34
|
-
expect(sizing.x_offset).to eq
|
35
|
-
expect(sizing.y_offset).to eq
|
34
|
+
expect(sizing.x_offset).to eq(-75 / 0.25)
|
35
|
+
expect(sizing.y_offset).to eq(-30)
|
36
36
|
expect(sizing.x_scale).to eq 0.25
|
37
37
|
expect(sizing.y_scale).to eq 0.25
|
38
38
|
expect(sizing.viewport_width).to eq 300
|
@@ -74,12 +74,12 @@ describe Prawn::SVG::Calculators::DocumentSizing do
|
|
74
74
|
context "when a viewBox is specified" do
|
75
75
|
let(:attributes) { {"viewBox" => "0 0 100 200"} }
|
76
76
|
|
77
|
-
it "defaults to 100% width and height" do
|
77
|
+
it "defaults to 100% width and uses the viewbox ratio for height" do
|
78
78
|
sizing.calculate
|
79
79
|
expect(sizing.viewport_width).to eq 100
|
80
80
|
expect(sizing.viewport_height).to eq 200
|
81
81
|
expect(sizing.output_width).to eq 1200
|
82
|
-
expect(sizing.output_height).to eq
|
82
|
+
expect(sizing.output_height).to eq 2400
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prawn
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
version: '0'
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.6
|
254
|
+
rubygems_version: 2.7.6
|
255
255
|
signing_key:
|
256
256
|
specification_version: 4
|
257
257
|
summary: SVG renderer for Prawn PDF library
|