grover 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b599a5462dc8008f92d9ea95c949d8de0cfd0786792b303c1e78f22a104a503d
4
- data.tar.gz: bb4dbd2d6d336e88f71668853b2d9819e314a87b3b55c7c4f211f3d94ddcfe25
3
+ metadata.gz: 5dae47620d2a732cab442444c25a6954f103c669fa7eea7c092b34297f1d71c0
4
+ data.tar.gz: 84d886147feff66e75276b00d5e6529883396763dcc424d6e42186c5dbb9b9d0
5
5
  SHA512:
6
- metadata.gz: cc644ef00aa06d6ebb2e146165fe300f94c73749cffaa6e4e409d78e6ed5d376421a4163137557f551ea90ef984a52bda42f5db01bad1f81d03c5fb209ed5863
7
- data.tar.gz: 872dd3bde76e74f201d0dc52f46614434bdb52ea7ef43deb205783241c54a4c0f107f69812a9fa70f3af1e25a46edb3ac6e13e7d17bc51ba6f3b2223c0f69f92
6
+ metadata.gz: bad7d5f4c5a15b8a9bc7ea7041ad1184c72416944b4c837c16592197e5105cebccee53eae564b9fbf8776884fb4b4e1d7d888de7c2018b0040c085979c65e55f
7
+ data.tar.gz: b8837766f459146e6349df80952f655dc330c7d9ca7cdebcbdd2a69fe17a10701addb1ff029ebfacd3458780b1d134679128df8766c1b017904c76dd876e43d2
data/lib/grover.rb CHANGED
@@ -50,6 +50,15 @@ class Grover
50
50
  processor.convert :pdf, @url, normalized_options(path: path)
51
51
  end
52
52
 
53
+ #
54
+ # Request URL with provided options and render HTML
55
+ #
56
+ # @return [String] The resulting HTML string
57
+ #
58
+ def to_html
59
+ processor.convert :content, @url, normalized_options(path: nil)
60
+ end
61
+
53
62
  #
54
63
  # Request URL with provided options and create screenshot
55
64
  #
@@ -101,6 +101,22 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
101
101
  }
102
102
  }
103
103
 
104
+ // add styles (if provided)
105
+ const styleTagOptions = options.styleTagOptions; delete options.styleTagOptions;
106
+ if (Array.isArray(styleTagOptions)) {
107
+ for (const styleTagOption of styleTagOptions) {
108
+ await page.addStyleTag(styleTagOption);
109
+ }
110
+ }
111
+
112
+ // add scripts (if provided)
113
+ const scriptTagOptions = options.scriptTagOptions; delete options.scriptTagOptions;
114
+ if (Array.isArray(scriptTagOptions)) {
115
+ for (const scriptTagOption of scriptTagOptions) {
116
+ await page.addScriptTag(scriptTagOption);
117
+ }
118
+ }
119
+
104
120
  // If specified, evaluate script on the page
105
121
  const executeScript = options.executeScript; delete options.executeScript;
106
122
  if (executeScript !== undefined) {
@@ -19,6 +19,7 @@ class Grover
19
19
  ensure_packages_are_initiated
20
20
  result = call_js_method method, url_or_html, options
21
21
  return unless result
22
+ return result if result.is_a?(String)
22
23
 
23
24
  result['data'].pack('C*')
24
25
  ensure
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '0.14.1'
4
+ VERSION = '0.14.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf
@@ -181,7 +181,7 @@ homepage: https://github.com/Studiosity/grover
181
181
  licenses:
182
182
  - MIT
183
183
  metadata: {}
184
- post_install_message:
184
+ post_install_message:
185
185
  rdoc_options: []
186
186
  require_paths:
187
187
  - lib
@@ -199,8 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.2.3
203
- signing_key:
202
+ rubygems_version: 3.0.6
203
+ signing_key:
204
204
  specification_version: 4
205
205
  summary: A Ruby gem to transform HTML into PDF, PNG or JPEG by wrapping the NodeJS
206
206
  Google Puppeteer driver for Chromium