qnd_html2page 0.2.0 → 0.2.1

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: ffa5d9991d46892e27a79ec207484b95b61c846f7cc410c3ec3cf340556f06eb
4
- data.tar.gz: 598d0458826f7c293d2d9a0cbdcd31d8e191e37e1bb04520d3bbd73ce5ba952a
3
+ metadata.gz: a72421b4710f629052f764efd5f2613cb0eadba4f5dc910914794d5fc3b93e8e
4
+ data.tar.gz: 8ed7eb5ee811967f7ab35954ccac3e50dae8f7e3f8a9853d032087d55b65227d
5
5
  SHA512:
6
- metadata.gz: 24c2d07d88d7276e57e24cb59ad0240f3ce4e29a0dfbd6ffcefa510502f2342c8d5ffb1045e15165add188d5659d7766415f6763225aecb426c913b68b7bd87e
7
- data.tar.gz: ef2828615ea6d377efd93d704b5cbe6c3025a2bc3ba5574fa153571d34b527eab269e1250cba6cbafbd6557f40f86c9ba22c0b9801ae268b8c3501441dbc5b36
6
+ metadata.gz: cca59f8cbe1e762ccf55d8329990cecffd5bdff19e7d221d713c7b1d3feaf57bf9a6b4404b0bcb9ecf571d26746ef1efc27797b56e4a5f4d2f1262c5cf3029c5
7
+ data.tar.gz: d11b6f38420d004b25c1ead22a59ec2c79ff5af2659cc98c7fda8517f8d4a0011fa087373eb61a401cc239b38e3f79dadd6a86af62dadc398a744d3bce8c18b4
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/qnd_html2page.rb CHANGED
@@ -41,7 +41,7 @@ class QndHtml2Page
41
41
 
42
42
  def scan(html)
43
43
 
44
- # add the span tag after every element in the body
44
+ # add the span tag after almost every element in the body
45
45
 
46
46
  doc = Rexle.new(html)
47
47
  body = doc.root.element('body')
@@ -67,14 +67,14 @@ class QndHtml2Page
67
67
  File.write tmpfile.path + '.html', doc.root.xml
68
68
 
69
69
  browser = Ferrum::Browser.new
70
- #browser.resize width: 300, height: 300
71
70
  browser.goto('file://' + tmpfile.path + '.html')
72
- browser.screenshot(path: "/tmp/page.jpg")
73
71
  span_list = browser.xpath('//span')
74
72
  a = span_list.map {|x| [x.text, x.find_position.last] }
75
73
 
76
74
 
77
- heights = ((a.last.last) / @height).round.to_i.times.inject([@height]) {|r, x| r << (r.last + @height) }
75
+ heights = ((a.last.last) / @height).round.to_i.times\
76
+ .inject([@height]) {|r, x| r << (r.last + @height) }
77
+
78
78
  puts ('heights: ' + heights.inspect).debug if @debug
79
79
  height = heights.shift
80
80
 
@@ -106,7 +106,8 @@ class QndHtml2Page
106
106
  pages = elements.slice_at(*stops).map do |e_list|
107
107
 
108
108
  div = Rexle::Element.new 'div'
109
- e_list.reject! {|e| e.name == 'span' and e.attributes[:class] == 'qndhtml2pg' }
109
+ e_list.reject! {|e| e.name == 'span' and
110
+ e.attributes[:class] == 'qndhtml2pg' }
110
111
  next if e_list.empty?
111
112
  e_list.each {|e| div.add e}
112
113
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qnd_html2page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file