pdfkit 0.8.4.3.2 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pdfkit might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/README.md +5 -0
- data/lib/pdfkit.rb +1 -0
- data/lib/pdfkit/pdfkit.rb +6 -2
- data/lib/pdfkit/version.rb +1 -1
- data/pdfkit.gemspec +2 -0
- data/spec/pdfkit_spec.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709b9d124eeb6e972d0095d078ce39be54ef3335eb57b4042cc5499a423ac3ba
|
4
|
+
data.tar.gz: 7de22b6ec750dc0f4aebe1f0c58b871cba29253a455310b9cc00b5915627ccce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76d4d622db3fa8250aa396d5782e6b04d3569da187a740fd600b757956226514c01ccee0ab4e9ffc0d1e9ee828a50efb37d92109aa7a461b0ff0de2e2cdf0e6
|
7
|
+
data.tar.gz: a09547f979b4742c9e4d2ddf898fea4ead8c86906ed89c100cbd476c1f022db46ecb3e0d7c6fa614c3f4ea5173699678d5621230706ad0ea3527ef3968b5a989
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/pdfkit.rb
CHANGED
data/lib/pdfkit/pdfkit.rb
CHANGED
@@ -114,7 +114,9 @@ class PDFKit
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def style_tag_for(stylesheet)
|
117
|
-
"<style>#{File.read(stylesheet)}</style>"
|
117
|
+
style = "<style>#{File.read(stylesheet)}</style>"
|
118
|
+
style = style.html_safe if style.respond_to?(:html_safe)
|
119
|
+
style
|
118
120
|
end
|
119
121
|
|
120
122
|
def preprocess_html
|
@@ -129,7 +131,9 @@ class PDFKit
|
|
129
131
|
|
130
132
|
stylesheets.each do |stylesheet|
|
131
133
|
if @source.to_s.match(/<\/head>/)
|
132
|
-
@source = Source.new(@source.to_s.gsub(/(<\/head>)/) {|s|
|
134
|
+
@source = Source.new(@source.to_s.gsub(/(<\/head>)/) {|s|
|
135
|
+
style_tag_for(stylesheet) + (s.respond_to?(:html_safe) ? s.html_safe : s)
|
136
|
+
})
|
133
137
|
else
|
134
138
|
@source.to_s.insert(0, style_tag_for(stylesheet))
|
135
139
|
end
|
data/lib/pdfkit/version.rb
CHANGED
data/pdfkit.gemspec
CHANGED
data/spec/pdfkit_spec.rb
CHANGED
@@ -501,6 +501,14 @@ describe PDFKit do
|
|
501
501
|
expect(pdfkit.source.to_s).to include("<style>#{File.read(css)}</style></head>")
|
502
502
|
end
|
503
503
|
|
504
|
+
it "can deal with ActiveSupport::SafeBuffer if the HTML doesn't have a head tag" do
|
505
|
+
pdfkit = PDFKit.new(ActiveSupport::SafeBuffer.new "<html><body>Hai!</body></html>")
|
506
|
+
css = File.join(SPEC_ROOT,'fixtures','example.css')
|
507
|
+
pdfkit.stylesheets << css
|
508
|
+
pdfkit.to_pdf
|
509
|
+
expect(pdfkit.source.to_s).to include("<style>#{File.read(css)}</style>")
|
510
|
+
end
|
511
|
+
|
504
512
|
it "escapes \\X in stylesheets" do
|
505
513
|
pdfkit = PDFKit.new("<html><head></head><body>Hai!</body></html>")
|
506
514
|
css = File.join(SPEC_ROOT,'fixtures','example_with_hex_symbol.css')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Pace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '2.5'
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
154
|
- - ">="
|