polyrex-links 0.4.1 → 0.4.2
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/polyrex-links.rb +8 -8
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86256bfb4e9270cadb10cb266ee9cb689f78acb29f8f59022cb97acb3765bc95
|
4
|
+
data.tar.gz: 489a261c8e3afb75dd57153fb1a8c16f38a9adf2e04876779fb9b2da5498b97e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad0eabd37defceab3c1c97a57bf369f81d8c72d0dd224bedd577e569dc1b1acdeaa97afb644fb4f7bd6aa0cdfbc18f7c07c61c13e13c8202e237c41dbdd988c
|
7
|
+
data.tar.gz: 76a4f2e4ae7932449a2cfb80e8efe5966886af0623d584fe740721d0f7bd9ec00bd66bda549e33f07ae97d3132daa5ca34a49810cdcd8f2cdd392e7df8455f0b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/polyrex-links.rb
CHANGED
@@ -6,11 +6,11 @@ require 'polyrex'
|
|
6
6
|
|
7
7
|
class PolyrexLinks < Polyrex
|
8
8
|
|
9
|
-
def initialize(rawx='links/link[
|
9
|
+
def initialize(rawx='links/link[title,url]', delimiter: ' # ', debug: false)
|
10
10
|
|
11
11
|
x, _ = RXFHelper.read(rawx)
|
12
12
|
obj = x.lstrip.sub(/<\?polyrex-links\?>/,
|
13
|
-
'<?polyrex schema="links/link[
|
13
|
+
'<?polyrex schema="links/link[title,url]" delimiter=" # "?>')
|
14
14
|
puts 'obj: ' + x.inspect if debug
|
15
15
|
|
16
16
|
super(obj)
|
@@ -21,7 +21,7 @@ class PolyrexLinks < Polyrex
|
|
21
21
|
|
22
22
|
def find(s)
|
23
23
|
|
24
|
-
found =
|
24
|
+
found = find_by_link_title s
|
25
25
|
|
26
26
|
if found then
|
27
27
|
|
@@ -39,7 +39,7 @@ class PolyrexLinks < Polyrex
|
|
39
39
|
s.sub(/<\?[^\?]+\?>/,'').lstrip)
|
40
40
|
|
41
41
|
pl.each_recursive do |x|
|
42
|
-
link, linkpath = find(x.
|
42
|
+
link, linkpath = find(x.title)
|
43
43
|
x.url = link.url if link and link.url
|
44
44
|
end
|
45
45
|
|
@@ -51,7 +51,7 @@ class PolyrexLinks < Polyrex
|
|
51
51
|
#
|
52
52
|
def link(s)
|
53
53
|
|
54
|
-
self.rxpath(s.split('/').map {|x| "link[
|
54
|
+
self.rxpath(s.split('/').map {|x| "link[title='%s']" % x}.join('/')).first
|
55
55
|
|
56
56
|
end
|
57
57
|
|
@@ -66,7 +66,7 @@ class PolyrexLinks < Polyrex
|
|
66
66
|
(a2 << a.clone; a.pop) while a.any?
|
67
67
|
return nil if a2.empty?
|
68
68
|
|
69
|
-
mask = "records/link[summary/
|
69
|
+
mask = "records/link[summary/title='%s']"
|
70
70
|
|
71
71
|
begin
|
72
72
|
c = a2.shift; xpath = c.map{|x| mask % x}.join + '/summary/url/text()'
|
@@ -103,7 +103,7 @@ class PolyrexLinks < Polyrex
|
|
103
103
|
def backtrack_path(e, a5=[])
|
104
104
|
|
105
105
|
backtrack_path(e.parent, a5) if e.parent?
|
106
|
-
a5 << e.
|
106
|
+
a5 << e.title
|
107
107
|
|
108
108
|
return a5
|
109
109
|
end
|
@@ -117,7 +117,7 @@ class PolyrexLinks < Polyrex
|
|
117
117
|
|
118
118
|
a.slice!(i..-1)
|
119
119
|
a[i] = record
|
120
|
-
yield(a.map(&:
|
120
|
+
yield(a.map(&:title).join('/'), record.url) if block_given?
|
121
121
|
|
122
122
|
end
|
123
123
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|