rexleparser 0.5.1 → 0.5.2
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 +20 -9
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 1541fbb74cf785e0ff1c38ae076d570372fbf468
|
4
|
+
data.tar.gz: 33c1b4d431157a46e45c4fd30a92f97aa1cae272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af15120d4030641f0ec8063fa4e0ebb6f43e1b08ea89075e938031100c1701718867376219fa94d76b443c1600ec9769ebe0f7435b985fb6e113e051fd510bd
|
7
|
+
data.tar.gz: bbee51bcc5625bfd0d9e97d6f5dc168d1cecf958a7d56839916044514ba0e56389017c84772fcd217f2f294f69652cb7c073c532e98626dab2a5b21cf42d126d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rexleparser.rb
CHANGED
@@ -24,11 +24,11 @@ class RexleParser
|
|
24
24
|
|
25
25
|
|
26
26
|
def scan_next(r, tagname)
|
27
|
-
|
27
|
+
|
28
28
|
j = tagname
|
29
29
|
|
30
30
|
if (r =~ /^>/) == 0 then
|
31
|
-
|
31
|
+
|
32
32
|
# end tag match
|
33
33
|
tag = r[/^>[^<]+</]
|
34
34
|
|
@@ -49,17 +49,24 @@ class RexleParser
|
|
49
49
|
broken_tag = tag
|
50
50
|
return [:child, [nil, [], broken_tag]] if broken_tag
|
51
51
|
|
52
|
-
elsif tag[
|
53
|
-
|
52
|
+
elsif tag[/^>--.*--!</] then
|
53
|
+
|
54
54
|
# it's a comment tag
|
55
|
-
return [:child,
|
55
|
+
return [:child, create_comment(tag)]
|
56
56
|
else
|
57
57
|
|
58
58
|
text, tag = tag.sub('>',';tg&').split(/>/,2)
|
59
59
|
r.prepend '>' + tag
|
60
60
|
return [:child, text]
|
61
|
-
end
|
61
|
+
end
|
62
|
+
|
63
|
+
elsif tag[/^>--.*--!</m] then
|
64
|
+
|
65
|
+
i = r =~ /--!</
|
66
|
+
tag = r.slice!(0,i+4)
|
62
67
|
|
68
|
+
# it's a comment tag
|
69
|
+
return [:child, create_comment(tag)]
|
63
70
|
else
|
64
71
|
|
65
72
|
# it's a start tag?
|
@@ -75,6 +82,11 @@ class RexleParser
|
|
75
82
|
end
|
76
83
|
end
|
77
84
|
|
85
|
+
def create_comment(tag)
|
86
|
+
tagname = '-!'
|
87
|
+
return [">#{tagname}<", [tag[/>--(.*)--!</m,1]], ">#{tagname}/<"]
|
88
|
+
end
|
89
|
+
|
78
90
|
def parse_node(r, j=nil)
|
79
91
|
|
80
92
|
return unless r.length > 0
|
@@ -87,8 +99,7 @@ class RexleParser
|
|
87
99
|
tag += r.slice!(0,i+5)
|
88
100
|
|
89
101
|
# it's a comment tag
|
90
|
-
|
91
|
-
return [">#{tagname}<", [tag[/>--(.*)--!</,1]], ">#{tagname}/<"]
|
102
|
+
return create_comment tag
|
92
103
|
end
|
93
104
|
|
94
105
|
tagname = tag[/([\w!]+)\/?<$/,1]
|
@@ -159,4 +170,4 @@ class RexleParser
|
|
159
170
|
|
160
171
|
return [tag[/[!\-\w\[]+/], ltext, get_attributes(tag), *r]
|
161
172
|
end
|
162
|
-
end
|
173
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|