rexle 1.0.29 → 1.0.30
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.tar.gz.sig +0 -0
- data/lib/rexle.rb +31 -13
- metadata +6 -6
- 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: adfbe5ba547c8ef5b5b716913eb8df7bc0f29e36
|
4
|
+
data.tar.gz: c9bc98299843537f4ee19a319e5d2d8baf8c2599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e73d745b1edccc86dfb6590004838fe671327bcb1e3a527617bd7b686892642d73d1b2ff7d4f85a495f4cf8160be0361e400638aa6e4ce463a50e64009c7483
|
7
|
+
data.tar.gz: 04d378818b56ed73dc244c13f674efa8e46bae7e75f7e7bcf23e5268e4d553e5a85546f0f5c773f9752f0b8a4ce767cbd092c9ed4500f764b77efdedcb85af3d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexle.rb
CHANGED
@@ -12,6 +12,9 @@ include REXML
|
|
12
12
|
|
13
13
|
# modifications:
|
14
14
|
|
15
|
+
# 26-Oct-2014: bug fix: XML output containing a class attribute,
|
16
|
+
# now appears as a string. Empty nodes are
|
17
|
+
# now displayed as self-closing tags.
|
15
18
|
# 21-Oct-2014: partial feature: An Xpath containing //preceding-sibling and
|
16
19
|
# //following-sibling now works
|
17
20
|
# 19-Oct-2014: feature: An XPath containing the attribute @class is
|
@@ -94,7 +97,9 @@ module XMLhelper
|
|
94
97
|
def doc_print(children, declaration=true)
|
95
98
|
|
96
99
|
body = (children.nil? or children.empty? or children.is_an_empty_string? ) ? '' : scan_print(children).join
|
97
|
-
a = self.root.attributes.to_a.map
|
100
|
+
a = self.root.attributes.to_a.map do |k,v|
|
101
|
+
"%s='%s'" % [k,(v.is_a?(String) ? v : v.join(' '))]
|
102
|
+
end
|
98
103
|
xml = "<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : \
|
99
104
|
' ' + a.join(' '), body, self.root.name]
|
100
105
|
|
@@ -108,7 +113,11 @@ module XMLhelper
|
|
108
113
|
def doc_pretty_print(children, declaration=true)
|
109
114
|
|
110
115
|
body = pretty_print(children,2).join
|
111
|
-
|
116
|
+
|
117
|
+
a = self.root.attributes.to_a.map do |k,v|
|
118
|
+
"%s='%s'" % [k,(v.is_a?(String) ? v : v.join(' '))]
|
119
|
+
end
|
120
|
+
|
112
121
|
ind = "\n "
|
113
122
|
xml = "<%s%s>%s%s%s</%s>" % [self.root.name, a.empty? ? '' : \
|
114
123
|
' ' + a.join(' '), ind, body, "\n", self.root.name]
|
@@ -138,7 +147,9 @@ module XMLhelper
|
|
138
147
|
"<![CDATA[%s]]>" % x.value
|
139
148
|
else
|
140
149
|
|
141
|
-
a = x.attributes.to_a.map
|
150
|
+
a = x.attributes.to_a.map do |k,v|
|
151
|
+
"%s='%s'" % [k,(v.is_a?(String) ? v : v.join(' '))]
|
152
|
+
end
|
142
153
|
tag = x.name + (a.empty? ? '' : ' ' + a.join(' '))
|
143
154
|
|
144
155
|
if (x.value and x.value.length > 0) \
|
@@ -196,20 +207,27 @@ module XMLhelper
|
|
196
207
|
"<![CDATA[%s]]>" % x.value
|
197
208
|
else
|
198
209
|
#return ["<%s/>" % x.name] if x.value = ''
|
199
|
-
a = x.attributes.to_a.map
|
210
|
+
a = x.attributes.to_a.map do |k,v|
|
211
|
+
"%s='%s'" % [k,(v.is_a?(String) ? v : v.join(' '))]
|
212
|
+
end
|
200
213
|
a ||= []
|
201
214
|
tag = x.name + (a.empty? ? '' : ' ' + a.join(' '))
|
202
|
-
|
203
215
|
start = i > 0 ? ("\n" + ' ' * (indent - 1)) : ''
|
216
|
+
|
217
|
+
if (x.value and x.value.length > 0) \
|
218
|
+
or (x.children and x.children.length > 0 \
|
219
|
+
and not x.children.is_an_empty_string?) then
|
204
220
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
221
|
+
ind1 = (x.children and x.children.grep(Rexle::Element).length > 0) ?
|
222
|
+
("\n" + ' ' * indent) : ''
|
223
|
+
|
224
|
+
out = ["%s<%s>%s" % [start, tag, ind1]]
|
225
|
+
out << pretty_print(x.children, (indent + 1).to_s.clone)
|
226
|
+
ind2 = (ind1 and ind1.length > 0) ? ("\n" + ' ' * (indent - 1)) : ''
|
227
|
+
out << "%s</%s>" % [ind2, x.name]
|
228
|
+
else
|
229
|
+
out = ["%s<%s/>" % [start, tag]]
|
230
|
+
end
|
213
231
|
end
|
214
232
|
elsif x.is_a? String then
|
215
233
|
x.sub(/^[\n\s]+$/,'')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
UOGKUMV5RApHDnC0ywMYNe0HK7qMSTP5YLKs8JUjNxpc5jl8+o3D3sHkNN4DzbQm
|
32
32
|
jVfzDZ+niKvAUA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-10-
|
34
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexleparser
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: '0.4'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.4.
|
45
|
+
version: 0.4.18
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: '0.4'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.4.
|
55
|
+
version: 0.4.18
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: dynarex-parser
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: '0.1'
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.1.
|
125
|
+
version: 0.1.3
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
version: '0.1'
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 0.1.
|
135
|
+
version: 0.1.3
|
136
136
|
description:
|
137
137
|
email: james@r0bertson.co.uk
|
138
138
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|