sectionx 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sectionx.rb +28 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb59887f6e890a97b343d84531c55a534bed6fa8f56cbe4f0b32f905aac1d46
|
4
|
+
data.tar.gz: fbec4ce7de357eaeedf2923a20e9d0cd8a1400cd14869014714ea988212de433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a327cf2d5afbbcc59d653bd6bcde531b8cfdf62b4bc7ba3eb89526cb0487b0703a64fe8f83a4fc5f4e9b24e8f9ba56c366b6e75641b1a03abced96277eeaec3f
|
7
|
+
data.tar.gz: 11cd4e1d35c48e61e05afbc70d3841ca43fb70c84e25245f8f8e67b55e02967f6457859e6f437ff6ce277fa194b4a25f5d973aa88f06d5e81e2f74aee7236aeb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sectionx.rb
CHANGED
@@ -27,6 +27,12 @@ class SectionX
|
|
27
27
|
@attributes, @summary, @sections = parse_root_node @doc.root
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
def fetch(rxpath)
|
32
|
+
list = rxpath.split('/').map {|x| x.gsub(/\s+/,'_').downcase.to_sym}
|
33
|
+
find_section(list)
|
34
|
+
end
|
35
|
+
|
30
36
|
|
31
37
|
def import(raw_s)
|
32
38
|
|
@@ -170,6 +176,26 @@ class SectionX
|
|
170
176
|
v.gsub('&','&').gsub('<','<').gsub('>','>')
|
171
177
|
end
|
172
178
|
|
179
|
+
# Returns the XML element
|
180
|
+
#
|
181
|
+
def find_section(a)
|
182
|
+
|
183
|
+
section = a.shift
|
184
|
+
|
185
|
+
found = @doc.root.xpath('sections/section').find do |e|
|
186
|
+
title = e.attributes[:title]
|
187
|
+
title.gsub(/\s+/,'_').downcase.to_sym == section if title
|
188
|
+
end
|
189
|
+
|
190
|
+
return unless found
|
191
|
+
|
192
|
+
if a.length > 1 then
|
193
|
+
found.find_section(a)
|
194
|
+
else
|
195
|
+
a.length > 0 ? found.element('summary/' + a[0].to_s) : found
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
173
199
|
def indent_heading(s, heading='#')
|
174
200
|
|
175
201
|
a = s.split(/(?=^\s*#{heading}\s*[\[\w])/).map do |x|
|
@@ -223,6 +249,8 @@ class SectionX
|
|
223
249
|
[attributes, summary, sections]
|
224
250
|
end
|
225
251
|
|
252
|
+
|
253
|
+
|
226
254
|
end
|
227
255
|
|
228
256
|
if __FILE__ == $0 then
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
lPw+nNEEQBBBOO6255zdlyzYtxsHXnEKJYvUjl4/Z/YIa2Y+VgLolw8kPC0Z0Ztw
|
36
36
|
TLvN099jf8wfGlEJ/VkEKkXV
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-10-
|
38
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|