line-tree 0.3.18 → 0.3.19
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/lib/line-tree.rb +32 -5
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c984ae8961ad00a19254cd4ec33088a29d93f5
|
4
|
+
data.tar.gz: 2f3ad9ac8dc9c01e73ef1114df8822ae8c6ffe77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe21e459cfff31adb62578d27201dc5340a0ab6a14530113db26c8f20c4a0c766e7536f0eb916c6dd8ca592fa9874e98a5cc4c892b0387ad0d9e604dbadb0f08
|
7
|
+
data.tar.gz: 889cf085ce38d1162542c0a23d809967a2f88f735ece472be5778017b86d7dba4b0bfa9e5fc89819fd703b53e471dfd5e03264075f773c2581773c24c5fdc350
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/line-tree.rb
CHANGED
@@ -36,12 +36,25 @@ class LineTree
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def scan_a(a)
|
39
|
+
|
40
|
+
s = a.shift
|
41
|
+
r = s.match(/('[^']+[']|[^\s]+)\s*(\{[^\}]+\})?\s*(.*)/m)
|
42
|
+
.captures.values_at(0,-1,1)
|
43
|
+
|
44
|
+
if r.last then
|
45
|
+
|
46
|
+
r[-1] = get_attributes(r.last)
|
47
|
+
|
48
|
+
elsif s[/(\w+\s*=\s*["'])/]
|
49
|
+
|
50
|
+
raw_attributes, value = s.split(/(?=[^'"]+$)/,2)
|
51
|
+
r[-1] = get_xml_attributes raw_attributes
|
52
|
+
r[1] = value.strip
|
39
53
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
r[-1] = get_attributes(r.last) if r.last
|
54
|
+
end
|
55
|
+
|
44
56
|
a.map {|x| r << scan_a(x.clone) } if a.is_a? Array
|
57
|
+
|
45
58
|
r
|
46
59
|
end
|
47
60
|
|
@@ -54,5 +67,19 @@ class LineTree
|
|
54
67
|
|
55
68
|
Hash[*a.flatten]
|
56
69
|
end
|
70
|
+
|
71
|
+
def get_xml_attributes(raw_attributes)
|
72
|
+
|
73
|
+
r1 = /([\w\-:]+\='[^']*)'/
|
74
|
+
r2 = /([\w\-:]+\="[^"]*)"/
|
75
|
+
|
76
|
+
r = raw_attributes.scan(/#{r1}|#{r2}/).map(&:compact).flatten.inject({}) do |r, x|
|
77
|
+
attr_name, val = x.split(/=/,2)
|
78
|
+
r.merge(attr_name.to_sym => val[1..-1])
|
79
|
+
end
|
80
|
+
|
81
|
+
return r
|
82
|
+
end
|
83
|
+
|
57
84
|
|
58
|
-
end
|
85
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: line-tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
ErtlSTAImlBCK8q5BS4jBBt8VAEpNdkWpWbtDtLPA639pW2QWIcPx13ObWJh7Ejk
|
32
32
|
THoVqqsHTfeg3g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-
|
34
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle
|
metadata.gz.sig
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
�WX�DE���V��r�v/�"P�wd�i�sy�;ʅ�fb>tEC�(�
|
1
|
+
�_
|
2
|
+
M�T���3U^Om0���ʅ�#�h��CG��y-7�f
|
3
|
+
S�׆z�ɈNLO�3�������Io���S�xC���c)��P�6M/*ijl
|
4
|
+
3�6����C8;g!1+ZQM͡'�?��?�^V�Wܰ�%G�b�����E��+����*�!�ll��p{E�cO馠)ڷY9�a%�:I����gTt�-@nq�����%�٠yM|��~���D�Fx\<y$Q���_�DM���ٚ]�BfzY"����
|