jekyll 2.2.0 → 2.3.0
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/README.markdown +1 -1
- data/lib/jekyll.rb +0 -1
- data/lib/jekyll/collection.rb +18 -3
- data/lib/jekyll/command.rb +0 -25
- data/lib/jekyll/commands/build.rb +7 -2
- data/lib/jekyll/commands/help.rb +33 -0
- data/lib/jekyll/configuration.rb +36 -28
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
- data/lib/jekyll/convertible.rb +43 -20
- data/lib/jekyll/deprecator.rb +15 -8
- data/lib/jekyll/document.rb +21 -4
- data/lib/jekyll/filters.rb +27 -1
- data/lib/jekyll/frontmatter_defaults.rb +46 -12
- data/lib/jekyll/plugin.rb +10 -1
- data/lib/jekyll/post.rb +6 -13
- data/lib/jekyll/related_posts.rb +2 -2
- data/lib/jekyll/renderer.rb +7 -2
- data/lib/jekyll/site.rb +5 -7
- data/lib/jekyll/static_file.rb +24 -4
- data/lib/jekyll/tags/include.rb +3 -1
- data/lib/jekyll/tags/post_url.rb +2 -2
- data/lib/jekyll/utils.rb +88 -69
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/_config.yml +6 -4
- data/lib/site_template/_includes/footer.html +43 -49
- data/lib/site_template/_includes/head.html +3 -4
- data/lib/site_template/_includes/header.html +9 -10
- data/lib/site_template/_layouts/default.html +6 -5
- data/lib/site_template/_layouts/page.html +3 -3
- data/lib/site_template/_layouts/post.html +4 -4
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +6 -5
- data/lib/site_template/_sass/_base.scss +203 -0
- data/lib/site_template/_sass/_layout.scss +236 -0
- data/lib/site_template/_sass/_syntax-highlighting.scss +67 -0
- data/lib/site_template/css/main.scss +49 -0
- data/lib/site_template/feed.xml +1 -1
- data/lib/site_template/index.html +7 -4
- metadata +24 -431
- data/.gitignore +0 -15
- data/.travis.yml +0 -27
- data/CONTRIBUTING.markdown +0 -91
- data/Gemfile +0 -2
- data/History.markdown +0 -1310
- data/Rakefile +0 -268
- data/cucumber.yml +0 -3
- data/docs/jp/CONTRIBUTING.jp.markdown +0 -93
- data/docs/jp/README.jp.markdown +0 -68
- data/features/collections.feature +0 -145
- data/features/create_sites.feature +0 -158
- data/features/data.feature +0 -105
- data/features/drafts.feature +0 -46
- data/features/embed_filters.feature +0 -107
- data/features/frontmatter_defaults.feature +0 -136
- data/features/include_tag.feature +0 -68
- data/features/markdown.feature +0 -67
- data/features/pagination.feature +0 -82
- data/features/permalinks.feature +0 -85
- data/features/post_data.feature +0 -261
- data/features/post_excerpts.feature +0 -50
- data/features/rendering.feature +0 -34
- data/features/site_configuration.feature +0 -283
- data/features/site_data.feature +0 -107
- data/features/step_definitions/jekyll_steps.rb +0 -201
- data/features/support/env.rb +0 -65
- data/jekyll.gemspec +0 -66
- data/lib/site_template/css/main.css +0 -410
- data/script/bootstrap +0 -4
- data/script/branding +0 -11
- data/script/cibuild +0 -7
- data/script/console +0 -38
- data/script/proof +0 -22
- data/script/rebund +0 -140
- data/script/test +0 -17
- data/site/.gitignore +0 -4
- data/site/CNAME +0 -1
- data/site/README +0 -1
- data/site/_config.yml +0 -9
- data/site/_data/docs.yml +0 -46
- data/site/_includes/analytics.html +0 -30
- data/site/_includes/anchor_links.html +0 -32
- data/site/_includes/css/font-awesome.css +0 -44
- data/site/_includes/css/gridism.css +0 -110
- data/site/_includes/css/normalize.css +0 -1
- data/site/_includes/css/pygments.css +0 -72
- data/site/_includes/css/style.css +0 -1045
- data/site/_includes/docs_contents.html +0 -8
- data/site/_includes/docs_contents_mobile.html +0 -10
- data/site/_includes/docs_option.html +0 -11
- data/site/_includes/docs_ul.html +0 -20
- data/site/_includes/footer.html +0 -15
- data/site/_includes/header.html +0 -18
- data/site/_includes/news_contents.html +0 -33
- data/site/_includes/news_contents_mobile.html +0 -11
- data/site/_includes/news_item.html +0 -24
- data/site/_includes/primary-nav-items.html +0 -17
- data/site/_includes/section_nav.html +0 -22
- data/site/_includes/top.html +0 -17
- data/site/_layouts/default.html +0 -13
- data/site/_layouts/docs.html +0 -23
- data/site/_layouts/news.html +0 -19
- data/site/_layouts/news_item.html +0 -27
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +0 -23
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +0 -27
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +0 -28
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +0 -25
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +0 -27
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +0 -31
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +0 -20
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +0 -20
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +0 -23
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +0 -19
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +0 -19
- data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +0 -43
- data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +0 -21
- data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +0 -30
- data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +0 -20
- data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +0 -18
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +0 -26
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
- data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
- data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +0 -31
- data/site/_posts/2014-05-08-jekyll-2-0-3-released.markdown +0 -18
- data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +0 -19
- data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +0 -31
- data/site/_posts/2014-07-01-jekyll-2-1-1-released.markdown +0 -30
- data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +0 -19
- data/site/css/screen.css +0 -31
- data/site/docs/assets.md +0 -66
- data/site/docs/collections.md +0 -259
- data/site/docs/configuration.md +0 -536
- data/site/docs/continuous-integration.md +0 -177
- data/site/docs/contributing.md +0 -133
- data/site/docs/datafiles.md +0 -108
- data/site/docs/deployment-methods.md +0 -127
- data/site/docs/drafts.md +0 -21
- data/site/docs/extras.md +0 -18
- data/site/docs/frontmatter.md +0 -191
- data/site/docs/github-pages.md +0 -91
- data/site/docs/history.md +0 -1514
- data/site/docs/index.md +0 -58
- data/site/docs/installation.md +0 -106
- data/site/docs/migrations.md +0 -11
- data/site/docs/pages.md +0 -86
- data/site/docs/pagination.md +0 -212
- data/site/docs/permalinks.md +0 -188
- data/site/docs/plugins.md +0 -561
- data/site/docs/posts.md +0 -211
- data/site/docs/quickstart.md +0 -26
- data/site/docs/resources.md +0 -43
- data/site/docs/sites.md +0 -29
- data/site/docs/structure.md +0 -190
- data/site/docs/templates.md +0 -376
- data/site/docs/troubleshooting.md +0 -147
- data/site/docs/upgrading.md +0 -146
- data/site/docs/usage.md +0 -74
- data/site/docs/variables.md +0 -382
- data/site/docs/windows.md +0 -44
- data/site/favicon.ico +0 -0
- data/site/feed.xml +0 -48
- data/site/fonts/FontAwesome.otf +0 -0
- data/site/fonts/fontawesome-webfont.eot +0 -0
- data/site/fonts/fontawesome-webfont.svg +0 -504
- data/site/fonts/fontawesome-webfont.ttf +0 -0
- data/site/fonts/fontawesome-webfont.woff +0 -0
- data/site/freenode.txt +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/jekyll-sticker.jpg +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/logo-rss.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/index.html +0 -90
- data/site/js/html5shiv.min.js +0 -4
- data/site/js/respond.min.js +0 -5
- data/site/news/index.html +0 -10
- data/site/news/releases/index.html +0 -10
- data/test/fixtures/broken_front_matter1.erb +0 -5
- data/test/fixtures/broken_front_matter2.erb +0 -4
- data/test/fixtures/broken_front_matter3.erb +0 -7
- data/test/fixtures/exploit_front_matter.erb +0 -4
- data/test/fixtures/front_matter.erb +0 -4
- data/test/helper.rb +0 -80
- data/test/source/+/%# +.md +0 -6
- data/test/source/+/foo.md +0 -7
- data/test/source/.htaccess +0 -8
- data/test/source/_config.dev.toml +0 -2
- data/test/source/_data/categories/dairy.yaml +0 -6
- data/test/source/_data/languages.yml +0 -2
- data/test/source/_data/members.json +0 -12
- data/test/source/_data/members.yaml +0 -7
- data/test/source/_data/products.yml +0 -4
- data/test/source/_drafts/draft-properties.text +0 -11
- data/test/source/_includes/include.html +0 -1
- data/test/source/_includes/params.html +0 -7
- data/test/source/_includes/sig.markdown +0 -3
- data/test/source/_layouts/default.html +0 -27
- data/test/source/_layouts/post/simple.html +0 -1
- data/test/source/_layouts/simple.html +0 -1
- data/test/source/_methods/_do_not_read_me.md +0 -5
- data/test/source/_methods/configuration.md +0 -8
- data/test/source/_methods/sanitized_path.md +0 -5
- data/test/source/_methods/site/_dont_include_me_either.md +0 -5
- data/test/source/_methods/site/generate.md +0 -6
- data/test/source/_methods/site/initialize.md +0 -4
- data/test/source/_methods/um_hi.md +0 -6
- data/test/source/_plugins/dummy.rb +0 -8
- data/test/source/_posts/2008-02-02-not-published.textile +0 -8
- data/test/source/_posts/2008-02-02-published.textile +0 -8
- data/test/source/_posts/2008-10-18-foo-bar.textile +0 -8
- data/test/source/_posts/2008-11-21-complex.textile +0 -8
- data/test/source/_posts/2008-12-03-permalinked-post.textile +0 -9
- data/test/source/_posts/2008-12-13-include.markdown +0 -8
- data/test/source/_posts/2009-01-27-array-categories.textile +0 -10
- data/test/source/_posts/2009-01-27-categories.textile +0 -7
- data/test/source/_posts/2009-01-27-category.textile +0 -7
- data/test/source/_posts/2009-01-27-empty-categories.textile +0 -7
- data/test/source/_posts/2009-01-27-empty-category.textile +0 -7
- data/test/source/_posts/2009-01-27-no-category.textile +0 -6
- data/test/source/_posts/2009-03-12-hash-#1.markdown +0 -6
- data/test/source/_posts/2009-05-18-empty-tag.textile +0 -6
- data/test/source/_posts/2009-05-18-empty-tags.textile +0 -6
- data/test/source/_posts/2009-05-18-tag.textile +0 -6
- data/test/source/_posts/2009-05-18-tags.textile +0 -9
- data/test/source/_posts/2009-06-22-empty-yaml.textile +0 -3
- data/test/source/_posts/2009-06-22-no-yaml.textile +0 -1
- data/test/source/_posts/2010-01-08-triple-dash.markdown +0 -5
- data/test/source/_posts/2010-01-09-date-override.textile +0 -7
- data/test/source/_posts/2010-01-09-time-override.textile +0 -7
- data/test/source/_posts/2010-01-09-timezone-override.textile +0 -7
- data/test/source/_posts/2010-01-16-override-data.textile +0 -4
- data/test/source/_posts/2011-04-12-md-extension.md +0 -7
- data/test/source/_posts/2011-04-12-text-extension.text +0 -0
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +0 -14
- data/test/source/_posts/2013-01-12-nil-layout.textile +0 -6
- data/test/source/_posts/2013-01-12-no-layout.textile +0 -5
- data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
- data/test/source/_posts/2013-04-11-custom-excerpt.markdown +0 -10
- data/test/source/_posts/2013-05-10-number-category.textile +0 -7
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +0 -23
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/_posts/2013-12-17-include-variable-filters.markdown +0 -21
- data/test/source/_posts/2013-12-20-properties.text +0 -11
- data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
- data/test/source/_posts/2014-03-03-yaml-with-dots.md +0 -5
- data/test/source/_posts/2014-03-22-escape-+ %20[].markdown +0 -6
- data/test/source/_posts/es/2008-11-21-nested.textile +0 -8
- data/test/source/_sass/_grid.scss +0 -1
- data/test/source/_slides/example-slide-1.html +0 -4
- data/test/source/_slides/example-slide-2.html +0 -7
- data/test/source/_slides/example-slide-3.html +0 -5
- data/test/source/_with.dots/all.dots/2.4.0.md +0 -5
- data/test/source/_with.dots/file.with.dots.md +0 -0
- data/test/source/about.html +0 -6
- data/test/source/category/_posts/2008-9-23-categories.textile +0 -6
- data/test/source/contacts.html +0 -5
- data/test/source/contacts/bar.html +0 -5
- data/test/source/contacts/index.html +0 -5
- data/test/source/css/main.scss +0 -4
- data/test/source/css/screen.css +0 -76
- data/test/source/deal.with.dots.html +0 -7
- data/test/source/environment.html +0 -5
- data/test/source/exploit.md +0 -5
- data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +0 -8
- data/test/source/index.html +0 -22
- data/test/source/js/coffeescript.coffee +0 -10
- data/test/source/pgp.key +0 -2
- data/test/source/products.yml +0 -4
- data/test/source/properties.html +0 -8
- data/test/source/sitemap.xml +0 -32
- data/test/source/static_files.html +0 -4
- data/test/source/symlink-test/symlinked-file +0 -22
- data/test/source/unpublished.html +0 -7
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +0 -7
- data/test/source/z_category/_posts/2008-9-23-categories.textile +0 -6
- data/test/suite.rb +0 -11
- data/test/test_cleaner.rb +0 -77
- data/test/test_coffeescript.rb +0 -49
- data/test/test_collections.rb +0 -224
- data/test/test_command.rb +0 -53
- data/test/test_configuration.rb +0 -201
- data/test/test_convertible.rb +0 -49
- data/test/test_document.rb +0 -193
- data/test/test_draft.rb +0 -56
- data/test/test_entry_filter.rb +0 -124
- data/test/test_excerpt.rb +0 -131
- data/test/test_filters.rb +0 -207
- data/test/test_generated_site.rb +0 -97
- data/test/test_kramdown.rb +0 -62
- data/test/test_layout_reader.rb +0 -34
- data/test/test_liquid_extensions.rb +0 -31
- data/test/test_log_adapter.rb +0 -59
- data/test/test_new_command.rb +0 -104
- data/test/test_page.rb +0 -254
- data/test/test_path_sanitization.rb +0 -18
- data/test/test_post.rb +0 -741
- data/test/test_rdiscount.rb +0 -22
- data/test/test_redcarpet.rb +0 -77
- data/test/test_redcloth.rb +0 -86
- data/test/test_related_posts.rb +0 -47
- data/test/test_sass.rb +0 -26
- data/test/test_site.rb +0 -452
- data/test/test_tags.rb +0 -509
- data/test/test_url.rb +0 -28
- data/test/test_utils.rb +0 -67
data/lib/jekyll/document.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class Document
|
3
5
|
include Comparable
|
@@ -15,6 +17,7 @@ module Jekyll
|
|
15
17
|
@site = relations[:site]
|
16
18
|
@path = path
|
17
19
|
@collection = relations[:collection]
|
20
|
+
@has_yaml_header = nil
|
18
21
|
end
|
19
22
|
|
20
23
|
# Fetch the Document's data.
|
@@ -77,7 +80,21 @@ module Jekyll
|
|
77
80
|
# Returns true if the extname belongs to the set of extensions
|
78
81
|
# that asset files use.
|
79
82
|
def asset_file?
|
80
|
-
|
83
|
+
sass_file? || coffeescript_file?
|
84
|
+
end
|
85
|
+
|
86
|
+
# Determine whether the document is a Sass file.
|
87
|
+
#
|
88
|
+
# Returns true if extname == .sass or .scss, false otherwise.
|
89
|
+
def sass_file?
|
90
|
+
%w[.sass .scss].include?(extname)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Determine whether the document is a CoffeeScript file.
|
94
|
+
#
|
95
|
+
# Returns true if extname == .coffee, false otherwise.
|
96
|
+
def coffeescript_file?
|
97
|
+
'.coffee'.eql?(extname)
|
81
98
|
end
|
82
99
|
|
83
100
|
# Determine whether the file should be rendered with Liquid.
|
@@ -85,7 +102,7 @@ module Jekyll
|
|
85
102
|
# Returns false if the document is either an asset file or a yaml file,
|
86
103
|
# true otherwise.
|
87
104
|
def render_with_liquid?
|
88
|
-
!(
|
105
|
+
!(coffeescript_file? || yaml_file?)
|
89
106
|
end
|
90
107
|
|
91
108
|
# Determine whether the file should be placed into layouts.
|
@@ -172,7 +189,7 @@ module Jekyll
|
|
172
189
|
#
|
173
190
|
# Returns true if the 'published' key is specified in the YAML front-matter and not `false`.
|
174
191
|
def published?
|
175
|
-
!(data.
|
192
|
+
!(data.key?('published') && data['published'] == false)
|
176
193
|
end
|
177
194
|
|
178
195
|
# Read in the file and assign the content and data based on the file contents.
|
@@ -235,7 +252,7 @@ module Jekyll
|
|
235
252
|
#
|
236
253
|
# Returns the content of the document
|
237
254
|
def to_s
|
238
|
-
|
255
|
+
content || ''
|
239
256
|
end
|
240
257
|
|
241
258
|
# Compare this document against another document.
|
data/lib/jekyll/filters.rb
CHANGED
@@ -25,6 +25,28 @@ module Jekyll
|
|
25
25
|
converter.convert(input)
|
26
26
|
end
|
27
27
|
|
28
|
+
# Convert a Sass string into CSS output.
|
29
|
+
#
|
30
|
+
# input - The Sass String to convert.
|
31
|
+
#
|
32
|
+
# Returns the CSS formatted String.
|
33
|
+
def sassify(input)
|
34
|
+
site = @context.registers[:site]
|
35
|
+
converter = site.getConverterImpl(Jekyll::Converters::Sass)
|
36
|
+
converter.convert(input)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Convert a Scss string into CSS output.
|
40
|
+
#
|
41
|
+
# input - The Scss String to convert.
|
42
|
+
#
|
43
|
+
# Returns the CSS formatted String.
|
44
|
+
def scssify(input)
|
45
|
+
site = @context.registers[:site]
|
46
|
+
converter = site.getConverterImpl(Jekyll::Converters::Scss)
|
47
|
+
converter.convert(input)
|
48
|
+
end
|
49
|
+
|
28
50
|
# Format a date in short format e.g. "27 Jan 2011".
|
29
51
|
#
|
30
52
|
# date - the Time to format.
|
@@ -155,7 +177,7 @@ module Jekyll
|
|
155
177
|
#
|
156
178
|
# Returns the converted json string
|
157
179
|
def jsonify(input)
|
158
|
-
input.to_json
|
180
|
+
as_liquid(input).to_json
|
159
181
|
end
|
160
182
|
|
161
183
|
# Group an array of items by a property
|
@@ -254,5 +276,9 @@ module Jekyll
|
|
254
276
|
item[property.to_s]
|
255
277
|
end
|
256
278
|
end
|
279
|
+
|
280
|
+
def as_liquid(item)
|
281
|
+
item.respond_to?(:to_liquid) ? item.to_liquid : item
|
282
|
+
end
|
257
283
|
end
|
258
284
|
end
|
@@ -10,6 +10,26 @@ module Jekyll
|
|
10
10
|
@site = site
|
11
11
|
end
|
12
12
|
|
13
|
+
def update_deprecated_types(set)
|
14
|
+
return set unless set.key?('scope') && set['scope'].key?('type')
|
15
|
+
|
16
|
+
set['scope']['type'] = case set['scope']['type']
|
17
|
+
when 'page'
|
18
|
+
Deprecator.defaults_deprecate_type('page', 'pages')
|
19
|
+
'pages'
|
20
|
+
when 'post'
|
21
|
+
Deprecator.defaults_deprecate_type('post', 'posts')
|
22
|
+
'posts'
|
23
|
+
when 'draft'
|
24
|
+
Deprecator.defaults_deprecate_type('draft', 'drafts')
|
25
|
+
'drafts'
|
26
|
+
else
|
27
|
+
set['scope']['type']
|
28
|
+
end
|
29
|
+
|
30
|
+
set
|
31
|
+
end
|
32
|
+
|
13
33
|
# Finds a default value for a given setting, filtered by path and type
|
14
34
|
#
|
15
35
|
# path - the path (relative to the source) of the page, post or :draft the default is used in
|
@@ -21,7 +41,7 @@ module Jekyll
|
|
21
41
|
old_scope = nil
|
22
42
|
|
23
43
|
matching_sets(path, type).each do |set|
|
24
|
-
if set['values'].
|
44
|
+
if set['values'].key?(setting) && has_precedence?(old_scope, set['scope'])
|
25
45
|
value = set['values'][setting]
|
26
46
|
old_scope = set['scope']
|
27
47
|
end
|
@@ -63,7 +83,7 @@ module Jekyll
|
|
63
83
|
end
|
64
84
|
|
65
85
|
def applies_path?(scope, path)
|
66
|
-
return true if scope['path'].empty?
|
86
|
+
return true if !scope.has_key?('path') || scope['path'].empty?
|
67
87
|
|
68
88
|
scope_path = Pathname.new(scope['path'])
|
69
89
|
Pathname.new(sanitize_path(path)).ascend do |path|
|
@@ -73,8 +93,19 @@ module Jekyll
|
|
73
93
|
end
|
74
94
|
end
|
75
95
|
|
96
|
+
# Determines whether the scope applies to type.
|
97
|
+
# The scope applies to the type if:
|
98
|
+
# 1. no 'type' is specified
|
99
|
+
# 2. the 'type' in the scope is the same as the type asked about
|
100
|
+
#
|
101
|
+
# scope - the Hash defaults set being asked about application
|
102
|
+
# type - the type of the document being processed / asked about
|
103
|
+
# its defaults.
|
104
|
+
#
|
105
|
+
# Returns true if either of the above conditions are satisfied,
|
106
|
+
# otherwise returns false
|
76
107
|
def applies_type?(scope, type)
|
77
|
-
!scope.
|
108
|
+
!scope.key?('type') || scope['type'].eql?(type.to_s)
|
78
109
|
end
|
79
110
|
|
80
111
|
# Checks if a given set of default values is valid
|
@@ -83,7 +114,7 @@ module Jekyll
|
|
83
114
|
#
|
84
115
|
# Returns true if the set is valid and can be used in this class
|
85
116
|
def valid?(set)
|
86
|
-
set.is_a?(Hash) && set['
|
117
|
+
set.is_a?(Hash) && set['values'].is_a?(Hash)
|
87
118
|
end
|
88
119
|
|
89
120
|
# Determines if a new scope has precedence over an old one
|
@@ -100,10 +131,10 @@ module Jekyll
|
|
100
131
|
|
101
132
|
if new_path.length != old_path.length
|
102
133
|
new_path.length >= old_path.length
|
103
|
-
elsif new_scope.
|
134
|
+
elsif new_scope.key? 'type'
|
104
135
|
true
|
105
136
|
else
|
106
|
-
!old_scope.
|
137
|
+
!old_scope.key? 'type'
|
107
138
|
end
|
108
139
|
end
|
109
140
|
|
@@ -112,7 +143,7 @@ module Jekyll
|
|
112
143
|
# Returns an array of hashes
|
113
144
|
def matching_sets(path, type)
|
114
145
|
valid_sets.select do |set|
|
115
|
-
applies?(set['scope'], path, type)
|
146
|
+
!set.has_key?('scope') || applies?(set['scope'], path, type)
|
116
147
|
end
|
117
148
|
end
|
118
149
|
|
@@ -126,12 +157,15 @@ module Jekyll
|
|
126
157
|
sets = @site.config['defaults']
|
127
158
|
return [] unless sets.is_a?(Array)
|
128
159
|
|
129
|
-
sets.
|
130
|
-
|
131
|
-
|
160
|
+
sets.map do |set|
|
161
|
+
if valid?(set)
|
162
|
+
update_deprecated_types(set)
|
163
|
+
else
|
164
|
+
Jekyll.logger.warn "Defaults:", "An invalid front-matter default set was found:"
|
165
|
+
Jekyll.logger.warn "#{set}"
|
166
|
+
nil
|
132
167
|
end
|
133
|
-
|
134
|
-
end
|
168
|
+
end.compact
|
135
169
|
end
|
136
170
|
|
137
171
|
# Sanitizes the given path by removing a leading and addding a trailing slash
|
data/lib/jekyll/plugin.rb
CHANGED
@@ -27,7 +27,7 @@ module Jekyll
|
|
27
27
|
# Returns the Symbol priority.
|
28
28
|
def self.priority(priority = nil)
|
29
29
|
@priority ||= nil
|
30
|
-
if priority && PRIORITIES.
|
30
|
+
if priority && PRIORITIES.key?(priority)
|
31
31
|
@priority = priority
|
32
32
|
end
|
33
33
|
@priority || :normal
|
@@ -56,6 +56,15 @@ module Jekyll
|
|
56
56
|
PRIORITIES[other.priority] <=> PRIORITIES[self.priority]
|
57
57
|
end
|
58
58
|
|
59
|
+
# Spaceship is priority [higher -> lower]
|
60
|
+
#
|
61
|
+
# other - The class to be compared.
|
62
|
+
#
|
63
|
+
# Returns -1, 0, 1.
|
64
|
+
def <=>(other)
|
65
|
+
self.class <=> other.class
|
66
|
+
end
|
67
|
+
|
59
68
|
# Initialize a new plugin. This should be overridden by the subclass.
|
60
69
|
#
|
61
70
|
# config - The Hash of configuration options.
|
data/lib/jekyll/post.rb
CHANGED
@@ -60,8 +60,8 @@ module Jekyll
|
|
60
60
|
site.frontmatter_defaults.find(File.join(dir, name), type, key)
|
61
61
|
end
|
62
62
|
|
63
|
-
if data.
|
64
|
-
self.date =
|
63
|
+
if data.key?('date')
|
64
|
+
self.date = Utils.parse_date(data["date"].to_s, "Post '#{relative_path}' does not have a valid date in the YAML front matter.")
|
65
65
|
end
|
66
66
|
|
67
67
|
populate_categories
|
@@ -69,7 +69,7 @@ module Jekyll
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def published?
|
72
|
-
if data.
|
72
|
+
if data.key?('published') && data['published'] == false
|
73
73
|
false
|
74
74
|
else
|
75
75
|
true
|
@@ -159,16 +159,9 @@ module Jekyll
|
|
159
159
|
# Returns nothing.
|
160
160
|
def process(name)
|
161
161
|
m, cats, date, slug, ext = *name.match(MATCHER)
|
162
|
-
self.
|
163
|
-
self.categories += (cats || '').downcase.split('/')
|
164
|
-
self.date = Time.parse(date)
|
162
|
+
self.date = Utils.parse_date(date, "Post '#{relative_path}' does not have a valid date in the filename.")
|
165
163
|
self.slug = slug
|
166
164
|
self.ext = ext
|
167
|
-
rescue ArgumentError
|
168
|
-
path = File.join(@dir || "", name)
|
169
|
-
msg = "Post '#{path}' does not have a valid date.\n"
|
170
|
-
msg << "Fix the date, or exclude the file or directory from being processed"
|
171
|
-
raise Errors::FatalException.new(msg)
|
172
165
|
end
|
173
166
|
|
174
167
|
# The generated directory into which the post will be placed
|
@@ -223,8 +216,8 @@ module Jekyll
|
|
223
216
|
:month => date.strftime("%m"),
|
224
217
|
:day => date.strftime("%d"),
|
225
218
|
:title => slug,
|
226
|
-
:i_day => date.strftime("
|
227
|
-
:i_month => date.strftime("
|
219
|
+
:i_day => date.strftime("%-d"),
|
220
|
+
:i_month => date.strftime("%-m"),
|
228
221
|
:categories => (categories || []).map { |c| c.to_s }.join('/'),
|
229
222
|
:short_month => date.strftime("%b"),
|
230
223
|
:short_year => date.strftime("%y"),
|
data/lib/jekyll/related_posts.rb
CHANGED
@@ -10,7 +10,7 @@ module Jekyll
|
|
10
10
|
def initialize(post)
|
11
11
|
@post = post
|
12
12
|
@site = post.site
|
13
|
-
require 'classifier' if site.lsi
|
13
|
+
require 'classifier-reborn' if site.lsi
|
14
14
|
end
|
15
15
|
|
16
16
|
def build
|
@@ -27,7 +27,7 @@ module Jekyll
|
|
27
27
|
|
28
28
|
def build_index
|
29
29
|
self.class.lsi ||= begin
|
30
|
-
lsi =
|
30
|
+
lsi = ClassifierReborn::LSI.new(:auto_rebuild => false)
|
31
31
|
display("Populating LSI...")
|
32
32
|
|
33
33
|
site.posts.each do |x|
|
data/lib/jekyll/renderer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class Renderer
|
3
5
|
|
@@ -47,14 +49,17 @@ module Jekyll
|
|
47
49
|
output = render_liquid(output, payload, info)
|
48
50
|
end
|
49
51
|
|
52
|
+
output = convert(output)
|
53
|
+
document.content = output
|
54
|
+
|
50
55
|
if document.place_in_layout?
|
51
56
|
place_in_layouts(
|
52
|
-
|
57
|
+
output,
|
53
58
|
payload,
|
54
59
|
info
|
55
60
|
)
|
56
61
|
else
|
57
|
-
|
62
|
+
output
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
data/lib/jekyll/site.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
class Site
|
3
5
|
attr_accessor :config, :layouts, :posts, :pages, :static_files,
|
@@ -49,7 +51,7 @@ module Jekyll
|
|
49
51
|
#
|
50
52
|
# Returns nothing
|
51
53
|
def reset
|
52
|
-
self.time = (config['time'] ?
|
54
|
+
self.time = (config['time'] ? Utils.parse_date(config['time'].to_s, "Invalid time in _config.yml.") : Time.now)
|
53
55
|
self.layouts = {}
|
54
56
|
self.posts = []
|
55
57
|
self.pages = []
|
@@ -142,7 +144,7 @@ module Jekyll
|
|
142
144
|
if File.directory?(f_abs)
|
143
145
|
f_rel = File.join(dir, f)
|
144
146
|
read_directories(f_rel) unless dest.sub(/\/$/, '') == f_abs
|
145
|
-
elsif has_yaml_header?(f_abs)
|
147
|
+
elsif Utils.has_yaml_header?(f_abs)
|
146
148
|
page = Page.new(self, source, dir, f)
|
147
149
|
pages << page if publisher.publish?(page)
|
148
150
|
else
|
@@ -430,7 +432,7 @@ module Jekyll
|
|
430
432
|
|
431
433
|
def documents
|
432
434
|
collections.reduce(Set.new) do |docs, (_, collection)|
|
433
|
-
docs.
|
435
|
+
docs + collection.docs + collection.files
|
434
436
|
end.to_a
|
435
437
|
end
|
436
438
|
|
@@ -452,10 +454,6 @@ module Jekyll
|
|
452
454
|
pages.any? { |page| page.uses_relative_permalinks }
|
453
455
|
end
|
454
456
|
|
455
|
-
def has_yaml_header?(file)
|
456
|
-
!!(File.open(file, 'rb') { |f| f.read(5) } =~ /\A---\r?\n/)
|
457
|
-
end
|
458
|
-
|
459
457
|
def limit_posts!
|
460
458
|
limit = posts.length < limit_posts ? posts.length : limit_posts
|
461
459
|
self.posts = posts[-limit, limit]
|
data/lib/jekyll/static_file.rb
CHANGED
@@ -9,11 +9,12 @@ module Jekyll
|
|
9
9
|
# base - The String path to the <source>.
|
10
10
|
# dir - The String path between <source> and the file.
|
11
11
|
# name - The String filename of the file.
|
12
|
-
def initialize(site, base, dir, name)
|
12
|
+
def initialize(site, base, dir, name, collection = nil)
|
13
13
|
@site = site
|
14
14
|
@base = base
|
15
15
|
@dir = dir
|
16
16
|
@name = name
|
17
|
+
@collection = collection
|
17
18
|
end
|
18
19
|
|
19
20
|
# Returns source file path.
|
@@ -23,7 +24,11 @@ module Jekyll
|
|
23
24
|
|
24
25
|
# Returns the source file path relative to the site source
|
25
26
|
def relative_path
|
26
|
-
@relative_path ||=
|
27
|
+
@relative_path ||= File.join(*[@dir, @name].compact)
|
28
|
+
end
|
29
|
+
|
30
|
+
def extname
|
31
|
+
File.extname(path)
|
27
32
|
end
|
28
33
|
|
29
34
|
# Obtain destination path.
|
@@ -32,7 +37,15 @@ module Jekyll
|
|
32
37
|
#
|
33
38
|
# Returns destination file path.
|
34
39
|
def destination(dest)
|
35
|
-
File.join(*[dest,
|
40
|
+
File.join(*[dest, destination_rel_dir, @name].compact)
|
41
|
+
end
|
42
|
+
|
43
|
+
def destination_rel_dir
|
44
|
+
if @collection
|
45
|
+
@dir.gsub(/\A_/, '')
|
46
|
+
else
|
47
|
+
@dir
|
48
|
+
end
|
36
49
|
end
|
37
50
|
|
38
51
|
# Returns last modification time for this file.
|
@@ -47,6 +60,13 @@ module Jekyll
|
|
47
60
|
@@mtimes[path] != mtime
|
48
61
|
end
|
49
62
|
|
63
|
+
# Whether to write the file to the filesystem
|
64
|
+
#
|
65
|
+
# Returns true.
|
66
|
+
def write?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
|
50
70
|
# Write the static file to the destination directory (if modified).
|
51
71
|
#
|
52
72
|
# dest - The String path to the destination dir.
|
@@ -75,7 +95,7 @@ module Jekyll
|
|
75
95
|
|
76
96
|
def to_liquid
|
77
97
|
{
|
78
|
-
"path" => relative_path,
|
98
|
+
"path" => File.join("", relative_path),
|
79
99
|
"modified_time" => mtime.to_s,
|
80
100
|
"extname" => File.extname(relative_path)
|
81
101
|
}
|