rexle 1.3.11 → 1.3.12
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/rexle.rb +14 -110
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +2 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa592529a22ca868034bf22230fa75104957f20
|
4
|
+
data.tar.gz: 4ba3ca79125eccedb15da3412c83be0e2e33c0a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63eaf4b94472ad4dbe94902a7487fe5b459a92cd8018226533d742c5dae1f9539854b2eab8673236f3699fc111937f2535d319a4ff0ade93ae67fc39f47fb50
|
7
|
+
data.tar.gz: 955037cf173c6da4d96a0716d44ac7f9146d45c10411c323f9427f8f4e043327d6327a3783f840781a238804df6b0f48022baf813caf5535986c61c5b3ef07f7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rexle.rb
CHANGED
@@ -12,6 +12,8 @@ require 'backtrack-xpath'
|
|
12
12
|
|
13
13
|
# modifications:
|
14
14
|
|
15
|
+
# 12-Mar-2016: A predicate can now handle position() with the
|
16
|
+
# equality operator e.g. b[position() = 2]
|
15
17
|
# 09-Mar-2016: bug fix: '.' now returns the current element
|
16
18
|
# 02-Mar-2016: improvement: When handling the HTML element iframe, it
|
17
19
|
# is no longer printed as a self-closing tag
|
@@ -56,111 +58,7 @@ require 'backtrack-xpath'
|
|
56
58
|
# Now stores any comment elements as well as printing them.
|
57
59
|
# 07-Feb-2015: Implemented XPath function last() e.g.
|
58
60
|
# doc.root.xpath('records/item[last()]')
|
59
|
-
|
60
|
-
# Rexle::Element#texts now transforms all items to a String
|
61
|
-
# 04-Feb-2015: An xpath containing text() now calls texts() to
|
62
|
-
# return all strings within that element
|
63
|
-
# 03-Feb-2015: feature: Rexle::Element#text now includes the unescape method
|
64
|
-
# 30-Jan-2015: Rexle::Element#texts now returns the values of
|
65
|
-
# CData elements as well as strings
|
66
|
-
# 29-Jan-2015: Removed code references to REXML, as it was no longer needed.
|
67
|
-
# feature: Implemented Rexle::Element#cdatas. A CData element is
|
68
|
-
# now created from the parsing stage.
|
69
|
-
# 26-Jan-2015: bug fix: An element containing a nil value is now treated as an
|
70
|
-
# empty string when quering with an XPath
|
71
|
-
# 25-Dec-2014: bug fix: script tag is now formatted with expected attributes
|
72
|
-
# 21-Dec-2014: HTML related: A script tag will no longer be a self-closing tag.
|
73
|
-
# 20-Dec-2014: bug fix: Fixes an uncommon XPath selection.
|
74
|
-
# see http://www.jamesrobertson.eu/bugtracker/2014/dec/18/xpath-returns-an-empty-list.html
|
75
|
-
# 07-Dec-2014: feature: The Rexle::Element#Css() parameter can now contain
|
76
|
-
# multiple css paths within the string e.g. '.abc, div'
|
77
|
-
# 30-Nov-2014: feature: XPath now supports parent (..) traversal e.g. b/../b2
|
78
|
-
# 21-Nov-2014: feature: Added at_css() to select a single element
|
79
|
-
# 27-Oct-2014: bug fix: Now Checks for an array instead of a string when
|
80
|
-
# outputting xml attribute values to get
|
81
|
-
# around nil values
|
82
|
-
# 26-Oct-2014: bug fix: XML output containing a class attribute,
|
83
|
-
# now appears as a string. Empty nodes are
|
84
|
-
# now displayed as self-closing tags.
|
85
|
-
# An XPath containing a @class attribute is now
|
86
|
-
# first validated against the element attribute existence
|
87
|
-
# Rexle::Element#attribute now checks the attributes type
|
88
|
-
# 21-Oct-2014: partial feature: An Xpath containing //preceding-sibling and
|
89
|
-
# //following-sibling now works
|
90
|
-
# 19-Oct-2014: feature: An XPath containing the attribute @class is
|
91
|
-
# now treated as a type of CSS selector storage area
|
92
|
-
# feature: Implemented Rexle::Element#previous_element and
|
93
|
-
# Rexle::Element#next_element
|
94
|
-
|
95
|
-
# 13-Oct-2014: feature: Implemented Rexle#clone
|
96
|
-
# 12-Oct-2014: feature: Implemented CSS style element selection
|
97
|
-
# 27-Sep-2014: bug fix: ELement values are now explicitly transformed to string
|
98
|
-
# 16-Sep-2014: Feature: Impelemented Rexle::Element#each_recursive
|
99
|
-
# 07-Aug-2014: feature: Rexle::CData can now be used to create CDATA
|
100
|
-
# 12-Jul-2014: XPath with a single element condition now works e.g. b[c]
|
101
|
-
# 07-Jun-2014: bug fix: An XPath nested within an XPath (using a selector)
|
102
|
-
# should now wok properly e.g. record/abc[item/xyz="red"]
|
103
|
-
# 04-Jun-2014: bug fix: If XPath contains /text(), only valid
|
104
|
-
# text elements are returned
|
105
|
-
# 03-Jun-2014: bug fix: Text elements are now nil by default
|
106
|
-
# 01-Jun-2014: bug fix: XPath elements separated by a pipe '|' are now
|
107
|
-
# stripped of white space
|
108
|
-
# 20-May-2014: feature: XPath Descendants after the element (or without
|
109
|
-
# the element) are now supported
|
110
|
-
# 02-Apr-2014: bug fix: Rexle::Element#each now returns the children,
|
111
|
-
# including the 1st text element
|
112
|
-
# 24-Mar-2014: minor bug fix: A blank line is no longer inserted at the
|
113
|
-
# top of the XML document
|
114
|
-
# 14-Mar-2014: bug fix: An XML processing instruction will now only be
|
115
|
-
# display if declaration = true
|
116
|
-
# 12-Mar-2014: bug fix: Duplicate processing instruction bug fixed
|
117
|
-
# 17-Jan-2014: bug fix: Rexle::Element to_a now returns all child elements
|
118
|
-
# 31-Dec-2013: feature: now supports processing instructions
|
119
|
-
# 18-Dec-2013: feature fix: the result of text() is no longer unescaped
|
120
|
-
# 13-Dec-2013: bug fix: elements with dashes can now be queried
|
121
|
-
# 14-Nov-2013: feature: Implemented method content() to output XML as
|
122
|
-
# unescaped plain text
|
123
|
-
# 08-Nov-2013: An element will now only be deleted if it has a parent
|
124
|
-
# 05-Nov-2013: If a node is added to the document which already exists in the
|
125
|
-
# node, it will be moved accordingly.
|
126
|
-
# 05-Nov02013: XPath bug fix: recursive selector with conditional parent now
|
127
|
-
# returns the correct child e.g. //b[2]/c
|
128
|
-
# 10-Oct-2013: bug fix: child elements which have the same name as their parent
|
129
|
-
# are now select correctly through XPath
|
130
|
-
# 22-sep-2013: feature: remove() is now an alias of delete()
|
131
|
-
# 30-jul-2013: feature: Rexle::Element#xml now accepts an xpath
|
132
|
-
# 25-jun-2013: bug fix: doc.root.delete(xpath) fixed
|
133
|
-
# 10-Nov-2012: Elements can now be added starting from an empty document
|
134
|
-
# 06-Nov-2012: additional xpath predicate now implemented e.g.
|
135
|
-
# fun/. > 200 => [false, false, true, true]
|
136
|
-
# 21-Oct-2012: xpath predicate now implemented e.g. fun/@id='4' => true
|
137
|
-
# 20-Oct-2012: feature: added Rexle::Element#texts which is the equivalent
|
138
|
-
# of REXML::Element#texts
|
139
|
-
# feature: Rexle::Element#add_text is now the equivalent of
|
140
|
-
# REXML::Element#add_text
|
141
|
-
# 10-Sep-2012: bug fix: Removed code from method pretty_print in order to
|
142
|
-
# get the XML displayed properly
|
143
|
-
# 23-Aug-2012: feature: implemented xpath function contains()
|
144
|
-
# 17-Aug-2012: bug fix: pretty print now ignores text containing empty space
|
145
|
-
# 16-Aug-2012: the current element's text (if its not empty) is now returned
|
146
|
-
# from its children method
|
147
|
-
# 15-Aug-2012: feature: xpath containing child:: now supported
|
148
|
-
# 13-Aug-2012: bug fix: xpath can now handle the name() function
|
149
|
-
# 11-Aug-2012: bug fix: separated the max() method from 1 line into 3
|
150
|
-
# and that fixed it
|
151
|
-
# 08-Aug-2012: feature: added Element#insert_before and Element#insert_after
|
152
|
-
# 19-Jul-2012: Changed children to elements where appropriate
|
153
|
-
# 15-Jul-2012: bug fix: self.root.value is no longer appended
|
154
|
-
# to the body if there are no child elements
|
155
|
-
# 19-Jun-2012: a bug fix for .//*[@class]
|
156
|
-
# 17-Jun-2012: a couple of new xpath things are supported '.' and '|'
|
157
|
-
# 15-Apr-2012: bug fix: New element names are typecast as string
|
158
|
-
# 16-Mar-2012: bug fix: Element names which contain a colon can now be selected
|
159
|
-
# in the xpath.
|
160
|
-
# 22-Feb-2012: bug resolution: Deactivated the PolyrexParser; using RexleParser instead
|
161
|
-
# 14-Jan-2012: Implemented Rexle::Elements#each
|
162
|
-
# 21-Dec-2011: Bug fix: xpath modified to allow querying from the actual
|
163
|
-
# root rather than the 1st child element from the root
|
61
|
+
|
164
62
|
|
165
63
|
|
166
64
|
|
@@ -1093,7 +991,7 @@ class Rexle
|
|
1093
991
|
if raw_items[0][/^\d+$/] then
|
1094
992
|
return raw_items[0].to_i
|
1095
993
|
elsif raw_items[0] == 'position()' then
|
1096
|
-
rrr = "i %s %s" % [raw_items[1].gsub('<','<').gsub('>','>'), raw_items[-1]]
|
994
|
+
rrr = "i %s %s" % [raw_items[1].gsub('<','<').gsub('>','>').gsub('=','=='), raw_items[-1]]
|
1097
995
|
return rrr
|
1098
996
|
elsif raw_items[0][/^contains\(/]
|
1099
997
|
return raw_items[0]
|
@@ -1136,7 +1034,7 @@ class Rexle
|
|
1136
1034
|
|
1137
1035
|
if x.length >= 3 then
|
1138
1036
|
|
1139
|
-
x[1] = '==' if x[1] == '='
|
1037
|
+
#jr110316 x[1] = '==' if x[1] == '='
|
1140
1038
|
if x[0] != '.' then
|
1141
1039
|
if x[0][/\//] then
|
1142
1040
|
|
@@ -1223,10 +1121,14 @@ class Rexle
|
|
1223
1121
|
|
1224
1122
|
def attribute_search(attr_search, e, h, i=nil, &blk)
|
1225
1123
|
|
1226
|
-
if attr_search.is_a? Fixnum then
|
1124
|
+
r = if attr_search.is_a? Fixnum then
|
1227
1125
|
block_given? ? blk.call(e) : e if i == attr_search
|
1228
|
-
elsif attr_search[/i\s
|
1229
|
-
|
1126
|
+
elsif attr_search[/i\s(?:<|>|==)\s\d+/] then
|
1127
|
+
|
1128
|
+
if eval(attr_search) then
|
1129
|
+
block_given? ? blk.call(e) : e
|
1130
|
+
end
|
1131
|
+
|
1230
1132
|
elsif h and !h.empty? and attr_search[/^h\[/] and eval(attr_search) then
|
1231
1133
|
block_given? ? blk.call(e) : e
|
1232
1134
|
elsif attr_search[/^\(name ==/] and e.child_elements.select {|x|
|
@@ -1253,6 +1155,8 @@ class Rexle
|
|
1253
1155
|
elsif e.element attr_search then
|
1254
1156
|
block_given? ? blk.call(e) : e
|
1255
1157
|
end
|
1158
|
+
|
1159
|
+
r
|
1256
1160
|
end
|
1257
1161
|
|
1258
1162
|
def recursive_scan(nodes, &blk)
|
data.tar.gz.sig
CHANGED
Binary file
|
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.3.
|
4
|
+
version: 1.3.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
Tkua07gB3/nVO3aPg7C3vEbDZCxT3WAMli2uZisYT6ozmdAlDsixLjipgFN4If3z
|
32
32
|
Ej0QR3kvGcAvFQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-03-
|
34
|
+
date: 2016-03-12 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexleparser
|
metadata.gz.sig
CHANGED
@@ -1,4 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
J|Z;�#z���ʍi�y�!�9C*i��H�Z"��Nj���-8�'Q��d�E
|
4
|
-
�����
|
1
|
+
�+��cֹT�P���ryQ�~�]�N����מ�aJD�9�A0�� ��aa�*�s�˦�|��5�b����O��c(3?��M�������x��<P{��0��G����-��ބ�.C���翢ɖ��O��C:�(��%MNl�!!#�?���Vg��̃�<��ff
|
2
|
+
�p&�Ɋ��*sH�M<�e�Gd0�M��`l�B]¾�?�ΘY�c��GQ=���6i���T���N �0¢��
|