jekyll 2.0.0.alpha.1 → 2.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +15 -0
- data/.travis.yml +27 -0
- data/History.markdown +66 -1
- data/LICENSE +2 -2
- data/README.markdown +2 -2
- data/Rakefile +4 -44
- data/bin/jekyll +10 -113
- data/docs/jp/CONTRIBUTING.jp.markdown +93 -0
- data/docs/jp/README.jp.markdown +69 -0
- data/features/create_sites.feature +12 -12
- data/features/drafts.feature +23 -2
- data/features/embed_filters.feature +7 -5
- data/features/include_tag.feature +7 -7
- data/features/markdown.feature +4 -4
- data/features/pagination.feature +2 -2
- data/features/permalinks.feature +7 -7
- data/features/post_data.feature +21 -21
- data/features/post_excerpts.feature +6 -6
- data/features/site_configuration.feature +17 -17
- data/features/site_data.feature +15 -15
- data/features/step_definitions/jekyll_steps.rb +4 -4
- data/features/support/env.rb +2 -2
- data/jekyll.gemspec +17 -284
- data/lib/jekyll.rb +21 -5
- data/lib/jekyll/command.rb +72 -20
- data/lib/jekyll/commands/build.rb +82 -58
- data/lib/jekyll/commands/docs.rb +30 -0
- data/lib/jekyll/commands/doctor.rb +18 -1
- data/lib/jekyll/commands/new.rb +19 -6
- data/lib/jekyll/commands/serve.rb +80 -49
- data/lib/jekyll/configuration.rb +3 -3
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +1 -0
- data/lib/jekyll/convertible.rb +19 -21
- data/lib/jekyll/draft.rb +5 -0
- data/lib/jekyll/excerpt.rb +5 -5
- data/lib/jekyll/layout.rb +2 -2
- data/lib/jekyll/layout_reader.rb +15 -2
- data/lib/jekyll/page.rb +17 -17
- data/lib/jekyll/post.rb +33 -33
- data/lib/jekyll/related_posts.rb +5 -5
- data/lib/jekyll/site.rb +84 -85
- data/lib/jekyll/static_file.rb +13 -0
- data/lib/jekyll/stevenson.rb +1 -1
- data/lib/jekyll/tags/highlight.rb +16 -6
- data/lib/jekyll/tags/include.rb +17 -17
- data/lib/jekyll/url.rb +2 -0
- data/lib/jekyll/utils.rb +79 -0
- data/lib/jekyll/version.rb +3 -0
- data/lib/site_template/_config.yml +3 -1
- data/lib/site_template/_includes/footer.html +61 -0
- data/lib/site_template/_includes/head.html +12 -0
- data/lib/site_template/_includes/header.html +27 -0
- data/lib/site_template/_layouts/default.html +9 -34
- data/lib/site_template/_layouts/page.html +14 -0
- data/lib/site_template/_layouts/post.html +11 -5
- data/lib/site_template/_posts/0000-00-00-this-post-demonstrates-post-content-styles.md +88 -0
- data/lib/site_template/about/index.md +10 -0
- data/lib/site_template/css/main.css +333 -100
- data/lib/site_template/feed.xml +21 -0
- data/lib/site_template/index.html +8 -4
- data/lib/site_template/projects/index.md +14 -0
- data/script/cibuild +0 -1
- data/script/rebund +1 -1
- data/site/_includes/analytics.html +2 -2
- data/site/_includes/css/normalize.css +1 -1
- data/site/_includes/css/style.css +28 -4
- data/site/_includes/docs_option.html +1 -1
- data/site/_includes/docs_ul.html +3 -3
- data/site/_includes/footer.html +1 -1
- data/site/_includes/header.html +2 -2
- data/site/_includes/news_item.html +1 -1
- data/site/_includes/primary-nav-items.html +4 -4
- data/site/_includes/section_nav.html +2 -2
- data/site/_includes/top.html +6 -7
- data/site/_layouts/news_item.html +1 -1
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +1 -1
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +1 -1
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +1 -1
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +19 -0
- data/site/docs/assets.md +14 -0
- data/site/docs/configuration.md +65 -56
- data/site/docs/contributing.md +7 -2
- data/site/docs/deployment-methods.md +1 -1
- data/site/docs/github-pages.md +1 -1
- data/site/docs/history.md +21 -0
- data/site/docs/index.md +7 -1
- data/site/docs/installation.md +28 -0
- data/site/docs/migrations.md +1 -1
- data/site/docs/plugins.md +6 -0
- data/site/docs/structure.md +3 -3
- data/site/docs/templates.md +44 -44
- data/site/docs/usage.md +1 -1
- data/site/docs/variables.md +15 -2
- data/site/favicon.png +0 -0
- data/site/feed.xml +0 -1
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +5 -5
- data/site/js/modernizr-2.7.1.min.js +4 -0
- data/test/helper.rb +11 -0
- data/test/source/_drafts/draft-properties.text +11 -0
- data/test/source/_posts/2011-04-12-md-extension.md +1 -1
- data/test/source/_posts/2014-01-06-permalink-traversal.md +5 -0
- data/test/source/exploit.md +5 -0
- data/test/source/static_files.html +4 -0
- data/test/test_configuration.rb +2 -2
- data/test/test_draft.rb +56 -0
- data/test/test_excerpt.rb +2 -2
- data/test/test_filters.rb +1 -1
- data/test/test_generated_site.rb +10 -1
- data/test/test_kramdown.rb +1 -1
- data/test/test_layout_reader.rb +17 -0
- data/test/test_page.rb +10 -0
- data/test/test_pager.rb +4 -2
- data/test/test_path_sanitization.rb +14 -0
- data/test/test_post.rb +12 -1
- data/test/test_sass.rb +1 -64
- data/test/test_site.rb +26 -1
- data/test/test_tags.rb +39 -2
- data/test/{test_core_ext.rb → test_utils.rb} +12 -12
- metadata +200 -86
- data/lib/jekyll/converters/sass.rb +0 -58
- data/lib/jekyll/core_ext.rb +0 -55
- data/lib/site_template/css/syntax.css +0 -60
- data/site/js/modernizr-2.5.3.min.js +0 -4
data/lib/jekyll/related_posts.rb
CHANGED
@@ -14,9 +14,9 @@ module Jekyll
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def build
|
17
|
-
return [] unless
|
17
|
+
return [] unless site.posts.size > 1
|
18
18
|
|
19
|
-
if
|
19
|
+
if site.lsi
|
20
20
|
build_index
|
21
21
|
lsi_related_posts
|
22
22
|
else
|
@@ -30,7 +30,7 @@ module Jekyll
|
|
30
30
|
lsi = Classifier::LSI.new(:auto_rebuild => false)
|
31
31
|
display("Populating LSI...")
|
32
32
|
|
33
|
-
|
33
|
+
site.posts.each do |x|
|
34
34
|
lsi.add_item(x)
|
35
35
|
end
|
36
36
|
|
@@ -42,11 +42,11 @@ module Jekyll
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def lsi_related_posts
|
45
|
-
self.class.lsi.find_related(post.content, 11) - [
|
45
|
+
self.class.lsi.find_related(post.content, 11) - [post]
|
46
46
|
end
|
47
47
|
|
48
48
|
def most_recent_posts
|
49
|
-
recent_posts =
|
49
|
+
recent_posts = site.posts.reverse - [post]
|
50
50
|
recent_posts.first(10)
|
51
51
|
end
|
52
52
|
|
data/lib/jekyll/site.rb
CHANGED
@@ -11,54 +11,50 @@ module Jekyll
|
|
11
11
|
#
|
12
12
|
# config - A Hash containing site configuration details.
|
13
13
|
def initialize(config)
|
14
|
-
self.config
|
14
|
+
self.config = config.clone
|
15
15
|
|
16
16
|
%w[safe lsi highlighter baseurl exclude include future show_drafts limit_posts keep_files gems].each do |opt|
|
17
17
|
self.send("#{opt}=", config[opt])
|
18
18
|
end
|
19
19
|
|
20
|
-
self.source
|
21
|
-
self.dest
|
22
|
-
self.plugins
|
20
|
+
self.source = File.expand_path(config['source'])
|
21
|
+
self.dest = File.expand_path(config['destination'])
|
22
|
+
self.plugins = plugins_path
|
23
23
|
self.permalink_style = config['permalink'].to_sym
|
24
24
|
|
25
25
|
self.file_read_opts = {}
|
26
26
|
self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
reset
|
29
|
+
setup
|
30
30
|
end
|
31
31
|
|
32
32
|
# Public: Read, process, and write this Site to output.
|
33
33
|
#
|
34
34
|
# Returns nothing.
|
35
35
|
def process
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
reset
|
37
|
+
read
|
38
|
+
generate
|
39
|
+
render
|
40
|
+
cleanup
|
41
|
+
write
|
42
42
|
end
|
43
43
|
|
44
44
|
# Reset Site details.
|
45
45
|
#
|
46
46
|
# Returns nothing
|
47
47
|
def reset
|
48
|
-
self.time
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
self.
|
54
|
-
self.
|
55
|
-
self.
|
56
|
-
|
57
|
-
|
58
|
-
self.tags = Hash.new { |hash, key| hash[key] = [] }
|
59
|
-
self.data = {}
|
60
|
-
|
61
|
-
if self.limit_posts < 0
|
48
|
+
self.time = (config['time'] ? Time.parse(config['time'].to_s) : Time.now)
|
49
|
+
self.layouts = {}
|
50
|
+
self.posts = []
|
51
|
+
self.pages = []
|
52
|
+
self.static_files = []
|
53
|
+
self.categories = Hash.new { |hash, key| hash[key] = [] }
|
54
|
+
self.tags = Hash.new { |hash, key| hash[key] = [] }
|
55
|
+
self.data = {}
|
56
|
+
|
57
|
+
if limit_posts < 0
|
62
58
|
raise ArgumentError, "limit_posts must be a non-negative number"
|
63
59
|
end
|
64
60
|
end
|
@@ -71,11 +67,11 @@ module Jekyll
|
|
71
67
|
|
72
68
|
# If safe mode is off, load in any Ruby files under the plugins
|
73
69
|
# directory.
|
74
|
-
unless
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
unless safe
|
71
|
+
plugins.each do |plugins|
|
72
|
+
Dir[File.join(plugins, "**/*.rb")].sort.each do |f|
|
73
|
+
require f
|
74
|
+
end
|
79
75
|
end
|
80
76
|
end
|
81
77
|
|
@@ -88,16 +84,16 @@ module Jekyll
|
|
88
84
|
# Check that the destination dir isn't the source dir or a directory
|
89
85
|
# parent to the source dir.
|
90
86
|
def ensure_not_in_dest
|
91
|
-
|
92
|
-
Pathname.new(
|
93
|
-
if path ==
|
87
|
+
dest_pathname = Pathname.new(dest)
|
88
|
+
Pathname.new(source).ascend do |path|
|
89
|
+
if path == dest_pathname
|
94
90
|
raise FatalException.new "Destination directory cannot be or contain the Source directory."
|
95
91
|
end
|
96
92
|
end
|
97
93
|
end
|
98
94
|
|
99
95
|
def require_gems
|
100
|
-
|
96
|
+
gems.each do |gem|
|
101
97
|
if plugin_allowed?(gem)
|
102
98
|
require gem
|
103
99
|
end
|
@@ -105,11 +101,11 @@ module Jekyll
|
|
105
101
|
end
|
106
102
|
|
107
103
|
def plugin_allowed?(gem_name)
|
108
|
-
whitelist.include?(gem_name) || !
|
104
|
+
whitelist.include?(gem_name) || !safe
|
109
105
|
end
|
110
106
|
|
111
107
|
def whitelist
|
112
|
-
@whitelist ||= Array[
|
108
|
+
@whitelist ||= Array[config['whitelist']].flatten
|
113
109
|
end
|
114
110
|
|
115
111
|
# Internal: Setup the plugin search path
|
@@ -117,7 +113,7 @@ module Jekyll
|
|
117
113
|
# Returns an Array of plugin search paths
|
118
114
|
def plugins_path
|
119
115
|
if (config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins'])
|
120
|
-
[File.join(
|
116
|
+
[File.join(source, config['plugins'])]
|
121
117
|
else
|
122
118
|
Array(config['plugins']).map { |d| File.expand_path(d) }
|
123
119
|
end
|
@@ -128,8 +124,8 @@ module Jekyll
|
|
128
124
|
# Returns nothing.
|
129
125
|
def read
|
130
126
|
self.layouts = LayoutReader.new(self).read
|
131
|
-
|
132
|
-
|
127
|
+
read_directories
|
128
|
+
read_data(config['data_source'])
|
133
129
|
end
|
134
130
|
|
135
131
|
# Recursively traverse directories to find posts, pages and static files
|
@@ -140,24 +136,24 @@ module Jekyll
|
|
140
136
|
#
|
141
137
|
# Returns nothing.
|
142
138
|
def read_directories(dir = '')
|
143
|
-
base = File.join(
|
139
|
+
base = File.join(source, dir)
|
144
140
|
entries = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
|
145
141
|
|
146
|
-
|
147
|
-
|
148
|
-
|
142
|
+
read_posts(dir)
|
143
|
+
read_drafts(dir) if show_drafts
|
144
|
+
posts.sort!
|
149
145
|
limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
|
150
146
|
|
151
147
|
entries.each do |f|
|
152
148
|
f_abs = File.join(base, f)
|
153
149
|
if File.directory?(f_abs)
|
154
150
|
f_rel = File.join(dir, f)
|
155
|
-
read_directories(f_rel) unless
|
151
|
+
read_directories(f_rel) unless dest.sub(/\/$/, '') == f_abs
|
156
152
|
elsif has_yaml_header?(f_abs)
|
157
|
-
page = Page.new(self,
|
153
|
+
page = Page.new(self, source, dir, f)
|
158
154
|
pages << page if page.published?
|
159
155
|
else
|
160
|
-
static_files << StaticFile.new(self,
|
156
|
+
static_files << StaticFile.new(self, source, dir, f)
|
161
157
|
end
|
162
158
|
end
|
163
159
|
|
@@ -174,7 +170,7 @@ module Jekyll
|
|
174
170
|
posts = read_content(dir, '_posts', Post)
|
175
171
|
|
176
172
|
posts.each do |post|
|
177
|
-
if post.published? && (
|
173
|
+
if post.published? && (future || post.date <= time)
|
178
174
|
aggregate_post_info(post)
|
179
175
|
end
|
180
176
|
end
|
@@ -190,13 +186,15 @@ module Jekyll
|
|
190
186
|
drafts = read_content(dir, '_drafts', Draft)
|
191
187
|
|
192
188
|
drafts.each do |draft|
|
193
|
-
|
189
|
+
if draft.published?
|
190
|
+
aggregate_post_info(draft)
|
191
|
+
end
|
194
192
|
end
|
195
193
|
end
|
196
194
|
|
197
195
|
def read_content(dir, magic_dir, klass)
|
198
196
|
get_entries(dir, magic_dir).map do |entry|
|
199
|
-
klass.new(self,
|
197
|
+
klass.new(self, source, dir, entry) if klass.valid?(entry)
|
200
198
|
end.reject do |entry|
|
201
199
|
entry.nil?
|
202
200
|
end
|
@@ -206,15 +204,15 @@ module Jekyll
|
|
206
204
|
#
|
207
205
|
# Returns nothing
|
208
206
|
def read_data(dir)
|
209
|
-
base = File.join(
|
210
|
-
return unless File.directory?(base) && (!
|
207
|
+
base = File.join(source, dir)
|
208
|
+
return unless File.directory?(base) && (!safe || !File.symlink?(base))
|
211
209
|
|
212
210
|
entries = Dir.chdir(base) { Dir['*.{yaml,yml}'] }
|
213
211
|
entries.delete_if { |e| File.directory?(File.join(base, e)) }
|
214
212
|
|
215
213
|
entries.each do |entry|
|
216
|
-
path = File.join(
|
217
|
-
next if File.symlink?(path) &&
|
214
|
+
path = File.join(source, dir, entry)
|
215
|
+
next if File.symlink?(path) && safe
|
218
216
|
|
219
217
|
key = sanitize_filename(File.basename(entry, '.*'))
|
220
218
|
self.data[key] = SafeYAML.load_file(path)
|
@@ -225,7 +223,7 @@ module Jekyll
|
|
225
223
|
#
|
226
224
|
# Returns nothing.
|
227
225
|
def generate
|
228
|
-
|
226
|
+
generators.each do |generator|
|
229
227
|
generator.generate(self)
|
230
228
|
end
|
231
229
|
end
|
@@ -237,12 +235,12 @@ module Jekyll
|
|
237
235
|
relative_permalinks_deprecation_method
|
238
236
|
|
239
237
|
payload = site_payload
|
240
|
-
[
|
241
|
-
page_or_post.render(
|
238
|
+
[posts, pages].flatten.each do |page_or_post|
|
239
|
+
page_or_post.render(layouts, payload)
|
242
240
|
end
|
243
241
|
|
244
|
-
|
245
|
-
|
242
|
+
categories.values.map { |ps| ps.sort! { |a, b| b <=> a } }
|
243
|
+
tags.values.map { |ps| ps.sort! { |a, b| b <=> a } }
|
246
244
|
rescue Errno::ENOENT => e
|
247
245
|
# ignore missing layout dir
|
248
246
|
end
|
@@ -258,7 +256,7 @@ module Jekyll
|
|
258
256
|
#
|
259
257
|
# Returns nothing.
|
260
258
|
def write
|
261
|
-
each_site_file { |item| item.write(
|
259
|
+
each_site_file { |item| item.write(dest) }
|
262
260
|
end
|
263
261
|
|
264
262
|
# Construct a Hash of Posts indexed by the specified Post attribute.
|
@@ -277,8 +275,8 @@ module Jekyll
|
|
277
275
|
def post_attr_hash(post_attr)
|
278
276
|
# Build a hash map based on the specified post attribute ( post attr =>
|
279
277
|
# array of posts ) then sort each array in reverse order.
|
280
|
-
hash = Hash.new { |
|
281
|
-
|
278
|
+
hash = Hash.new { |hash, key| hash[key] = [] }
|
279
|
+
posts.each { |p| p.send(post_attr.to_sym).each { |t| hash[t] << p } }
|
282
280
|
hash.values.map { |sortme| sortme.sort! { |a, b| b <=> a } }
|
283
281
|
hash
|
284
282
|
end
|
@@ -288,7 +286,7 @@ module Jekyll
|
|
288
286
|
#
|
289
287
|
# Returns the Hash to be hooked to site.data.
|
290
288
|
def site_data
|
291
|
-
|
289
|
+
config['data'] || data
|
292
290
|
end
|
293
291
|
|
294
292
|
# The Hash payload containing site-wide data.
|
@@ -306,14 +304,15 @@ module Jekyll
|
|
306
304
|
# See Site#post_attr_hash for type info.
|
307
305
|
def site_payload
|
308
306
|
{"jekyll" => { "version" => Jekyll::VERSION },
|
309
|
-
"site" =>
|
310
|
-
"time"
|
311
|
-
"posts"
|
312
|
-
"pages"
|
313
|
-
"
|
314
|
-
"
|
315
|
-
"
|
316
|
-
"
|
307
|
+
"site" => config.merge({
|
308
|
+
"time" => time,
|
309
|
+
"posts" => posts.sort { |a, b| b <=> a },
|
310
|
+
"pages" => pages,
|
311
|
+
"static_files" => static_files.sort { |a, b| a.relative_path <=> b.relative_path },
|
312
|
+
"html_pages" => pages.reject { |page| !page.html? },
|
313
|
+
"categories" => post_attr_hash('categories'),
|
314
|
+
"tags" => post_attr_hash('tags'),
|
315
|
+
"data" => site_data})}
|
317
316
|
end
|
318
317
|
|
319
318
|
# Filter out any files/directories that are hidden or backup files (start
|
@@ -334,7 +333,7 @@ module Jekyll
|
|
334
333
|
#
|
335
334
|
# Returns the Converter instance implementing the given Converter.
|
336
335
|
def getConverterImpl(klass)
|
337
|
-
matches =
|
336
|
+
matches = converters.select { |c| c.class == klass }
|
338
337
|
if impl = matches.first
|
339
338
|
impl
|
340
339
|
else
|
@@ -351,9 +350,9 @@ module Jekyll
|
|
351
350
|
# Returns array of instances of subclasses of parameter
|
352
351
|
def instantiate_subclasses(klass)
|
353
352
|
klass.subclasses.select do |c|
|
354
|
-
!
|
353
|
+
!safe || c.safe
|
355
354
|
end.sort.map do |c|
|
356
|
-
c.new(
|
355
|
+
c.new(config)
|
357
356
|
end
|
358
357
|
end
|
359
358
|
|
@@ -364,7 +363,7 @@ module Jekyll
|
|
364
363
|
#
|
365
364
|
# Returns the list of entries to process
|
366
365
|
def get_entries(dir, subfolder)
|
367
|
-
base = File.join(
|
366
|
+
base = File.join(source, dir, subfolder)
|
368
367
|
return [] unless File.exists?(base)
|
369
368
|
entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
|
370
369
|
entries.delete_if { |e| File.directory?(File.join(base, e)) }
|
@@ -376,9 +375,9 @@ module Jekyll
|
|
376
375
|
#
|
377
376
|
# Returns nothing
|
378
377
|
def aggregate_post_info(post)
|
379
|
-
|
380
|
-
post.categories.each { |c|
|
381
|
-
post.tags.each { |c|
|
378
|
+
posts << post
|
379
|
+
post.categories.each { |c| categories[c] << post }
|
380
|
+
post.tags.each { |c| tags[c] << post }
|
382
381
|
end
|
383
382
|
|
384
383
|
def relative_permalinks_deprecation_method
|
@@ -395,7 +394,7 @@ module Jekyll
|
|
395
394
|
|
396
395
|
def each_site_file
|
397
396
|
%w(posts pages static_files).each do |type|
|
398
|
-
|
397
|
+
send(type).each do |item|
|
399
398
|
yield item
|
400
399
|
end
|
401
400
|
end
|
@@ -404,7 +403,7 @@ module Jekyll
|
|
404
403
|
private
|
405
404
|
|
406
405
|
def has_relative_page?
|
407
|
-
|
406
|
+
pages.any? { |page| page.uses_relative_permalinks }
|
408
407
|
end
|
409
408
|
|
410
409
|
def has_yaml_header?(file)
|
@@ -412,8 +411,8 @@ module Jekyll
|
|
412
411
|
end
|
413
412
|
|
414
413
|
def limit_posts!
|
415
|
-
limit =
|
416
|
-
self.posts =
|
414
|
+
limit = posts.length < limit_posts ? posts.length : limit_posts
|
415
|
+
self.posts = posts[-limit, limit]
|
417
416
|
end
|
418
417
|
|
419
418
|
def site_cleaner
|
@@ -421,9 +420,9 @@ module Jekyll
|
|
421
420
|
end
|
422
421
|
|
423
422
|
def sanitize_filename(name)
|
424
|
-
name
|
425
|
-
name
|
426
|
-
name
|
423
|
+
name.gsub!(/[^\w\s_-]+/, '')
|
424
|
+
name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
|
425
|
+
name.gsub(/\s+/, '_')
|
427
426
|
end
|
428
427
|
end
|
429
428
|
end
|
data/lib/jekyll/static_file.rb
CHANGED
@@ -21,6 +21,11 @@ module Jekyll
|
|
21
21
|
File.join(@base, @dir, @name)
|
22
22
|
end
|
23
23
|
|
24
|
+
# Returns the source file path relative to the site source
|
25
|
+
def relative_path
|
26
|
+
@relative_path ||= path.sub(/\A#{@site.source}/, '')
|
27
|
+
end
|
28
|
+
|
24
29
|
# Obtain destination path.
|
25
30
|
#
|
26
31
|
# dest - The String path to the destination dir.
|
@@ -66,5 +71,13 @@ module Jekyll
|
|
66
71
|
@@mtimes = Hash.new
|
67
72
|
nil
|
68
73
|
end
|
74
|
+
|
75
|
+
def to_liquid
|
76
|
+
{
|
77
|
+
"path" => relative_path,
|
78
|
+
"modified_time" => mtime.to_s,
|
79
|
+
"extname" => File.extname(relative_path)
|
80
|
+
}
|
81
|
+
end
|
69
82
|
end
|
70
83
|
end
|
data/lib/jekyll/stevenson.rb
CHANGED