prawn-html 0.6.4 → 0.6.5

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: c773502449714d4f0a6f2401721ba67a349731ef9f0c525216864b355fbe76c8
4
- data.tar.gz: 8857a7761f343367a4c6496757c767b6b62b46d0d840df96a7d545c3693c744f
3
+ metadata.gz: 4593c000107eaa95af317e336d16e34a7cfcffadef95e736eedaebce1c1723f0
4
+ data.tar.gz: da05881be31d5a4058b41176336d72cd1c1e190a1a1fd59b36f671f6a7e5c98e
5
5
  SHA512:
6
- metadata.gz: 51be5bfbbf4427f6124a4a00cfb399017d6b806d8d3d2bb228fc81b7547a3cbaffe535767c5270a2666bed0a9abd89099d156dd79b1ea638d39101e528207be0
7
- data.tar.gz: 520221561fc067919e098349fe6fab940290f6de419b37722679eacbb959055700620539c067d6a57786e7d4396bd0a4659e0f95428b09a96c3a93c55e174bda
6
+ metadata.gz: a8061299f670a1b0f895ac521e4bb6f242125830152bd3eaccb0c33dee3d6aaa1ad2ad179197a2d1ad3cb9aad28fe38aefdc18db1fd55d4148f7870e5b68038a
7
+ data.tar.gz: ab1e8d1c552f6d105ddd9ffbd565b3d1f816857d48649b5dbc89e18495e4257175d0047a7dea1be1974b26ee81e085254c37e9aa84b0da253667a159ea772bda
@@ -62,6 +62,12 @@ module PrawnHtml
62
62
  end
63
63
  end
64
64
 
65
+ # :nocov:
66
+ def inspect
67
+ map(&:class).map(&:to_s).join(', ')
68
+ end
69
+ # :nocov:
70
+
65
71
  # Remove the last element from the context
66
72
  def remove_last
67
73
  last.on_context_remove(self) if last.respond_to?(:on_context_remove)
@@ -9,6 +9,7 @@ module PrawnHtml
9
9
  #
10
10
  # @param pdf [PdfWrapper] target PDF wrapper
11
11
  def initialize(pdf)
12
+ @before_content = []
12
13
  @buffer = []
13
14
  @context = Context.new
14
15
  @last_margin = 0
@@ -42,6 +43,7 @@ module PrawnHtml
42
43
  options = { width: pdf.page_width, height: pdf.page_height }
43
44
  tag_class.new(tag_name, attributes: attributes, options: options).tap do |element|
44
45
  setup_element(element, element_styles: element_styles)
46
+ @before_content.push(element.before_content) if element.respond_to?(:before_content)
45
47
  @last_tag_open = true
46
48
  end
47
49
  end
@@ -106,8 +108,9 @@ module PrawnHtml
106
108
  end
107
109
 
108
110
  def prepare_text(content)
109
- before_content = context.before_content
110
- text = before_content ? ::Oga::HTML::Entities.decode(before_content) : ''
111
+ text = @before_content.any? ? ::Oga::HTML::Entities.decode(@before_content.join) : ''
112
+ @before_content.clear
113
+
111
114
  return (@last_text = text + content) if context.white_space_pre?
112
115
 
113
116
  content = content.lstrip if @last_text[-1] == ' ' || @last_tag_open
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrawnHtml # :nodoc:
4
- VERSION = '0.6.4'
4
+ VERSION = '0.6.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-03 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oga