dataisland 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5bc75e167550296e13045654967700f5dcc12fb
4
+ data.tar.gz: 40bb470559240415f741b90d080c565b94f83b3b
5
+ SHA512:
6
+ metadata.gz: 7162703f232981f62e662bb6175ab5995b8e4152a0a1d645685651d4f9d224250dc725bb670e464994f33efb2dfa8c5030faae33ee6bed79f1a07276c481c8ed
7
+ data.tar.gz: 45293a91ed7f86fa4fa718661fa0e374ec8ced8a84ab3a2e325e2d856c3853ff52e1b5198a59ab9745a1c36d74826e1a852df1a4a05d61602bd16382f65be7c9
checksums.yaml.gz.sig ADDED
Binary file
data/lib/dataisland.rb CHANGED
@@ -16,9 +16,7 @@ class DataIsland
16
16
  def initialize(location)
17
17
 
18
18
  buffer, typex = RXFHelper.read(location)
19
- @html_doc = Rexle.new(buffer)
20
-
21
- #exit
19
+ @html_doc = Rexle.new(buffer.sub(/^<!DOCTYPE html>/,''))
22
20
  @html_doc.xpath('//script[@class="dataisland"]').map(&:delete)
23
21
  @html_doc.xpath('//div[@datactl]').map(&:delete)
24
22
 
@@ -57,8 +55,7 @@ class DataIsland
57
55
  @html_doc.xpath(xpath).each do |island|
58
56
  render(records, x.attributes, island.element('//*[@datafld]'));
59
57
  end
60
-
61
- x.delete
58
+ x.delete unless h[:data] =~ /^\{/
62
59
  end
63
60
  end
64
61
 
@@ -132,20 +129,29 @@ class DataIsland
132
129
  add_to_destnodes(dest_nodes,e.attribute(:datafld).downcase,e)
133
130
  end
134
131
 
135
- a = rec.xpath('.//a[@href]')
132
+ rec.xpath('.//a[@name]').each do |e|
133
+ r = e.attribute(:name)[/\{([^\}]+)\}/,1]
134
+ add_to_destnodes(dest_nodes,r,e) if r
135
+ end
136
136
 
137
- a.each do |e|
137
+ rec.xpath('.//a[@href]').each do |e|
138
138
  r = e.attribute(:href)[/\{([^\}]+)\}/,1]
139
139
  add_to_destnodes(dest_nodes,r,e) if r
140
140
  end
141
+
142
+ rec.xpath('.//object[@data]').each do |e|
143
+
144
+ r = e.attribute(:data)[/\{([^\}]+)\}$/,1]
145
+ add_to_destnodes(dest_nodes,r,e) if r
146
+ end
141
147
 
142
148
  dest_nodes.keys.each do |raw_field|
143
149
 
144
150
  field = raw_field.to_sym
145
151
  next if record[field].nil?
146
-
152
+
147
153
  dest_nodes[field].each do |e2|
148
-
154
+
149
155
  case e2.name.downcase.to_sym
150
156
 
151
157
  when :span
@@ -164,7 +170,21 @@ class DataIsland
164
170
  elsif
165
171
  e2.text = record[field]
166
172
  end
167
-
173
+
174
+ when :object
175
+
176
+ datax = e2.attributes[:data]
177
+
178
+ if datax then
179
+
180
+ if datax[/{#{field}/] then
181
+
182
+ val = record[field]
183
+ new_data = datax.sub(/\{[^\}]+\}/,val)
184
+ e2.attributes[:data] = new_data
185
+ end
186
+ end
187
+
168
188
  when :a
169
189
 
170
190
  classx = e2.attributes[:class]
@@ -174,18 +194,22 @@ class DataIsland
174
194
  val = record[field]
175
195
  new_class = classx.sub(/\{[^\}]+\}/,val)
176
196
  e2.attributes[:class] = new_class
177
- end
178
-
179
- href = e2.attributes[:href]
180
-
181
- if href then
182
197
 
198
+ elsif e2.attributes[:name] then
199
+
200
+ name = e2.attributes[:name]
201
+ val = record[field]
202
+ new_name = name.sub(/\{[^\}]+\}/,val)
203
+ e2.attributes[:name] = new_name
204
+
205
+ elsif e2.attributes[:href] then
206
+
207
+ href = e2.attributes[:href]
183
208
  val = record[field]
184
209
  new_href = href.sub(/\{[^\}]+\}/,val)
185
210
  e2.attributes[:href] = new_href
186
- end
187
-
188
- if e2.attributes[:datafld] then
211
+
212
+ elsif e2.attributes[:datafld] then
189
213
  e2.attributes[:href] = record[field]
190
214
  end
191
215
 
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- 2������ӥPcĐ;W⏱i}2N�Aርn�x!��P#��XUM���:��=\��\f�Ʒ���\cQ��s�t�3T��<�@������b�l��\#��tQi��`r���L��Q��=$:E�X��)"J��$_C�K�������Z�z
1
+ 5LΎ1�:3��*Mm��x
2
+ �ɟ�<?8�^�X/�>�*���c����q��5
metadata CHANGED
@@ -1,14 +1,13 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dataisland
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.12
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - James Robertson
9
8
  autorequire:
10
9
  bindir: bin
11
- cert_chain:
10
+ cert_chain:
12
11
  - |
13
12
  -----BEGIN CERTIFICATE-----
14
13
  MIIDRDCCAiygAwIBAgIBADANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
@@ -30,67 +29,64 @@ cert_chain:
30
29
  oFZtyTHzE2VWZPd0gOPePU5AfG2vfTz6zJAg76LlJ02xCVzD0v8i89hTYZNacU/E
31
30
  BfoxzKzXuOqmc0cbx/V91e239w2ScpRv
32
31
  -----END CERTIFICATE-----
33
-
34
- date: 2013-02-06 00:00:00 Z
35
- dependencies:
36
- - !ruby/object:Gem::Dependency
32
+ date: 2013-03-10 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
37
35
  name: dynarex
38
- prerelease: false
39
- requirement: &id001 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
45
41
  type: :runtime
46
- version_requirements: *id001
47
- - !ruby/object:Gem::Dependency
48
- name: rxfhelper
49
42
  prerelease: false
50
- requirement: &id002 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rxfhelper
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
56
55
  type: :runtime
57
- version_requirements: *id002
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
58
62
  description:
59
63
  email:
60
64
  executables: []
61
-
62
65
  extensions: []
63
-
64
66
  extra_rdoc_files: []
65
-
66
- files:
67
+ files:
67
68
  - lib/dataisland.rb
68
69
  homepage:
69
70
  licenses: []
70
-
71
+ metadata: {}
71
72
  post_install_message:
72
73
  rdoc_options: []
73
-
74
- require_paths:
74
+ require_paths:
75
75
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
77
- none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: "0"
82
- required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: "0"
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
88
86
  requirements: []
89
-
90
87
  rubyforge_project:
91
- rubygems_version: 1.8.23
88
+ rubygems_version: 2.0.0.rc.2
92
89
  signing_key:
93
- specification_version: 3
90
+ specification_version: 4
94
91
  summary: dataisland
95
92
  test_files: []
96
-
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- ����
2
- km8Pk>{A�ٜ�Z ��J�?YL� \��\)*:c��o�{����l ��yx.X�7^?^�Y� ���$f��-�)��|����{(��DW>��v��%�/uQ��.��7ᇁ��m����$fE������)<��G�;��y ����ɢD08t9��m$��؊����̍b�#\���Z)f�����"[��4��S`3���A��� L.��(�;86)����8: '���c�,���"Le�Y
1
+ w�����o^/�� ����������x��<A�G��_��?�O�6F�[ȟ��x�=�`��5j%�q"�����^q\£UcE����I�=|0&�
2
+ &S�4t{
3
+ �U� �n��*cN�3��V� �мlsk���_�K7Zow#���p,~���y/���Usм�ĕ���M �bO.t�DS[.�{cHtB@"J"9A~��}�{�E�Xy{���*���N(N�D�D%q�O����