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 +4 -0
- data/README +1 -1
- data/lib/jekyll/rendering/version.rb +1 -1
- data/lib/jekyll/rendering.rb +13 -9
- metadata +4 -4
data/ChangeLog
CHANGED
data/README
CHANGED
data/lib/jekyll/rendering.rb
CHANGED
@@ -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
|
159
|
-
# as ERB template. Uses
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
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
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2010-10-01 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|