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 +4 -4
- data/lib/prawn_html/context.rb +6 -0
- data/lib/prawn_html/document_renderer.rb +5 -2
- data/lib/prawn_html/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4593c000107eaa95af317e336d16e34a7cfcffadef95e736eedaebce1c1723f0
|
4
|
+
data.tar.gz: da05881be31d5a4058b41176336d72cd1c1e190a1a1fd59b36f671f6a7e5c98e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8061299f670a1b0f895ac521e4bb6f242125830152bd3eaccb0c33dee3d6aaa1ad2ad179197a2d1ad3cb9aad28fe38aefdc18db1fd55d4148f7870e5b68038a
|
7
|
+
data.tar.gz: ab1e8d1c552f6d105ddd9ffbd565b3d1f816857d48649b5dbc89e18495e4257175d0047a7dea1be1974b26ee81e085254c37e9aa84b0da253667a159ea772bda
|
data/lib/prawn_html/context.rb
CHANGED
@@ -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
|
-
|
110
|
-
|
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
|
data/lib/prawn_html/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2022-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oga
|