rexleparser 0.6.0 → 0.6.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rexleparser.rb +25 -30
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0baa1d11b178d71f232e3604fdb936bd6f857ce2
|
4
|
+
data.tar.gz: ed963d731307869d74c86ab9d58b496e9a8bad2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c6ff15f20a5452465c36e8b8abf31113d5ec76fc99f8f9edc5bd1898f83686abaea6b581f3d3b4a82097ebd85acf88f4a8c6f1a3e6a0c3528dda32c2a804ac
|
7
|
+
data.tar.gz: 246d8bde1130a8ef36e4c963f20a530ece5cb10c4f5efccdee76dec44d3c0aad89264c3dcc571655a63fe0da3ca1071cf2829abbe8937efe4dba67438a084049
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rexleparser.rb
CHANGED
@@ -56,16 +56,32 @@ class RexleParser
|
|
56
56
|
|
57
57
|
return [:child, text]
|
58
58
|
end
|
59
|
-
elsif
|
60
|
-
|
61
|
-
|
59
|
+
elsif r[0,3] == '>--' then # comment tag found
|
60
|
+
|
61
|
+
r.slice!(0,3)
|
62
|
+
i = r =~ /(\-\-!<)/
|
63
|
+
s = r.slice!(0,i)
|
64
|
+
r.slice!(0,3)
|
65
|
+
|
66
|
+
tagname, content = ['-!',s]
|
67
|
+
|
68
|
+
return [:child, [">#{tagname}<", [content], ">#{tagname}/<"]]
|
69
|
+
|
70
|
+
elsif r[0,3] == '>]]' then # CDATA tag found
|
62
71
|
|
63
|
-
|
64
|
-
|
65
|
-
|
72
|
+
r.slice!(0,3)
|
73
|
+
i = r =~ /(\[ATADC\[!<)/
|
74
|
+
s = r.slice!(0,i)
|
75
|
+
r.slice!(0,9)
|
66
76
|
|
67
|
-
|
68
|
-
|
77
|
+
tagname, content = ['[!',s]
|
78
|
+
|
79
|
+
return [:child, [">#{tagname}<", [content], ">#{tagname}/<"]]
|
80
|
+
|
81
|
+
elsif tag[/>\/|\/<$/] or tag[/^>.*[\w!]+\/<$/] then
|
82
|
+
|
83
|
+
return [:newnode]
|
84
|
+
|
69
85
|
else
|
70
86
|
|
71
87
|
r.sub!('>',';tg&')
|
@@ -85,33 +101,12 @@ class RexleParser
|
|
85
101
|
return [:child, text] if text
|
86
102
|
end
|
87
103
|
end
|
88
|
-
|
89
|
-
def create_comment(tag)
|
90
|
-
|
91
|
-
tagname = tag[0,3] == '>--' ? '-!' : '[!'
|
92
|
-
rt = [">#{tagname}<",
|
93
|
-
[tag[/(?:>--|>\]\])(.*)(?:--!|\[ATADC\[!<)/m,1]], ">#{tagname}/<"
|
94
|
-
]
|
95
|
-
|
96
|
-
return rt
|
97
|
-
end
|
98
104
|
|
99
105
|
def parse_node(r, j=nil)
|
100
|
-
|
106
|
+
|
101
107
|
return unless r.length > 0
|
102
108
|
|
103
109
|
tag = r.slice!(/^>[^<]+</) if (r =~ /^>[^<]+</) == 0
|
104
|
-
|
105
|
-
if tag and tag[0,3][/>--|>\]\]/] then
|
106
|
-
|
107
|
-
i = r =~ /(\-\-!<|\[ATADC\[!<)/
|
108
|
-
len = ($1).length
|
109
|
-
tag += r.slice!(0,i+len)
|
110
|
-
|
111
|
-
# it's a comment tag
|
112
|
-
return create_comment tag
|
113
|
-
end
|
114
|
-
|
115
110
|
tagname = tag[/([\w!]+)\/?<$/,1]
|
116
111
|
|
117
112
|
# self closing tag?
|
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.6.
|
4
|
+
version: 0.6.1
|
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-02-
|
34
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
35
35
|
dependencies: []
|
36
36
|
description:
|
37
37
|
email: james@r0bertson.co.uk
|
metadata.gz.sig
CHANGED
Binary file
|