jekyll-rendering 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,5 +1,10 @@
1
1
  = Revision history for jekyll-rendering
2
2
 
3
+ == 0.0.9 []
4
+
5
+ * Include backtrace in render_error.
6
+ * Use "lazy" OpenStruct for Erb.
7
+
3
8
  == 0.0.8 [2012-05-22]
4
9
 
5
10
  * Added support for Erubis. (Used by default if available.)
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to jekyll-rendering version 0.0.8
5
+ This documentation refers to jekyll-rendering version 0.0.9
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -41,6 +41,8 @@ module Jekyll
41
41
  # Options passed to ERB.new: +safe_level+, +trim_mode+, +eoutvar+.
42
42
  ERB_OPTIONS = [nil, nil, '_erbout' ]
43
43
 
44
+ ERROR_TRACE = 3
45
+
44
46
  end
45
47
 
46
48
  module Convertible
@@ -116,10 +118,16 @@ module Jekyll
116
118
  raise NotImplementedError
117
119
  end
118
120
 
119
- def render_error(err, renderer = nil)
120
- name = self.class.name.split('::').last
121
- name << " [#{renderer}]" if renderer
122
- warn "#{name} Exception: #{err} (in #{data['layout'] || '(top)'})"
121
+ def render_error(err, renderer = nil, trace = Rendering::ERROR_TRACE)
122
+ msg = [self.class.name.split('::').last]
123
+ msg << "[#{renderer}]" if renderer
124
+
125
+ msg << 'Exception:' << err
126
+ msg << "(in #{data['layout'] || '(top)'})"
127
+
128
+ msg << "(from #{err.backtrace[0, trace].join(', ')})" if trace > 0
129
+
130
+ msg.join(' ')
123
131
  end
124
132
 
125
133
  end
@@ -142,6 +150,17 @@ module Jekyll
142
150
 
143
151
  class Erb < Base
144
152
 
153
+ class LazyStruct < OpenStruct
154
+
155
+ def initialize(hash)
156
+ @table = Hash.new { |h, k|
157
+ new_ostruct_member(k)
158
+ h[k] = h.has_key?(s = k.to_s) ? h[s] : nil
159
+ }.update(hash)
160
+ end
161
+
162
+ end
163
+
145
164
  class << self; attr_accessor :renderer; end
146
165
 
147
166
  attr_reader :site, :page, :renderer, :encoding
@@ -164,7 +183,7 @@ module Jekyll
164
183
 
165
184
  %w[site page paginator].each { |key|
166
185
  value = payload[key] or next
167
- instance_variable_set("@#{key}", OpenStruct.new(value))
186
+ instance_variable_set("@#{key}", LazyStruct.new(value))
168
187
  }
169
188
 
170
189
  @renderer = self.class.renderer ||
@@ -6,7 +6,7 @@ module Jekyll
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 8
9
+ TINY = 9
10
10
 
11
11
  class << self
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-rendering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-22 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Jekyll plugin to provide alternative rendering engines.
15
15
  email: jens.wille@uni-koeln.de
@@ -35,7 +35,7 @@ rdoc_options:
35
35
  - --line-numbers
36
36
  - --all
37
37
  - --title
38
- - jekyll-rendering Application documentation (v0.0.8)
38
+ - jekyll-rendering Application documentation (v0.0.9)
39
39
  - --main
40
40
  - README
41
41
  require_paths: