prawn-markup 0.2.0 → 0.2.1

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: b195d6ff3dfeacfc8e8112f17323bfdc8981b955a994862d9609b07184dd229f
4
- data.tar.gz: 33113b2d2db4aedae4eb7c412f65d7d2400d89f4dc94f30d9f4a700ea6598164
3
+ metadata.gz: f381738eb8b0791ae8943bce4028ca3578249aa25269d887f3953e6de2ed0075
4
+ data.tar.gz: 45fd2e6656f9b50a2a3bc40ac67ed52dae462d134a4aa201e3459d00d10226ac
5
5
  SHA512:
6
- metadata.gz: 912de36400986c54d00f4ca94fa5e37207236e79152490370278f2c11895da5e75041b1bd528e6c179c11b145723a7ee1a4fdee8da05f384f4054d711a589117
7
- data.tar.gz: 3f03640c1d82f6a46f2d5c74e9fcb8ff16287a0b83ad6a6e273f55ba03f2d4a716e0a549e7e6c9b64551062522e04ae2108678b048163fb21b5554a327c6b6fa
6
+ metadata.gz: 14b1b72017fe9fb5b2ed0b0529eb8026203c21a7ec653ec50d25f1cd20533dd72827f97b27f5eff711f08c64b8d6b971105931e3fb645eb0c0a5e8e7ac45c2b0
7
+ data.tar.gz: f6f8a9a2cdebceece5946f31780d918d63981ff9ad0de5d5db5ecf8e20dc02df26fb2b27da46f98ec50b9c13ef1e4c82017d52f9549dec4229a07e61dbeba4f1
data/.rubocop.yml CHANGED
@@ -62,3 +62,7 @@ Layout/EmptyLinesAroundModuleBody:
62
62
  # We think that's the developers choice
63
63
  Style/GuardClause:
64
64
  Enabled: false
65
+
66
+ # Backwards compatibility
67
+ Style/SafeNavigation:
68
+ Enabled: false
data/.travis.yml CHANGED
@@ -9,7 +9,9 @@ env:
9
9
  global:
10
10
  - CC_TEST_REPORTER_ID=d70fe39ffb8f2f7c5f837f0133d10a3a1c6784d0dd189153111577b60f74c603
11
11
 
12
- before_install: gem install bundler
12
+ before_install:
13
+ - gem update --system
14
+ - gem install bundler
13
15
 
14
16
  before_script:
15
17
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in prawn-markup.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prawn-markup (0.2.0)
4
+ prawn-markup (0.2.1)
5
5
  nokogiri
6
6
  prawn
7
7
  prawn-table
@@ -12,22 +12,22 @@ GEM
12
12
  Ascii85 (1.0.3)
13
13
  afm (0.2.2)
14
14
  ast (2.4.0)
15
- byebug (10.0.2)
15
+ byebug (11.0.1)
16
16
  diff-lcs (1.3)
17
17
  docile (1.3.2)
18
18
  hashery (2.1.2)
19
- jaro_winkler (1.5.3)
19
+ jaro_winkler (1.5.4)
20
20
  json (2.2.0)
21
21
  mini_portile2 (2.4.0)
22
- nokogiri (1.9.1)
22
+ nokogiri (1.10.5)
23
23
  mini_portile2 (~> 2.4.0)
24
- parallel (1.17.0)
25
- parser (2.6.3.0)
24
+ parallel (1.19.1)
25
+ parser (2.6.5.0)
26
26
  ast (~> 2.4.0)
27
27
  pdf-core (0.7.0)
28
28
  pdf-inspector (1.3.0)
29
29
  pdf-reader (>= 1.0, < 3.0.a)
30
- pdf-reader (2.2.0)
30
+ pdf-reader (2.4.0)
31
31
  Ascii85 (~> 1.0.0)
32
32
  afm (~> 0.2.1)
33
33
  hashery (~> 2.0)
@@ -39,36 +39,36 @@ GEM
39
39
  prawn-table (0.2.2)
40
40
  prawn (>= 1.3.0, < 3.0.0)
41
41
  rainbow (3.0.0)
42
- rake (12.3.2)
43
- rspec (3.8.0)
44
- rspec-core (~> 3.8.0)
45
- rspec-expectations (~> 3.8.0)
46
- rspec-mocks (~> 3.8.0)
47
- rspec-core (3.8.2)
48
- rspec-support (~> 3.8.0)
49
- rspec-expectations (3.8.4)
42
+ rake (13.0.1)
43
+ rspec (3.9.0)
44
+ rspec-core (~> 3.9.0)
45
+ rspec-expectations (~> 3.9.0)
46
+ rspec-mocks (~> 3.9.0)
47
+ rspec-core (3.9.0)
48
+ rspec-support (~> 3.9.0)
49
+ rspec-expectations (3.9.0)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.8.0)
52
- rspec-mocks (3.8.1)
51
+ rspec-support (~> 3.9.0)
52
+ rspec-mocks (3.9.0)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.8.0)
55
- rspec-support (3.8.2)
56
- rubocop (0.68.1)
54
+ rspec-support (~> 3.9.0)
55
+ rspec-support (3.9.0)
56
+ rubocop (0.77.0)
57
57
  jaro_winkler (~> 1.5.1)
58
58
  parallel (~> 1.10)
59
- parser (>= 2.5, != 2.5.1.1)
59
+ parser (>= 2.6)
60
60
  rainbow (>= 2.2.2, < 4.0)
61
61
  ruby-progressbar (~> 1.7)
62
- unicode-display_width (>= 1.4.0, < 1.6)
62
+ unicode-display_width (>= 1.4.0, < 1.7)
63
63
  ruby-progressbar (1.10.1)
64
64
  ruby-rc4 (0.1.5)
65
- simplecov (0.17.0)
65
+ simplecov (0.17.1)
66
66
  docile (~> 1.1)
67
67
  json (>= 1.8, < 3)
68
68
  simplecov-html (~> 0.10.0)
69
69
  simplecov-html (0.10.2)
70
70
  ttfunk (1.5.1)
71
- unicode-display_width (1.5.0)
71
+ unicode-display_width (1.6.0)
72
72
 
73
73
  PLATFORMS
74
74
  ruby
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'prawn/markup'
data/lib/prawn/markup.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'prawn'
2
4
  require 'prawn/measurement_extensions'
3
5
  require 'prawn/table'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Builders
4
6
  class ListBuilder < NestableBuilder
5
- BULLET_CHAR = '•'.freeze
7
+ BULLET_CHAR = '•'
6
8
  BULLET_MARGIN = 10
7
9
  CONTENT_MARGIN = 10
8
10
  VERTICAL_MARGIN = 5
@@ -65,7 +67,7 @@ module Prawn
65
67
  data = item.nodes.map { |n| [normalize_list_item_node(n)] }
66
68
  style = column_cell_style(:content)
67
69
  .merge(borders: [], padding: [0, 0, padding_bottom, 0])
68
- pdf.make_table(data, cell_style: style) do
70
+ pdf.make_table(data, cell_style: style, column_widths: [content_width]) do
69
71
  rows(-1).padding = [0, 0, 0, 0]
70
72
  end
71
73
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Builders
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Builders
@@ -169,7 +171,7 @@ module Prawn
169
171
 
170
172
  def distribute_remaing_width(count)
171
173
  equal_width = (total_width - column_width_sum) / count.to_f
172
- return if equal_width < 0
174
+ return if equal_width.negative?
173
175
 
174
176
  column_widths.map! { |width| width || equal_width }
175
177
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Elements
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Elements
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Elements
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Interface
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  # Processes known HTML tags. Unknown tags are ignored.
@@ -78,7 +80,7 @@ module Prawn
78
80
 
79
81
  def reset
80
82
  @stack = []
81
- @text_buffer = ''
83
+ @text_buffer = +''
82
84
  end
83
85
 
84
86
  def append_text(string)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Processor::Blocks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Processor::Headings
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open-uri'
2
4
 
3
5
  module Prawn
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Processor::Lists
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Processor::Tables
@@ -26,19 +28,29 @@ module Prawn
26
28
  end
27
29
 
28
30
  def start_tr
31
+ return unless current_table
32
+
29
33
  current_table << []
30
34
  end
31
35
 
32
36
  def start_td
37
+ return unless current_table
38
+
33
39
  current_table.last << Elements::Cell.new(width: style_properties['width'])
34
40
  end
35
41
 
36
42
  def start_th
43
+ return unless current_table
44
+
37
45
  current_table.last << Elements::Cell.new(width: style_properties['width'], header: true)
38
46
  end
39
47
 
40
48
  def end_td
41
- add_cell_text_node(current_cell)
49
+ if current_table
50
+ add_cell_text_node(current_cell)
51
+ else
52
+ add_current_text
53
+ end
42
54
  end
43
55
  alias end_th end_td
44
56
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module Processor::Text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  module HashMerger
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  # Normalizes HTML markup:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
5
  class SizeConverter
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Prawn
2
4
  module Markup
3
- VERSION = '0.2.0'.freeze
5
+ VERSION = '0.2.1'
4
6
  end
5
7
  end
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Zumkehr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri