weblet 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc94ddba2ec7b157db2ad2e536a796c46ae6a829536f12631331c5fa6f29e797
4
- data.tar.gz: 5175e71457a2c80638175ba58b828d4cb92827e015ef54228e32164d770c3b6e
3
+ metadata.gz: a20edd9605c808815e0aa3cfc7e9779406760cca57fd34db6011c81f2abaa3f2
4
+ data.tar.gz: 1b99f0adc8fde98fe110fb06783644c3245ced80a4c5b03a4aa6f8bb20410e1e
5
5
  SHA512:
6
- metadata.gz: 8c0f683f4aa1a07beb26cdeb5d2e7f5d5669bd5da389874d6d95b1c7d7ebbcba365d40357d30354b0147974aadef0a42e6eae59b22702e2880483a535e6aa5a5
7
- data.tar.gz: 9ae047f6215a0435a60958c90eb1ee72bab8dec7fb739e69985b0646a99e2c452f3b6a8735522f4b099b6ef29a1330f32c6dd73a345235b3b225e1bb6b38205a
6
+ metadata.gz: 3e7690b5ee283aee9c596e4496c738b756579801c54994bf0761e78a3a0825f9968eb84c5998675d3b6c8daf6a958a682872712f34a94631c60c74748cc3a156
7
+ data.tar.gz: 1aef800f17899e8b11e48bac43fdbfa254e848ff3db59ea840da8b2ecbfd7808cef3a4ff6257adda2b3a351f7bfedc8c36806769f5e91f07b897084a97c7f768
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/weblet.rb CHANGED
@@ -12,11 +12,16 @@ class WebletBuilder
12
12
 
13
13
  @marker, @debug = marker, debug
14
14
 
15
+ s.strip!
16
+
15
17
  # the default marker is the hash symbol (#) but the client can set their
16
18
  # own marker by simply using their custom symbol in the 1st line of input
17
19
  @marker ||= s[0]
18
20
 
19
- @a = build(scan(s.strip))
21
+ a = scan(s.strip)
22
+ puts 'a: ' + a.inspect if @debug
23
+
24
+ @a = build(a)
20
25
  @a.unshift *['weblet', {}, '']
21
26
 
22
27
  end
@@ -38,21 +43,21 @@ class WebletBuilder
38
43
 
39
44
  def build(a)
40
45
 
46
+ puts 'a: ' + a.inspect if @debug
47
+
41
48
  a.map do |x|
42
49
 
43
50
  puts 'x: ' + x.inspect if @debug
44
51
 
45
- if x.is_a? String then
46
- head, body = x.split("\n", 2)
52
+ if x[0].is_a? String then
53
+
54
+ head, body = x[0].split("\n", 2)
47
55
  [:node, {id: head[/#{@marker}(\w+)/,1]}, '',['![', {}, body.strip]]
48
- elsif x.length < 2
49
- x.flatten!(1)
50
- head, body = x.shift.split("\n", 2)
51
- [:node, {id: head[/#{@marker}(\w+)/,1].rstrip}, '',['![', {}, body.rstrip, ]]
52
- else
53
- x.flatten!(1)
54
- head, body = x.shift.split("\n", 2)
55
- [:node, {id: head[/#{@marker}(\w+)/,1].rstrip}, body.rstrip, *build(x)]
56
+
57
+ elsif x[0] and x[0].is_a? Array
58
+
59
+ [:node, {id: x[0][0][/#{@marker}(\w+)/,1]}, '', *build(x[1..-1])]
60
+
56
61
  end
57
62
 
58
63
  end
@@ -85,10 +90,10 @@ class Weblet
85
90
  @doc.root.xml pretty: true
86
91
  end
87
92
 
88
- def render(*args)
93
+ def render(*args, b=@b)
89
94
 
90
95
  if args.first.is_a? String then
91
- path = args.first.split('/',2).map(&:to_sym)
96
+ path = args.first.split('/').map(&:to_sym)
92
97
  else
93
98
  path = *args.flatten(1)
94
99
  end
@@ -100,7 +105,7 @@ class Weblet
100
105
  r = found.cdatas.join if found
101
106
  end
102
107
 
103
- eval('%Q(' + r + ')', @b) if r
108
+ eval('%Q(' + r + ')', b) if r
104
109
 
105
110
  end
106
111
 
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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '1.5'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.5.10
49
+ version: 1.5.11
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  version: '1.5'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.5.10
59
+ version: 1.5.11
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rxfhelper
62
62
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file