sectionx 0.4.1 → 0.4.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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/sectionx.rb +30 -26
- data.tar.gz.sig +0 -0
- metadata +44 -40
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d5ee09c486b5a7c78b44260bf1071e86755023de614c8202edf472bfb3bdecc
|
4
|
+
data.tar.gz: 71812c5472522812adc526224cdffb83809361b1e99df823f1a7c8ec735996db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d11a4ebfe809cc64261a3a325e007defa0a4c2b0a46e17a9f754c91bcfc9aaba3e94f6dbb543c6f29c4d106451c398412225d6fba2c832a87a2f1d7d0025135
|
7
|
+
data.tar.gz: fb00102a23afc8ec47cb1827397d7d7297c4ffaea188c4851a97ea203449605442f7e189a64942f0c856c9118b2a30412aad618920babe093b74b23dd53cc629
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sectionx.rb
CHANGED
@@ -12,7 +12,9 @@ class SectionX
|
|
12
12
|
|
13
13
|
attr_reader :attributes, :summary, :sections
|
14
14
|
|
15
|
-
def initialize(x=nil)
|
15
|
+
def initialize(x=nil, debug: false)
|
16
|
+
|
17
|
+
@debug = debug
|
16
18
|
|
17
19
|
@doc = if x.is_a? String then
|
18
20
|
buffer, _ = RXFHelper.read x
|
@@ -81,6 +83,17 @@ class SectionX
|
|
81
83
|
@doc.xml(options)
|
82
84
|
end
|
83
85
|
|
86
|
+
def update(id=nil, h={})
|
87
|
+
|
88
|
+
puts 'inside update h: ' + h.inspect if @debug
|
89
|
+
xpath = "summary/" + h.keys.first.to_s
|
90
|
+
puts 'xpath: ' + xpath.inspect if @debug
|
91
|
+
e = @doc.root.element(xpath)
|
92
|
+
puts 'e: ' + e.inspect if @debug
|
93
|
+
e.text = h.values.first if e
|
94
|
+
puts '@doc: ' + @doc.xml if @debug
|
95
|
+
end
|
96
|
+
|
84
97
|
def xpath(x)
|
85
98
|
@doc.root.xpath(x)
|
86
99
|
end
|
@@ -103,9 +116,16 @@ class SectionX
|
|
103
116
|
|
104
117
|
def build_section(xml, raw_rows)
|
105
118
|
|
106
|
-
|
107
|
-
|
108
|
-
|
119
|
+
puts 'raw_rows : ' + raw_rows.inspect
|
120
|
+
raw_section_name = raw_rows.shift
|
121
|
+
puts 'section_name : ' + raw_section_name.inspect
|
122
|
+
|
123
|
+
attr = if raw_section_name then
|
124
|
+
section_name = raw_section_name[/[\w\s]+/]
|
125
|
+
{title: section_name}
|
126
|
+
else
|
127
|
+
{}
|
128
|
+
end
|
109
129
|
|
110
130
|
xml.section(attr) do
|
111
131
|
|
@@ -131,8 +151,8 @@ class SectionX
|
|
131
151
|
|
132
152
|
def indent_heading(s, heading='#')
|
133
153
|
|
134
|
-
a = s.split(/(?=^\s*#{heading}\s
|
135
|
-
|
154
|
+
a = s.split(/(?=^\s*#{heading}\s*[\[\w])/).map do |x|
|
155
|
+
puts 'x : ' + x.inspect
|
136
156
|
heading_title = x[/^\s*#{heading}\s*.*/]
|
137
157
|
|
138
158
|
if heading_title then
|
@@ -156,24 +176,8 @@ class SectionX
|
|
156
176
|
def parse_root_node(e)
|
157
177
|
|
158
178
|
attributes = e.attributes
|
159
|
-
summary = RecordX.new e.xpath('summary/*')
|
160
|
-
|
161
|
-
|
162
|
-
summary_methods.each do |x|
|
163
|
-
|
164
|
-
instance_eval "
|
165
|
-
|
166
|
-
def #{x.to_sym}()
|
167
|
-
@summary[:#{x}]
|
168
|
-
end
|
169
|
-
|
170
|
-
def #{x.to_s}=(v)
|
171
|
-
@summary[:#{x}] = v
|
172
|
-
@doc.root.element('summary/#{x.to_s}').text = v
|
173
|
-
end
|
174
|
-
"
|
175
|
-
end
|
176
|
-
|
179
|
+
summary = RecordX.new e.xpath('summary/*'), self, debug: @debug
|
180
|
+
|
177
181
|
a = e.xpath('sections/section')
|
178
182
|
|
179
183
|
return [attributes, summary] if a.empty?
|
@@ -182,7 +186,7 @@ class SectionX
|
|
182
186
|
|
183
187
|
if a[0] and a[0].attributes.empty? then
|
184
188
|
section1 = a.shift
|
185
|
-
sections = {'' => SectionX.new(section1)}
|
189
|
+
sections = {'' => SectionX.new(section1, debug: true)}
|
186
190
|
end
|
187
191
|
|
188
192
|
sections = a.inject(sections) do |r, section|
|
@@ -191,7 +195,7 @@ class SectionX
|
|
191
195
|
name = (h[:id] || h[:title].gsub(/\s+/,'_')).downcase
|
192
196
|
|
193
197
|
instance_eval "def #{name}() self.sections[:#{name}] end"
|
194
|
-
r.merge(name.
|
198
|
+
r.merge(name.to_sym => SectionX.new(section, debug: @debug))
|
195
199
|
end
|
196
200
|
|
197
201
|
[attributes, summary, sections]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sectionx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
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Axf51G/YRSMs5fuWIt9zbraCi4Pgx71i4sZkIQPcA
|
29
|
+
aT9hMzqM8QQUNFYhVKIt0A1eobXgZbo9sgwuaLE1xBCI/RUWjZF2Tw4N0t1Xyqpd
|
30
|
+
4zJ4UrEgGNJI8qWlN2gPBHxpzwdV2g8gUsYh9docVKTGiJjjoUl72eShwoFWXA0e
|
31
|
+
omF8/uAX90lVGoN5SxOLQzpRabF6jbN80aQUOVQRfSxpVtIQuoUyfvA6LfmNob/x
|
32
|
+
PWSkMffP2G7ySzohOR18Md2L2wbvgj8Npbc/X1eYmR4Ict/URG7P+mpi9+SELKjL
|
33
|
+
6EiX+A00/gVzAutvGarXRnUN+ContjXeNx1T++VtRCyAdrQKTjnWz9eeN0T8G1rw
|
34
|
+
NtxeeZrVRefak2ZAClTycMOYL/DO1I22njjMo8fXDjBcPoQawzChx7yKc4DUjmGg
|
35
|
+
lPw+nNEEQBBBOO6255zdlyzYtxsHXnEKJYvUjl4/Z/YIa2Y+VgLolw8kPC0Z0Ztw
|
36
|
+
TLvN099jf8wfGlEJ/VkEKkXV
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: line-tree
|
@@ -39,82 +43,82 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
46
|
+
version: '0.7'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
49
|
+
version: 0.7.0
|
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: '0.
|
56
|
+
version: '0.7'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
59
|
+
version: 0.7.0
|
56
60
|
- !ruby/object:Gem::Dependency
|
57
61
|
name: rexle-builder
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
64
|
- - "~>"
|
61
65
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
66
|
+
version: '0.3'
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
69
|
+
version: 0.3.13
|
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.
|
76
|
+
version: '0.3'
|
73
77
|
- - ">="
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
79
|
+
version: 0.3.13
|
76
80
|
- !ruby/object:Gem::Dependency
|
77
81
|
name: rxfhelper
|
78
82
|
requirement: !ruby/object:Gem::Requirement
|
79
83
|
requirements:
|
80
84
|
- - "~>"
|
81
85
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
86
|
+
version: '0.8'
|
83
87
|
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
89
|
+
version: 0.8.7
|
86
90
|
type: :runtime
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
93
|
requirements:
|
90
94
|
- - "~>"
|
91
95
|
- !ruby/object:Gem::Version
|
92
|
-
version: '0.
|
96
|
+
version: '0.8'
|
93
97
|
- - ">="
|
94
98
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.
|
99
|
+
version: 0.8.7
|
96
100
|
- !ruby/object:Gem::Dependency
|
97
101
|
name: recordx
|
98
102
|
requirement: !ruby/object:Gem::Requirement
|
99
103
|
requirements:
|
100
104
|
- - "~>"
|
101
105
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0.
|
106
|
+
version: '0.5'
|
103
107
|
- - ">="
|
104
108
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
109
|
+
version: 0.5.3
|
106
110
|
type: :runtime
|
107
111
|
prerelease: false
|
108
112
|
version_requirements: !ruby/object:Gem::Requirement
|
109
113
|
requirements:
|
110
114
|
- - "~>"
|
111
115
|
- !ruby/object:Gem::Version
|
112
|
-
version: '0.
|
116
|
+
version: '0.5'
|
113
117
|
- - ">="
|
114
118
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
119
|
+
version: 0.5.3
|
116
120
|
description:
|
117
|
-
email: james@
|
121
|
+
email: james@jamesrobertson.eu
|
118
122
|
executables: []
|
119
123
|
extensions: []
|
120
124
|
extra_rdoc_files: []
|
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
144
|
version: '0'
|
141
145
|
requirements: []
|
142
146
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.7.6
|
144
148
|
signing_key:
|
145
149
|
specification_version: 4
|
146
150
|
summary: Makes it convenient to store and retrieve hierarchical data in an XML format
|
metadata.gz.sig
CHANGED
Binary file
|