rexleparser 0.5.2 → 0.5.3

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: 1541fbb74cf785e0ff1c38ae076d570372fbf468
4
- data.tar.gz: 33c1b4d431157a46e45c4fd30a92f97aa1cae272
3
+ metadata.gz: 150be4b182e230e32a34e4de0d0b66476786c5b4
4
+ data.tar.gz: 7b28f8bb1181a3d3938c938d4f06368aaf5409d1
5
5
  SHA512:
6
- metadata.gz: 8af15120d4030641f0ec8063fa4e0ebb6f43e1b08ea89075e938031100c1701718867376219fa94d76b443c1600ec9769ebe0f7435b985fb6e113e051fd510bd
7
- data.tar.gz: bbee51bcc5625bfd0d9e97d6f5dc168d1cecf958a7d56839916044514ba0e56389017c84772fcd217f2f294f69652cb7c073c532e98626dab2a5b21cf42d126d
6
+ metadata.gz: 1d3e71bcab648bca2e19d6058897cecd2046c6cce45e3c7d6ee0017817a2585b3fa5cecda50cffd1c892a5ff69f865d2f5a422cf51722f88967b9894f85942fc
7
+ data.tar.gz: 7edbfbd4936878a5b8b462a6daa421eaea7ce96e127d4b5e427c383776cf7930382a3ffe7131a30ecc7691323acdcd222763de1f98acebbe8b427deff222c36b
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rexleparser.rb CHANGED
@@ -14,8 +14,7 @@ class RexleParser
14
14
  @instructions = s.scan(/<\?([\w-]+) ([^>]+)\?>/)
15
15
  @doctype = s.slice!(/<!DOCTYPE html>\n?/)
16
16
 
17
- s2 = s.gsub('<![CDATA[','<!--').gsub(']]>','-->')
18
- @to_a = reverse(parse_node(s2.strip.gsub(/<\?[^>]+>/,'').reverse))
17
+ @to_a = reverse(parse_node(s.strip.gsub(/<\?[^>]+>/,'').reverse))
19
18
 
20
19
  end
21
20
 
@@ -27,7 +26,7 @@ class RexleParser
27
26
 
28
27
  j = tagname
29
28
 
30
- if (r =~ /^>/) == 0 then
29
+ if r[0][/^>/] then
31
30
 
32
31
  # end tag match
33
32
  tag = r[/^>[^<]+</]
@@ -49,7 +48,7 @@ class RexleParser
49
48
  broken_tag = tag
50
49
  return [:child, [nil, [], broken_tag]] if broken_tag
51
50
 
52
- elsif tag[/^>--.*--!</] then
51
+ elsif tag[/^(?:>--|>\]\]).*(?:--!|\[ATADC\[!<)/] then
53
52
 
54
53
  # it's a comment tag
55
54
  return [:child, create_comment(tag)]
@@ -60,10 +59,11 @@ class RexleParser
60
59
  return [:child, text]
61
60
  end
62
61
 
63
- elsif tag[/^>--.*--!</m] then
62
+ elsif tag[/^(?:>--|>\]\]).*(?:--!|\[ATADC\[!<)/m] then
64
63
 
65
- i = r =~ /--!</
66
- tag = r.slice!(0,i+4)
64
+ i = r =~ /(\-\-!<|\[ATADC\[!<)/
65
+ len = ($1).length
66
+ tag = r.slice!(0,i+len)
67
67
 
68
68
  # it's a comment tag
69
69
  return [:child, create_comment(tag)]
@@ -83,21 +83,28 @@ class RexleParser
83
83
  end
84
84
 
85
85
  def create_comment(tag)
86
- tagname = '-!'
87
- return [">#{tagname}<", [tag[/>--(.*)--!</m,1]], ">#{tagname}/<"]
86
+
87
+ tagname = tag[0,3] == '>--' ? '-!' : '[!'
88
+ rt = [">#{tagname}<",
89
+ [tag[/(?:>--|>\]\])(.*)(?:--!|\[ATADC\[!<)/m,1]], ">#{tagname}/<"
90
+ ]
91
+
92
+ return rt
88
93
  end
89
94
 
90
95
  def parse_node(r, j=nil)
91
-
96
+
92
97
  return unless r.length > 0
93
98
 
94
99
  tag = r.slice!(/^>[^<]+</) if (r =~ /^>[^<]+</) == 0
95
100
 
96
- if tag and tag[0,3] == '>--' then
101
+ if tag and tag[0,3][/>--|>\]\]/] then
97
102
 
98
- i = r =~ /<--/
99
- tag += r.slice!(0,i+5)
100
-
103
+ i = r =~ /(\-\-!<|\[ATADC\[!<)/
104
+ len = ($1).length
105
+ tag += r.slice!(0,i+len)
106
+
107
+ #exit
101
108
  # it's a comment tag
102
109
  return create_comment tag
103
110
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexleparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  CkjTMLaPwIQI6dsbG4bVJ7/XzL7c8niqJSF7M0yr1+2kUrWFUZMBMrUUxgZxSkjL
32
32
  Cgd76bp2zjiyCw==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-01-25 00:00:00.000000000 Z
34
+ date: 2015-01-26 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- ��ȋ0�<kg�c6�˷����^�S�U���GR?�r(�����#�J1 }��Ra��ma��a���|���i��U/�Y }A׶�^r�ѿ}��u��dX� WU�H�٫���m�;
1
+ ��ؠ������eER��&U�_����z�9}�z�k��?��v���u��ʎ��tuz��5㞞�BsP���13w��$d&:;����{ȱ��'��j 9��HL����鸻��|fn'��'��.�����]ˤx���Af�ۮ@“�2�ma�����v�Z���v�m��L��TUC����P���I%f-�p��H�����,�%�˳i\�9+'��]T>���h)�5���=�j�m/�\/