weblet 0.4.0 → 0.4.1
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/lib/weblet.rb +46 -38
- data.tar.gz.sig +0 -0
- metadata +24 -24
- 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: 9cdf3dd81231ca9ee4385a6bb250af42f86677e30951cea62e74c5dac3a2ed19
|
4
|
+
data.tar.gz: 0f5aead405414359f202d14c97f4da26fb102d55a5b077822a4f2ebf1087c5d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2062764f51b7343e8800a9e32a823efed674af59c8e088705916e53da12b61d61c5f42ae7778940fb1f214507e672bdbb4d1dc460219ca585f23dc7a8624c7e
|
7
|
+
data.tar.gz: 6bca43e05423533b06f0ad10645c0ef8e0d9376a6335d6a26302946d18e6f8cbf0db1941da34b7c112896e1d73248111c76509e52ede277c17b0f0d70726454c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/weblet.rb
CHANGED
@@ -93,13 +93,27 @@ class Weblet
|
|
93
93
|
puts 'obj: ' + obj.inspect if @debug
|
94
94
|
@doc = Rexle.new(obj)
|
95
95
|
@h = scan @doc.root
|
96
|
+
@kvp = scan2keypair(@h).to_h
|
96
97
|
|
97
98
|
end
|
98
99
|
|
100
|
+
def [](key)
|
101
|
+
@kvp[key.to_s]
|
102
|
+
end
|
103
|
+
|
104
|
+
def []=(key, value)
|
105
|
+
@kvp[key.to_s] = value
|
106
|
+
end
|
107
|
+
|
99
108
|
def to_h()
|
100
109
|
@h
|
101
110
|
end
|
102
111
|
|
112
|
+
# key-value pair
|
113
|
+
def to_kvp()
|
114
|
+
@kvp
|
115
|
+
end
|
116
|
+
|
103
117
|
def to_outline()
|
104
118
|
treeize(scan_h(@h))
|
105
119
|
end
|
@@ -108,59 +122,26 @@ class Weblet
|
|
108
122
|
@doc.root.xml pretty: true
|
109
123
|
end
|
110
124
|
|
111
|
-
def render(
|
112
|
-
|
113
|
-
b = args.pop if args.last.is_a? Binding
|
114
|
-
|
115
|
-
if args.first.is_a? String then
|
116
|
-
path = args.first.split('/').map(&:to_sym)
|
117
|
-
else
|
118
|
-
path = *args.flatten(1)
|
119
|
-
end
|
125
|
+
def render(rawkey, bindingx=nil)
|
120
126
|
|
121
|
-
|
122
|
-
|
127
|
+
key = rawkey.to_s
|
128
|
+
return unless @kvp.has_key?(key)
|
123
129
|
|
124
130
|
# check for interpolated substitution tags e.g/ <:card/svg/link>
|
125
|
-
r.gsub
|
131
|
+
r = @kvp[key].gsub(/<:([^>]+)>/) {|x| self.render($1) }
|
126
132
|
|
127
|
-
|
128
|
-
|
129
|
-
if r.nil? then
|
130
|
-
found = @doc.root.element("//node[@id='#{path.join}']")
|
131
|
-
r = found.cdatas.join if found
|
132
|
-
end
|
133
|
-
|
134
|
-
eval('%Q(' + r + ')', b) if r
|
133
|
+
eval('%Q(' + r + ')', bindingx)
|
135
134
|
|
136
135
|
end
|
137
136
|
|
138
137
|
private
|
139
138
|
|
140
|
-
def digx(obj, a)
|
141
|
-
|
142
|
-
h = obj.is_a?(Array) ? obj.last : obj
|
143
|
-
|
144
|
-
r = h.dig(a.shift)
|
145
|
-
|
146
|
-
if a.any? then
|
147
|
-
digx(r, a)
|
148
|
-
else
|
149
|
-
r.is_a?(Array) ? r.first : r
|
150
|
-
end
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
139
|
def scan(node)
|
155
140
|
|
156
141
|
a = node.elements.map do |e|
|
157
142
|
|
158
|
-
puts 'e: ' + e.inspect if @debug
|
159
|
-
|
160
143
|
nodes = e.xpath('node')
|
161
144
|
|
162
|
-
puts 'nodes: ' + nodes.inspect if @debug
|
163
|
-
|
164
145
|
r = if nodes.any? then
|
165
146
|
|
166
147
|
r2 = scan(e)
|
@@ -199,5 +180,32 @@ class Weblet
|
|
199
180
|
|
200
181
|
end
|
201
182
|
|
183
|
+
def scan2keypair(h, trail=nil)
|
184
|
+
|
185
|
+
h.inject([]) do |r,x|
|
186
|
+
|
187
|
+
if x.last.is_a? String then
|
188
|
+
|
189
|
+
key, val = x
|
190
|
+
|
191
|
+
new_key = if r.last and r.last.first.length > 0 then
|
192
|
+
key.to_s
|
193
|
+
else
|
194
|
+
key.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
r << [[trail, new_key].compact.join('/'), val]
|
198
|
+
|
199
|
+
else
|
200
|
+
|
201
|
+
new_key = x.first.to_s
|
202
|
+
r << [new_key, x.last.first]
|
203
|
+
r.concat scan2keypair(x.last.last, [trail, new_key].compact.join('/'))
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
202
210
|
|
203
211
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weblet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNDE5MTg1NzA3WhcN
|
15
|
+
MjMwNDE5MTg1NzA3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9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d7Ff7Cbg26B+cw5CdSuTigGtAwff9AUvYXYyPOfiQfRBvnXqc0Awya8Pcqh
|
30
|
+
WEy7EsCR7zYwVXhwKjVazss2N+EHTwCNBuOu6tK69bzTf1j0cm6KRcJ5jxzkpZr+
|
31
|
+
N7376dc4ukN7rhBqjKnjYZln/TKbP4eRwqhOEerBVDn1/W6BzZMCkJGB9BQpp4/B
|
32
|
+
XH6/f4U2XBLY5kGDq0YeVnKaoqjyyMtEh93qTIukESvIjlMWuh5pUktikPsrhqly
|
33
|
+
f07hewJIYm5TfvecZtS9aCRJiAIEQBCZ5zAeisxCJKJzoHkHltoYmPZ0z7LanOWy
|
34
|
+
JnNGpUAfgxmo+dQH+d6tbe9rVXNyk2FINurCKGx3N7OJsfJWueTiHXENks2men9q
|
35
|
+
35oUH2ouHjXtvit5hQCmL2+hQV/HFZj86eWeg422XrNjGwBbyQwueRmGDSR5jAbO
|
36
|
+
/gJR3jXcFcpOgDnvL6xGYhfn
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
metadata.gz.sig
CHANGED
Binary file
|