dataisland 0.1.16 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b5e584254b7c3ff6be68ada1db760ad1b6879bb0
4
- data.tar.gz: caab786c6b770a567b45ebd73db0f7018252a1fe
2
+ SHA256:
3
+ metadata.gz: fd6c555d5c2b7971085a70e00281d034d1eae5e24a5daff8ec7116cfe566fbd3
4
+ data.tar.gz: 4e23210e6d4c36f7889d1e953238574783f1fbb84a78fc807b7be28790029e4d
5
5
  SHA512:
6
- metadata.gz: 122fd66e76d6a2b4c2c042c71f5549d7167bf54d8d0ef3def719362a242023b3b8c8415f683ac68665f9ac8240c9290b1d8d0614ee8921fdb5be33587800252d
7
- data.tar.gz: 148b1a3866c1726e1e252fb220a19a6e625c59cc57c9292fe356f1bc13d8a8b1cabbed0d5bab58c19f1e204ed13af2b882faf248da2de9adacfcb9c7bbefae8b
6
+ metadata.gz: 4fc434a4294ae47b4e767ce8f18de6835e0e15b963312d58b12d395e0f4a468f9c1574268874c3f4ba6b30269e35f3d8098046e71eee43b11b2ef10beb90f9a1
7
+ data.tar.gz: 179cff1798e76fc2a5a8a6af21aba7fe7d4e95f805833c1a1b26a96c0ea3ce49d4068d831ddba485d0f751f655a060d79e44755f507c12bb6b19d44f303cfde0
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dataisland.rb CHANGED
@@ -12,8 +12,8 @@ class DataIsland
12
12
 
13
13
  # e.g. url = 'http://www.jamesrobertson.eu/index-template.html'
14
14
  #
15
- def initialize(location)
16
-
15
+ def initialize(location, opts={})
16
+
17
17
  buffer, typex = RXFHelper.read(location)
18
18
  @html_doc = Rexle.new(buffer.sub(/^<!DOCTYPE html>/,''))
19
19
 
@@ -21,9 +21,7 @@ class DataIsland
21
21
  a.map(&:delete)
22
22
 
23
23
  @html_doc.xpath('//div[@datactl]').map(&:delete)
24
-
25
24
  @html_doc.root.element('body').attributes.delete :onload
26
-
27
25
  h = @html_doc.element('//object').attributes
28
26
 
29
27
  path = { url: -> {File.dirname(location)},
@@ -35,9 +33,8 @@ class DataIsland
35
33
  @html_doc.xpath("//object[@type='text/xml']").each do |x|
36
34
 
37
35
  h = x.attributes
36
+ tmp, type2 = RXFHelper.read(h[:data], opts)
38
37
 
39
- tmp, type2 = RXFHelper.read(h[:data])
40
-
41
38
  location2 = case h[:data]
42
39
  when /^https?:\/\//
43
40
  h[:data]
@@ -46,12 +43,13 @@ class DataIsland
46
43
  else
47
44
  @location +'/' + h[:data]
48
45
  end
49
-
50
- dynarex = Dynarex.new location2
46
+
47
+ dynarex = Dynarex.new location2, opts
51
48
 
52
49
  if (h[:order] and h[:order][/^desc|descending$/]) \
53
50
  or dynarex.order = 'descending' then
54
- records = dynarex.flat_records.reverse
51
+ #records = dynarex.flat_records.reverse
52
+ records = dynarex.flat_records
55
53
  else
56
54
  records = dynarex.flat_records
57
55
  end
@@ -85,12 +83,13 @@ class DataIsland
85
83
  end
86
84
 
87
85
  def add_to_destnodes(dn, raw_key, node)
86
+
88
87
  key = raw_key.to_sym
89
88
  dn.has_key?(key) ? dn[key] << node : dn[key] = [node]
90
89
  end
91
90
 
92
91
  def render(flat_records, h, node)
93
-
92
+
94
93
  sort_by = h[:sort_by]
95
94
  range = h[:range]
96
95
 
@@ -118,42 +117,43 @@ class DataIsland
118
117
  else
119
118
  recs = records
120
119
  end
121
-
122
- recs.each do |record|
123
120
 
121
+ recs.each do |record|
122
+
124
123
  rec = rec_orig.deep_clone
125
124
 
126
125
  # get a reference to each element containing the datafld attribute
127
126
  dest_nodes = {}
128
-
129
- a = rec.xpath('.//span[@class]|.//a[@class]')
127
+
128
+ a = rec.xpath('*//span[@class]|*//a[@class]')
130
129
 
131
130
  a.each do |e|
131
+
132
132
  r = e.attribute(:class)[0][/\{([^\}]+)\}$/,1]
133
133
  add_to_destnodes(dest_nodes,r,e) if r
134
134
  end
135
135
 
136
- rec.xpath('.//*[@datafld]').each do |e|
136
+ rec.xpath('*//*[@datafld]').each do |e|
137
137
  add_to_destnodes(dest_nodes,e.attribute(:datafld).downcase,e)
138
138
  end
139
139
 
140
- rec.xpath('.//a[@name]').each do |e|
140
+ rec.xpath('*//a[@name]').each do |e|
141
141
  r = e.attribute(:name)[/\{([^\}]+)\}/,1]
142
142
  add_to_destnodes(dest_nodes,r,e) if r
143
143
  end
144
144
 
145
- rec.xpath('.//a[@href]').each do |e|
145
+ rec.xpath('*//a[@href]').each do |e|
146
146
  r = e.attribute(:href)[/\{([^\}]+)\}/,1]
147
147
  add_to_destnodes(dest_nodes,r,e) if r
148
148
  end
149
149
 
150
- rec.xpath('.//object[@data]').each do |e|
150
+ rec.xpath('*//object[@data]').each do |e|
151
151
 
152
152
  r = e.attribute(:data)[/\{([^\}]+)\}$/,1]
153
153
  add_to_destnodes(dest_nodes,r,e) if r
154
154
  end
155
155
 
156
- rec.xpath('.//button[@onclick]').each do |e|
156
+ rec.xpath('*//button[@onclick]').each do |e|
157
157
 
158
158
  r = e.attribute(:onclick)[/\{([^\}]+)\}$/,1]
159
159
  add_to_destnodes(dest_nodes,r,e) if r
@@ -259,4 +259,4 @@ class DataIsland
259
259
  end
260
260
  end
261
261
 
262
- end
262
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dataisland
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,28 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE0MTAyNjIwMDMzOVo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gQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEADc/igbq+nrR3/B+Ygp0lP/rZgG29wBWMI29xdQE+
29
+ okaY81kBA8Keg5lc9AZdkF4JJMdNKZvWLrWtfwVDfByV1yPV7kBBNQITuEMD5nuR
30
+ vNm86+dx/8hWimLZZCeLVG+4DwPCkbvYF8SHO4Vwe0FcavlEEc/RyuRkkDsSPP+V
31
+ 7Y7atBKh9jJ056CMq96Vm4Ug7/ybX8tHJLdY0tOFaOnTlYCMNVYtr0HA4oYEwDVZ
32
+ IjMPocXBbBuM1ggoSG2vF6aQFjYFlPxLbhOtYzaHyEmrnA1GhO32VHz1Peq0gCvs
33
+ EEptynuTww0xRSLB/e0LGGG3ttZDuNIw9HFXniGbiSIx7n5Ly5tYSPoiGWlnM4FZ
34
+ ZS38HOEt0uowDVTfGVrf3wsLa9aq5Moa+KqLd+5uM3mlFni234in9JuLmg4qnAi4
35
+ xiTPIrd89hKwtrTuHAV56n1YJMMon+bv2drMjL/8g1fzxhz6PcKFlJU9d0UjsIK0
36
+ CAkOMP1IH0YbWH3T9t+Osrgt
33
37
  -----END CERTIFICATE-----
34
- date: 2014-12-08 00:00:00.000000000 Z
38
+ date: 2021-03-01 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: dynarex
@@ -39,42 +43,42 @@ dependencies:
39
43
  requirements:
40
44
  - - "~>"
41
45
  - !ruby/object:Gem::Version
42
- version: '1.2'
46
+ version: '1.8'
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: 1.2.90
49
+ version: 1.8.27
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
50
54
  - - "~>"
51
55
  - !ruby/object:Gem::Version
52
- version: '1.2'
56
+ version: '1.8'
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: 1.2.90
59
+ version: 1.8.27
56
60
  - !ruby/object:Gem::Dependency
57
61
  name: rxfhelper
58
62
  requirement: !ruby/object:Gem::Requirement
59
63
  requirements:
60
64
  - - "~>"
61
65
  - !ruby/object:Gem::Version
62
- version: '0.1'
66
+ version: '1.1'
63
67
  - - ">="
64
68
  - !ruby/object:Gem::Version
65
- version: 0.1.12
69
+ version: 1.1.3
66
70
  type: :runtime
67
71
  prerelease: false
68
72
  version_requirements: !ruby/object:Gem::Requirement
69
73
  requirements:
70
74
  - - "~>"
71
75
  - !ruby/object:Gem::Version
72
- version: '0.1'
76
+ version: '1.1'
73
77
  - - ">="
74
78
  - !ruby/object:Gem::Version
75
- version: 0.1.12
79
+ version: 1.1.3
76
80
  description:
77
- email: james@r0bertson.co.uk
81
+ email: james@jamesrobertson.eu
78
82
  executables: []
79
83
  extensions: []
80
84
  extra_rdoc_files: []
@@ -100,8 +104,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
104
  version: '0'
101
105
  requirements: []
102
106
  rubyforge_project:
103
- rubygems_version: 2.2.2
107
+ rubygems_version: 2.7.10
104
108
  signing_key:
105
109
  specification_version: 4
106
- summary: dataisland
110
+ summary: Transforms an HTML page containing XML data islands (a Microsoft Internet
111
+ Explorer 5.0 like feature) to HTML.
107
112
  test_files: []
metadata.gz.sig CHANGED
Binary file