weblet 0.2.4 → 0.3.0
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/weblet.rb +33 -5
- metadata +2 -2
- 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: a554a34daec79c81fca1f25d822c6d0ceb784f9e86b8420cd6fada8372057995
|
4
|
+
data.tar.gz: 22ba08494032e5b230e5837baab8c821b23321a3d4cb91b507fe99ca6afa0fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e665e8e8b68bd5fb7de8020b5f648087e4d8abeaf8580118a1f2ea786820dd69f359252ed51a502e171b9b59d9f3928f1ec457502e8eb5e9c52e1c15c632c917
|
7
|
+
data.tar.gz: be1d18c638b4628bfad7da54e717d476df9b339dc74233f08efa03dc5ca6ddc7ec42b0e377d97197c4dc85f8e04c911073fe817f20e44eed965e83b01791aae6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/weblet.rb
CHANGED
@@ -56,7 +56,9 @@ class WebletBuilder
|
|
56
56
|
|
57
57
|
elsif x[0] and x[0].is_a? Array
|
58
58
|
|
59
|
-
|
59
|
+
head, body = x[0][0].split("\n", 2)
|
60
|
+
[:node, {id: head[/#{@marker}(\w+)/,1]}, '', \
|
61
|
+
['![', {}, body.to_s.strip], *build(x[1..-1])]
|
60
62
|
|
61
63
|
end
|
62
64
|
|
@@ -90,7 +92,9 @@ class Weblet
|
|
90
92
|
@doc.root.xml pretty: true
|
91
93
|
end
|
92
94
|
|
93
|
-
def render(*args
|
95
|
+
def render(*args)
|
96
|
+
|
97
|
+
@b = args.pop if args.last.is_a? Binding
|
94
98
|
|
95
99
|
if args.first.is_a? String then
|
96
100
|
path = args.first.split('/').map(&:to_sym)
|
@@ -98,18 +102,35 @@ class Weblet
|
|
98
102
|
path = *args.flatten(1)
|
99
103
|
end
|
100
104
|
|
101
|
-
r = @h.dig *path
|
105
|
+
#r = @h.dig *path
|
106
|
+
r = digx(@h, path)
|
107
|
+
|
108
|
+
puts 'r: ' + r.inspect if @debug
|
102
109
|
|
103
110
|
if r.nil? then
|
104
111
|
found = @doc.root.element("//node[@id='#{path.join}']")
|
105
112
|
r = found.cdatas.join if found
|
106
113
|
end
|
107
114
|
|
108
|
-
eval('%Q(' + r + ')', b) if r
|
115
|
+
eval('%Q(' + r + ')', @b) if r
|
109
116
|
|
110
117
|
end
|
111
118
|
|
112
119
|
private
|
120
|
+
|
121
|
+
def digx(obj, a)
|
122
|
+
|
123
|
+
h = obj.is_a?(Array) ? obj.last : obj
|
124
|
+
|
125
|
+
r = h.dig(a.shift)
|
126
|
+
|
127
|
+
if a.any? then
|
128
|
+
digx(r, a)
|
129
|
+
else
|
130
|
+
r.is_a?(Array) ? r.first : r
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
113
134
|
|
114
135
|
def scan(node)
|
115
136
|
|
@@ -121,7 +142,14 @@ class Weblet
|
|
121
142
|
|
122
143
|
puts 'nodes: ' + nodes.inspect if @debug
|
123
144
|
|
124
|
-
r = nodes.any?
|
145
|
+
r = if nodes.any? then
|
146
|
+
|
147
|
+
r2 = scan(e)
|
148
|
+
e.cdatas.any? ? [e.cdatas.join(), r2] : r2
|
149
|
+
|
150
|
+
else
|
151
|
+
e.cdatas.join()
|
152
|
+
end
|
125
153
|
|
126
154
|
[e.attributes[:id].to_sym, r]
|
127
155
|
|
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
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
mKbvoKGru7nPXh4E/ArWQ70Yz24o3lwGZW3XLzwdLPKB8MiOOGuTARkCWFEYT5tE
|
36
36
|
We42rjyhFeidBuSZp6/7Wwlo
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-04-
|
38
|
+
date: 2021-04-04 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
metadata.gz.sig
CHANGED
Binary file
|