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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9763236251a08873c269bb76fa8cbc81e64111a9bd94ea7a167c0e96ad1e0dc
4
- data.tar.gz: ab65d5b9648ec671a22191cf7eca7b14d6c4b07917e45adf479046360f7adfd7
3
+ metadata.gz: 709b9d124eeb6e972d0095d078ce39be54ef3335eb57b4042cc5499a423ac3ba
4
+ data.tar.gz: 7de22b6ec750dc0f4aebe1f0c58b871cba29253a455310b9cc00b5915627ccce
5
5
  SHA512:
6
- metadata.gz: 8ce66b221fce28fb3be395a199fdb4fc3c660a1702302c4b453bc40f39033cadc41fff9ea8a5f0e612f12a1040fbdad31e738823c6d9cf3ea2456a9ebf55b999
7
- data.tar.gz: 73827642f8a0d5a87745eb9d853f9a9a9e0d62ea7ab9f31e552be71cba2c4ce7b340da992ab0eabd145a0fbb6395a30d953396fc1bf25f7410db5df9572eb6e1
6
+ metadata.gz: c76d4d622db3fa8250aa396d5782e6b04d3569da187a740fd600b757956226514c01ccee0ab4e9ffc0d1e9ee828a50efb37d92109aa7a461b0ff0de2e2cdf0e6
7
+ data.tar.gz: a09547f979b4742c9e4d2ddf898fea4ead8c86906ed89c100cbd476c1f022db46ecb3e0d7c6fa614c3f4ea5173699678d5621230706ad0ea3527ef3968b5a989
@@ -1,11 +1,15 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.3
5
- - 2.4
6
4
  - 2.5
7
5
  - 2.6
8
6
 
7
+ env:
8
+ matrix:
9
+ - RAILS_VERSION="~> 4.1"
10
+ - RAILS_VERSION="~> 5.2"
11
+ - RAILS_VERSION="~> 6.0.0"
12
+
9
13
  before_install:
10
14
  - gem update --system
11
15
  - gem update bundler
@@ -1,3 +1,10 @@
1
+ 2021-01-23
2
+ =================
3
+ * Bump to 0.8.5
4
+ * Make `PDFKit::VERSION` public (#484)
5
+ * Fix to render stylesheets as html safe string on Rails 6 (#483)
6
+ * Adds support for Rails 6
7
+
1
8
  2020-08-16
2
9
  =================
3
10
  * Bump to 0.8.4.3.2
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :test do
4
- gem 'activesupport', '~> 4.1'
4
+ gem 'activesupport', ENV['RAILS_VERSION'] || '~> 4.1'
5
5
  gem 'simplecov', require: false
6
6
  end
7
7
 
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Create PDFs using plain old HTML+CSS. Uses [wkhtmltopdf](http://github.com/antialize/wkhtmltopdf) on the back-end which renders HTML using Webkit.
4
4
 
5
+ ## Supported versions
6
+
7
+ - Ruby 2.5, 2.6
8
+ - Rails 4.2, 5.2, 6.0
9
+
5
10
  ## Install
6
11
 
7
12
  ### PDFKit
@@ -5,3 +5,4 @@ require 'pdfkit/html_preprocessor'
5
5
  require 'pdfkit/os'
6
6
  require 'pdfkit/configuration'
7
7
  require 'pdfkit/wkhtmltopdf'
8
+ require 'pdfkit/version'
@@ -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| style_tag_for(stylesheet) + 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
@@ -1,3 +1,3 @@
1
1
  class PDFKit
2
- VERSION = '0.8.4.3.2'
2
+ VERSION = '0.8.5'
3
3
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
+ s.required_ruby_version = '>= 2.5'
22
+
21
23
  s.requirements << "wkhtmltopdf"
22
24
 
23
25
  # Development Dependencies
@@ -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.3.2
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: 2020-08-16 00:00:00.000000000 Z
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: '0'
151
+ version: '2.5'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="