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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8aa4eab5f3e5548251694ed5d385fbd50eeceaac
4
- data.tar.gz: 30c4324e0058ffcaa7aa42c07e8017e48006af5a
3
+ metadata.gz: d7c984ae8961ad00a19254cd4ec33088a29d93f5
4
+ data.tar.gz: 2f3ad9ac8dc9c01e73ef1114df8822ae8c6ffe77
5
5
  SHA512:
6
- metadata.gz: 44f02bcb312dff828bd43ae1fe92edf28c48163b53e923e23f382f9a3ffd2dc6a350d3af6f852fbe1a0be5f44ecfe59ca6cffe9c05ab8f7aed3c5af405b80681
7
- data.tar.gz: 6533206b2194059abef61198e2b64821ece22c7be2752162a9e683f75e7d34a4311e23c6b1635df52426af1030147e0b59a32d510d508dedc407e2988fc3441c
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
- r = a.shift.match(/('[^']+[']|[^\s]+)\s*(\{[^\}]+\})?\s*(.*)/m)
41
- .captures.values_at(0,-1,1)
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.18
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-06-05 00:00:00.000000000 Z
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
- ΋���U��1�Ҿ�a7ⴷ�uv&�u��
2
- ��O^���}^�^E B-x㱣�1��^Sd�G��B;��TC���+y�4 a�m��{
3
- �[�)!�z;6
4
- .Vw�^%���
5
- �WX�DE���V��r�v/�"P�wd�i�sy�;ʅ�fb>tEC�(�
1
+ �_
2
+ MT���3U^Om0���ʅ�#�h��CG��y-7f
3
+ S�׆z�ɈNLO3�������Io���S�xC���c)��P6M/*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"����