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
- SHA1:
3
- metadata.gz: 5f5f1b932d2ff278ac37b5957a18b57d51013345
4
- data.tar.gz: 7502fc93ebe947b1955d478292bf71c7b5dd40c0
2
+ SHA256:
3
+ metadata.gz: 11124a9218699a441e76a217c95fe1753777e96298f8d5ac4839cac9dc766705
4
+ data.tar.gz: bc62cefeb7ffbceae1ddfe3f541a23ab7d7a16307b6666bc3c537fe839cd20c8
5
5
  SHA512:
6
- metadata.gz: 770335f6cd4fbff5a30d6d6ff965ff2148e66543342de66a320583f4f24ec040d341054749c619c7a9ef1491e1e0155158ba63ea407b440406791dec60fc57f2
7
- data.tar.gz: 8e1d9b9a00984309065c1ffc93b7695aafb97d4fbc91c3b6b76d7cc9ee4fe106365b23672f7a87fe0edc97e2612a7d7d3adfe557d5aaa1af4a0c90fb15652717
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 space available
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
- xpath = css_selector_to_xpath(selector)
37
- specificity = calculate_specificity(selector)
38
- specificity << order
39
- order += 1
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
- xpath_styles << [xpath, declarations, specificity]
41
+ xpath_styles << [xpath, declarations, specificity]
42
+ end
42
43
  end
43
44
  end
44
45
 
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module SVG
3
- VERSION = '0.28.0'
3
+ VERSION = '0.29.0'
4
4
  end
5
5
  end
@@ -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 -75 / 0.25
35
- expect(sizing.y_offset).to eq -30
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 800
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.28.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: 2018-07-25 00:00:00.000000000 Z
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.8
254
+ rubygems_version: 2.7.6
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: SVG renderer for Prawn PDF library