jekyll-rendering 0.0.5 → 0.0.6

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.6 [2011-03-09]
4
+
5
+ * Defined Jekyll::Rendering::ERB_OPTIONS to allow
6
+ adjusting behaviour of ERB.new.
7
+
3
8
  == 0.0.5 [2010-10-29]
4
9
 
5
10
  * Refactored include_file.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to jekyll-rendering version 0.0.5
5
+ This documentation refers to jekyll-rendering version 0.0.6
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -15,6 +15,9 @@ Add the following to your <tt>_plugins/ext.rb</tt> file:
15
15
 
16
16
  Then set +engine+ in your <tt>_config.yml</tt>. The default engine is +liquid+.
17
17
 
18
+ Options passed to ERB.new are taken from <tt>Jekyll::Rendering::ERB_OPTIONS</tt>.
19
+ Modify this array if you want to change defaults.
20
+
18
21
 
19
22
  == TODO
20
23
 
@@ -42,7 +45,7 @@ RubyGem:: <http://rubygems.org/gems/jekyll-rendering>
42
45
 
43
46
  == LICENSE AND COPYRIGHT
44
47
 
45
- Copyright (C) 2010 University of Cologne,
48
+ Copyright (C) 2010-2011 University of Cologne,
46
49
  Albertus-Magnus-Platz, 50923 Cologne, Germany
47
50
 
48
51
  jekyll-rendering is free software: you can redistribute it and/or modify it under
data/Rakefile CHANGED
@@ -1,24 +1,21 @@
1
- require %q{lib/jekyll/rendering/version}
1
+ require File.expand_path(%q{../lib/jekyll/rendering/version}, __FILE__)
2
2
 
3
3
  begin
4
4
  require 'hen'
5
5
 
6
6
  Hen.lay! {{
7
7
  :gem => {
8
- :name => %q{jekyll-rendering},
9
- :version => Jekyll::Rendering::VERSION,
10
- :summary => %q{Jekyll plugin to provide alternative rendering engines.},
11
- :files => FileList['lib/**/*.rb'].to_a,
12
- :extra_files => FileList['[A-Z]*'].to_a,
13
- :dependencies => %w[]
8
+ :name => %q{jekyll-rendering},
9
+ :version => Jekyll::Rendering::VERSION,
10
+ :summary => %q{Jekyll plugin to provide alternative rendering engines.},
11
+ :author => %q{Jens Wille},
12
+ :email => %q{jens.wille@uni-koeln.de}
14
13
  }
15
14
  }}
16
- rescue LoadError
17
- warn "Please install the `hen' gem."
15
+ rescue LoadError => err
16
+ warn "Please install the `hen' gem. (#{err})"
18
17
  end
19
18
 
20
- ### Place your custom Rake tasks here.
21
-
22
19
  begin
23
20
  require 'jekyll/testtasks/rake'
24
21
  rescue LoadError
@@ -3,9 +3,9 @@
3
3
  # #
4
4
  # jekyll-rendering -- Jekyll plugin to provide alternative rendering engines #
5
5
  # #
6
- # Copyright (C) 2010 University of Cologne, #
7
- # Albertus-Magnus-Platz, #
8
- # 50923 Cologne, Germany #
6
+ # Copyright (C) 2010-2011 University of Cologne, #
7
+ # Albertus-Magnus-Platz, #
8
+ # 50923 Cologne, Germany #
9
9
  # #
10
10
  # Authors: #
11
11
  # Jens Wille <jens.wille@uni-koeln.de> #
@@ -32,6 +32,10 @@ require 'ostruct'
32
32
  module Jekyll
33
33
 
34
34
  module Rendering
35
+
36
+ # Options passed to ERB.new: +safe_level+, +trim_mode+, +eoutvar+.
37
+ ERB_OPTIONS = [nil, nil, '_erbout' ]
38
+
35
39
  end
36
40
 
37
41
  module Convertible
@@ -46,7 +50,7 @@ module Jekyll
46
50
  payload['pygments_suffix'] = converter.pygments_suffix
47
51
 
48
52
  # render and transform content (this becomes the final content of the object)
49
- self.content = engine.render(payload, content, info)
53
+ self.content = engine.render(payload, content, info, data)
50
54
  transform
51
55
 
52
56
  # output keeps track of what will finally be written
@@ -57,7 +61,7 @@ module Jekyll
57
61
 
58
62
  while layout = layouts[layout.data['layout']]
59
63
  payload = payload.deep_merge('content' => output, 'page' => layout.data)
60
- self.output = engine.render(payload, output, info, layout.content)
64
+ self.output = engine.render(payload, output, info, data, layout.content)
61
65
  end
62
66
  end
63
67
 
@@ -88,15 +92,15 @@ module Jekyll
88
92
  # Engine::Base.render(*args)
89
93
  #
90
94
  # Renders the output. Defers to engine's render method.
91
- def self.render(payload, content, info, layout = nil)
92
- new(payload, content, info).render(layout || content)
95
+ def self.render(payload, content, info, data = {}, layout = nil)
96
+ new(payload, content, info, data).render(layout || content)
93
97
  end
94
98
 
95
- attr_reader :payload, :info
99
+ attr_reader :payload, :info, :data
96
100
  attr_accessor :content
97
101
 
98
- def initialize(payload, content = nil, info = {})
99
- @payload, @content, @info = payload, content, info
102
+ def initialize(payload, content = nil, info = {}, data = {})
103
+ @payload, @content, @info, @data = payload, content, info, data
100
104
  end
101
105
 
102
106
  # call-seq:
@@ -107,6 +111,11 @@ module Jekyll
107
111
  raise NotImplementedError
108
112
  end
109
113
 
114
+ def render_error(err)
115
+ name = self.class.name.split('::').last
116
+ warn "#{name} Exception: #{err} (in #{data['layout'] || '(top)'})"
117
+ end
118
+
110
119
  end
111
120
 
112
121
  class Liquid < Base
@@ -119,6 +128,8 @@ module Jekyll
119
128
  # calling ::Liquid::Template#render with +payload+ and +info+.
120
129
  def render(content = content)
121
130
  ::Liquid::Template.parse(content).render(payload, info)
131
+ rescue => err
132
+ render_error(err)
122
133
  end
123
134
 
124
135
  end
@@ -150,7 +161,9 @@ module Jekyll
150
161
  "#{var} = local_assigns[#{var.inspect}]"
151
162
  }.join("\n") << " %>\n" unless local_assigns.empty?
152
163
 
153
- ::ERB.new("#{assigns}#{content}").result(binding)
164
+ ERB.new("#{assigns}#{content}", *Rendering::ERB_OPTIONS).result(binding)
165
+ rescue => err
166
+ render_error(err)
154
167
  end
155
168
 
156
169
  module Helpers
@@ -6,7 +6,7 @@ module Jekyll
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 5
9
+ TINY = 6
10
10
 
11
11
  class << self
12
12
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-rendering
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jens Wille
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-29 00:00:00 +02:00
18
+ date: 2011-03-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -26,9 +26,9 @@ executables: []
26
26
  extensions: []
27
27
 
28
28
  extra_rdoc_files:
29
+ - README
29
30
  - COPYING
30
31
  - ChangeLog
31
- - README
32
32
  files:
33
33
  - lib/jekyll/rendering.rb
34
34
  - lib/jekyll/rendering/version.rb
@@ -42,15 +42,14 @@ licenses: []
42
42
 
43
43
  post_install_message:
44
44
  rdoc_options:
45
- - --title
46
- - jekyll-rendering Application documentation
47
45
  - --main
48
46
  - README
49
- - --line-numbers
50
- - --inline-source
51
47
  - --all
52
48
  - --charset
53
49
  - UTF-8
50
+ - --title
51
+ - jekyll-rendering Application documentation (v0.0.6)
52
+ - --line-numbers
54
53
  require_paths:
55
54
  - lib
56
55
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -74,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
73
  requirements: []
75
74
 
76
75
  rubyforge_project:
77
- rubygems_version: 1.3.7
76
+ rubygems_version: 1.6.2
78
77
  signing_key:
79
78
  specification_version: 3
80
79
  summary: Jekyll plugin to provide alternative rendering engines.