rexle 1.3.23 → 1.3.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rexle.rb +22 -12
- 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: 50783241717d52838cb563f1597366f8c7ed5fb3
|
4
|
+
data.tar.gz: 53abc4c8932cb1c4945ed414bc731931797f4b39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ac63ab6be0d1d501be89d8515cb37cfa48ef31993f8a2fe0ed3b70d96e2e209b336d7c80a64a60b8d1db4925285995073ba38ecc62ce92503b02811ede58a7c
|
7
|
+
data.tar.gz: 4dd0880b32a643bb98cd39002ae983df5a085514cfd54483ed55be7a89bb6937fefcfdcccd301229f44f57ef3365b1219e2101a010e061f0ddec68d92eac67ad
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.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
|
+
# 22-Apr-2016: feature: Using an XPath A pure logic predicate can now be
|
16
|
+
# processed e.g. (4 % 1) != 1
|
15
17
|
# 21-Apr-2016: feature: The xpath() method now returns a Rexle::Recordset object
|
16
18
|
# which itself can be treat as a Rexle document
|
17
19
|
# An xpath predicate can now contain the mod operator as well as
|
@@ -411,6 +413,7 @@ class Rexle
|
|
411
413
|
alias previous_sibling previous_element
|
412
414
|
|
413
415
|
def xpath(path, rlist=[], &blk)
|
416
|
+
|
414
417
|
#@log.debug 'inside xpath ' + path.inspect
|
415
418
|
|
416
419
|
r = filter_xpath(path, rlist=[], &blk)
|
@@ -461,7 +464,6 @@ class Rexle
|
|
461
464
|
}
|
462
465
|
bucket = []
|
463
466
|
raw_results = path.split('|').map do |xp|
|
464
|
-
|
465
467
|
query_xpath(xp.strip, bucket, &blk)
|
466
468
|
end
|
467
469
|
|
@@ -489,7 +491,6 @@ class Rexle
|
|
489
491
|
}
|
490
492
|
bucket = []
|
491
493
|
raw_results = path.split('|').map do |xp|
|
492
|
-
|
493
494
|
query_xpath(xp.strip, bucket, &blk)
|
494
495
|
end
|
495
496
|
|
@@ -497,7 +498,7 @@ class Rexle
|
|
497
498
|
results = raw_results # .flatten.select {|x| x}
|
498
499
|
|
499
500
|
procs[results.class.to_s.to_sym].call(results) if results
|
500
|
-
|
501
|
+
|
501
502
|
else
|
502
503
|
|
503
504
|
m, xpath_value, index = fn_match.captures
|
@@ -526,7 +527,7 @@ class Rexle
|
|
526
527
|
xpath_value = raw_xpath_value.sub('child::','./')
|
527
528
|
|
528
529
|
if xpath_value[/^[\w\/]+\s*=.*/] then
|
529
|
-
|
530
|
+
|
530
531
|
flag_func = true
|
531
532
|
|
532
533
|
xpath_value.sub!(/^\w+\s*=.*/,'.[\0]')
|
@@ -535,7 +536,7 @@ class Rexle
|
|
535
536
|
end
|
536
537
|
|
537
538
|
raw_path, raw_condition = xpath_value.sub(/^\.?\/(?!\/)/,'')\
|
538
|
-
.match(/([^\[]+)(\[[^\]]+\])?/).captures
|
539
|
+
.match(/([^\[]+)(\[[^\]]+\])?/).captures
|
539
540
|
|
540
541
|
remaining_path = ($').to_s
|
541
542
|
|
@@ -549,7 +550,7 @@ class Rexle
|
|
549
550
|
end
|
550
551
|
|
551
552
|
r = raw_path[/^([^\/]+)(?=\/\/)/,1]
|
552
|
-
|
553
|
+
|
553
554
|
if r then
|
554
555
|
a_path = raw_path.split(/(?=\/\/)/,2)
|
555
556
|
else
|
@@ -577,13 +578,16 @@ class Rexle
|
|
577
578
|
|
578
579
|
# isolate the xpath to return just the path to the current element
|
579
580
|
|
580
|
-
elmnt_path = s[/^([
|
581
|
+
elmnt_path = s[/^([a-zA-Z:\-\*]+\[[^\]]+\])|[\/]+{,2}[^\/]+/]
|
582
|
+
|
581
583
|
element_part = elmnt_path[/(^@?[^\[]+)?/,1] if elmnt_path
|
582
584
|
|
583
585
|
if element_part then
|
584
586
|
|
585
587
|
unless element_part[/^(@|[@\.\w]+[\s=])/] then
|
586
588
|
element_name = element_part[/^[\w:\-\*\.]+/]
|
589
|
+
|
590
|
+
condition = raw_xpath_value unless element_name
|
587
591
|
|
588
592
|
else
|
589
593
|
if xpath_value[/^\[/] then
|
@@ -601,7 +605,7 @@ class Rexle
|
|
601
605
|
end
|
602
606
|
|
603
607
|
end
|
604
|
-
|
608
|
+
|
605
609
|
#element_name ||= '*'
|
606
610
|
raw_condition = '' if condition
|
607
611
|
|
@@ -655,7 +659,8 @@ class Rexle
|
|
655
659
|
|
656
660
|
remaining_xpath = raw_path[1..-1]
|
657
661
|
return remaining_xpath.empty? ? self : self.xpath(remaining_xpath)
|
658
|
-
|
662
|
+
elsif element_name.nil?
|
663
|
+
return eval attr_search
|
659
664
|
else
|
660
665
|
|
661
666
|
return_elements = @child_elements.map.with_index.select do |x, i|
|
@@ -1017,10 +1022,15 @@ class Rexle
|
|
1017
1022
|
def format_condition(condition)
|
1018
1023
|
|
1019
1024
|
raw_items = condition[1..-1].scan(/\'[^\']*\'|\"[^\"]*\"|\
|
1020
|
-
and|or|\d+|[
|
1025
|
+
and|or|\d+|[!=<>%]+|position\(\)|contains\([^\)]+\)|notx\([^\)]+\)|[@\w\.\/&;]+/)
|
1021
1026
|
|
1022
1027
|
if raw_items[0][/^\d+$/] then
|
1023
|
-
|
1028
|
+
|
1029
|
+
if condition[0 ] == '[' then
|
1030
|
+
return raw_items[0].to_i
|
1031
|
+
else
|
1032
|
+
return condition
|
1033
|
+
end
|
1024
1034
|
elsif raw_items[0] == 'position()' then
|
1025
1035
|
|
1026
1036
|
rrr = condition[1..-2].gsub(/position\(\)/,'i').gsub('<','<')\
|
@@ -1181,7 +1191,7 @@ class Rexle
|
|
1181
1191
|
end
|
1182
1192
|
elsif attr_search[/e\.xpath/] and eval(attr_search)
|
1183
1193
|
block_given? ? blk.call(e) : e
|
1184
|
-
elsif attr_search[/^\w
|
1194
|
+
elsif attr_search[/^\w*\(/] and e.element(attr_search)
|
1185
1195
|
block_given? ? blk.call(e) : e
|
1186
1196
|
end
|
1187
1197
|
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
pOw2Fx4uv9tO6wagRTcaHduxkh4jYfPDQI9mODFccHeY+wRLDGTENQwIILvMgEa7
|
32
32
|
50vRuyU+obGfjg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-04-
|
34
|
+
date: 2016-04-23 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexleparser
|
metadata.gz.sig
CHANGED
Binary file
|