jekyll-rendering 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  = Revision history for jekyll-rendering
2
2
 
3
+ == 0.0.4 [2010-10-01]
4
+
5
+ * Allow inclusion of files from *current* directory.
6
+
3
7
  == 0.0.3 [2010-09-29]
4
8
 
5
9
  * Fixed nested layouts.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to jekyll-rendering version 0.0.3
5
+ This documentation refers to jekyll-rendering version 0.0.4
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -6,7 +6,7 @@ module Jekyll
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 3
9
+ TINY = 4
10
10
 
11
11
  class << self
12
12
 
@@ -153,18 +153,22 @@ module Jekyll
153
153
 
154
154
  # call-seq:
155
155
  # include_file file => aString
156
- # include_file file, binding => aString
157
156
  #
158
- # Includes file +file+ from <tt>_includes</tt> directory rendered
159
- # as ERB template. Uses optional +binding+ if provided.
160
- def include_file(file, binding = binding)
161
- Dir.chdir(File.join(site.source, '_includes')) {
162
- @choices ||= Dir['**/*'].reject { |x| File.symlink?(x) }
163
-
164
- if @choices.include?(file = file.strip)
157
+ # Includes file +file+ from <tt>_includes</tt> directory, or current
158
+ # directory if +current+ is true, rendered as ERB template. Uses
159
+ # optional +binding+ if provided.
160
+ def include_file(file, current = false, binding = binding)
161
+ dir = current ? File.dirname(page.url) : '_includes'
162
+
163
+ Dir.chdir(File.join(site.source, dir)) {
164
+ @choices ||= Hash.new { |h, k|
165
+ h[k] = Dir['**/*'].reject { |x| File.symlink?(x) }
166
+ }
167
+
168
+ if @choices[dir].include?(file = file.strip)
165
169
  render(File.read(file), binding)
166
170
  else
167
- "Included file '#{file}' not found in _includes directory"
171
+ "[Included file `#{file}' not found in `#{dir}'.]"
168
172
  end
169
173
  }
170
174
  end
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
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-09-29 00:00:00 +02:00
18
+ date: 2010-10-01 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21