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/configuration.rb
CHANGED
@@ -36,7 +36,7 @@ module Jekyll
|
|
36
36
|
'exclude' => [],
|
37
37
|
'paginate_path' => '/page:num',
|
38
38
|
|
39
|
-
'markdown_ext' => 'markdown,
|
39
|
+
'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md',
|
40
40
|
'textile_ext' => 'textile',
|
41
41
|
|
42
42
|
'port' => '4000',
|
@@ -159,7 +159,7 @@ module Jekyll
|
|
159
159
|
begin
|
160
160
|
files.each do |config_file|
|
161
161
|
new_config = read_config_file(config_file)
|
162
|
-
configuration =
|
162
|
+
configuration = Utils.deep_merge_hashes(configuration, new_config)
|
163
163
|
end
|
164
164
|
rescue ArgumentError => err
|
165
165
|
Jekyll.logger.warn "WARNING:", "Error reading configuration. " +
|
@@ -229,7 +229,7 @@ module Jekyll
|
|
229
229
|
config[option] = csv_to_array(config[option])
|
230
230
|
end
|
231
231
|
end
|
232
|
-
|
232
|
+
|
233
233
|
if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
|
234
234
|
Jekyll::Deprecator.deprecation_message "You're using the 'maruku' " +
|
235
235
|
"Markdown processor. Maruku support has been deprecated and will " +
|
data/lib/jekyll/convertible.rb
CHANGED
@@ -18,18 +18,18 @@ module Jekyll
|
|
18
18
|
module Convertible
|
19
19
|
# Returns the contents as a String.
|
20
20
|
def to_s
|
21
|
-
|
21
|
+
content || ''
|
22
22
|
end
|
23
23
|
|
24
24
|
# Whether the file is published or not, as indicated in YAML front-matter
|
25
25
|
def published?
|
26
|
-
!(
|
26
|
+
!(data.has_key?('published') && data['published'] == false)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Returns merged option hash for File.read of self.site (if exists)
|
30
30
|
# and a given param
|
31
31
|
def merged_file_read_opts(opts)
|
32
|
-
(
|
32
|
+
(site ? site.file_read_opts : {}).merge(opts)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Read the YAML frontmatter.
|
@@ -43,7 +43,7 @@ module Jekyll
|
|
43
43
|
begin
|
44
44
|
self.content = File.read(File.join(base, name),
|
45
45
|
merged_file_read_opts(opts))
|
46
|
-
if
|
46
|
+
if content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
47
47
|
self.content = $POSTMATCH
|
48
48
|
self.data = SafeYAML.load($1)
|
49
49
|
end
|
@@ -60,10 +60,10 @@ module Jekyll
|
|
60
60
|
#
|
61
61
|
# Returns nothing.
|
62
62
|
def transform
|
63
|
-
self.content = converter.convert(
|
63
|
+
self.content = converter.convert(content)
|
64
64
|
rescue => e
|
65
65
|
Jekyll.logger.error "Conversion error:", "There was an error converting" +
|
66
|
-
" '#{
|
66
|
+
" '#{path}'."
|
67
67
|
raise e
|
68
68
|
end
|
69
69
|
|
@@ -72,7 +72,7 @@ module Jekyll
|
|
72
72
|
# Returns the String extension for the output file.
|
73
73
|
# e.g. ".html" for an HTML output file.
|
74
74
|
def output_ext
|
75
|
-
converter.output_ext(
|
75
|
+
converter.output_ext(ext)
|
76
76
|
end
|
77
77
|
|
78
78
|
# Determine which converter to use based on this convertible's
|
@@ -80,7 +80,7 @@ module Jekyll
|
|
80
80
|
#
|
81
81
|
# Returns the Converter instance.
|
82
82
|
def converter
|
83
|
-
@converter ||=
|
83
|
+
@converter ||= site.converters.find { |c| c.matches(ext) }
|
84
84
|
end
|
85
85
|
|
86
86
|
# Render Liquid in the content
|
@@ -107,7 +107,7 @@ module Jekyll
|
|
107
107
|
further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map { |attribute|
|
108
108
|
[attribute, send(attribute)]
|
109
109
|
}]
|
110
|
-
|
110
|
+
Utils.deep_merge_hashes(data, further_data)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Recursively render layouts
|
@@ -119,16 +119,16 @@ module Jekyll
|
|
119
119
|
# Returns nothing
|
120
120
|
def render_all_layouts(layouts, payload, info)
|
121
121
|
# recursively render layouts
|
122
|
-
layout = layouts[
|
122
|
+
layout = layouts[data["layout"]]
|
123
123
|
used = Set.new([layout])
|
124
124
|
|
125
125
|
while layout
|
126
|
-
payload =
|
126
|
+
payload = Utils.deep_merge_hashes(payload, {"content" => output, "page" => layout.data})
|
127
127
|
|
128
|
-
self.output =
|
128
|
+
self.output = render_liquid(layout.content,
|
129
129
|
payload,
|
130
130
|
info,
|
131
|
-
File.join(
|
131
|
+
File.join(site.config['layouts'], layout.name))
|
132
132
|
|
133
133
|
if layout = layouts[layout.data["layout"]]
|
134
134
|
if used.include?(layout)
|
@@ -147,21 +147,19 @@ module Jekyll
|
|
147
147
|
#
|
148
148
|
# Returns nothing.
|
149
149
|
def do_layout(payload, layouts)
|
150
|
-
info = { :filters => [Jekyll::Filters], :registers => { :site =>
|
150
|
+
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload['page'] } }
|
151
151
|
|
152
152
|
# render and transform content (this becomes the final content of the object)
|
153
153
|
payload["highlighter_prefix"] = converter.highlighter_prefix
|
154
154
|
payload["highlighter_suffix"] = converter.highlighter_suffix
|
155
155
|
|
156
|
-
self.content =
|
157
|
-
|
158
|
-
info)
|
159
|
-
self.transform
|
156
|
+
self.content = render_liquid(content, payload, info)
|
157
|
+
transform
|
160
158
|
|
161
159
|
# output keeps track of what will finally be written
|
162
|
-
self.output =
|
160
|
+
self.output = content
|
163
161
|
|
164
|
-
|
162
|
+
render_all_layouts(layouts, payload, info)
|
165
163
|
end
|
166
164
|
|
167
165
|
# Write the generated page file to the destination directory.
|
@@ -173,7 +171,7 @@ module Jekyll
|
|
173
171
|
path = destination(dest)
|
174
172
|
FileUtils.mkdir_p(File.dirname(path))
|
175
173
|
File.open(path, 'wb') do |f|
|
176
|
-
f.write(
|
174
|
+
f.write(output)
|
177
175
|
end
|
178
176
|
end
|
179
177
|
|
data/lib/jekyll/draft.rb
CHANGED
@@ -18,6 +18,11 @@ module Jekyll
|
|
18
18
|
File.join(source, dir, '_drafts')
|
19
19
|
end
|
20
20
|
|
21
|
+
# The path to the draft source file, relative to the site source
|
22
|
+
def relative_path
|
23
|
+
File.join(@dir, '_drafts', @name)
|
24
|
+
end
|
25
|
+
|
21
26
|
# Extract information from the post filename.
|
22
27
|
#
|
23
28
|
# name - The String filename of the post file.
|
data/lib/jekyll/excerpt.rb
CHANGED
@@ -8,7 +8,7 @@ module Jekyll
|
|
8
8
|
|
9
9
|
attr_accessor :post
|
10
10
|
attr_accessor :content, :output, :ext
|
11
|
-
|
11
|
+
|
12
12
|
def_delegator :@post, :site, :site
|
13
13
|
def_delegator :@post, :name, :name
|
14
14
|
def_delegator :@post, :ext, :ext
|
@@ -39,7 +39,7 @@ module Jekyll
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# 'Path' of the excerpt.
|
42
|
-
#
|
42
|
+
#
|
43
43
|
# Returns the path for the post this excerpt belongs to with #excerpt appended
|
44
44
|
def path
|
45
45
|
File.join(post.path, "#excerpt")
|
@@ -47,9 +47,9 @@ module Jekyll
|
|
47
47
|
|
48
48
|
# Check if excerpt includes a string
|
49
49
|
#
|
50
|
-
# Returns true if the string passed in
|
50
|
+
# Returns true if the string passed in
|
51
51
|
def include?(something)
|
52
|
-
(
|
52
|
+
(output && output.include?(something)) || content.include?(something)
|
53
53
|
end
|
54
54
|
|
55
55
|
# The UID for this post (useful in feeds).
|
@@ -61,7 +61,7 @@ module Jekyll
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def to_s
|
64
|
-
|
64
|
+
output || content
|
65
65
|
end
|
66
66
|
|
67
67
|
# Returns the shorthand String identifier of this Post.
|
data/lib/jekyll/layout.rb
CHANGED
data/lib/jekyll/layout_reader.rb
CHANGED
@@ -14,6 +14,10 @@ module Jekyll
|
|
14
14
|
@layouts
|
15
15
|
end
|
16
16
|
|
17
|
+
def layout_directory
|
18
|
+
@layout_directory ||= (layout_directory_in_cwd || layout_directory_inside_source)
|
19
|
+
end
|
20
|
+
|
17
21
|
private
|
18
22
|
|
19
23
|
def layout_entries
|
@@ -33,8 +37,17 @@ module Jekyll
|
|
33
37
|
Dir.chdir(directory) { yield }
|
34
38
|
end
|
35
39
|
|
36
|
-
def
|
37
|
-
|
40
|
+
def layout_directory_inside_source
|
41
|
+
Jekyll.sanitized_path(site.source, site.config['layouts'])
|
42
|
+
end
|
43
|
+
|
44
|
+
def layout_directory_in_cwd
|
45
|
+
dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts'])
|
46
|
+
if File.directory?(dir)
|
47
|
+
dir
|
48
|
+
else
|
49
|
+
nil
|
50
|
+
end
|
38
51
|
end
|
39
52
|
end
|
40
53
|
end
|
data/lib/jekyll/page.rb
CHANGED
@@ -28,8 +28,8 @@ module Jekyll
|
|
28
28
|
@dir = dir
|
29
29
|
@name = name
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
process(name)
|
32
|
+
read_yaml(File.join(base, dir), name)
|
33
33
|
end
|
34
34
|
|
35
35
|
# The generated directory into which the page will be placed
|
@@ -46,11 +46,11 @@ module Jekyll
|
|
46
46
|
#
|
47
47
|
# Returns the String permalink or nil if none has been set.
|
48
48
|
def permalink
|
49
|
-
return nil if
|
49
|
+
return nil if data.nil? || data['permalink'].nil?
|
50
50
|
if site.config['relative_permalinks']
|
51
|
-
File.join(@dir,
|
51
|
+
File.join(@dir, data['permalink'])
|
52
52
|
else
|
53
|
-
|
53
|
+
data['permalink']
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -58,7 +58,7 @@ module Jekyll
|
|
58
58
|
#
|
59
59
|
# Returns the template String.
|
60
60
|
def template
|
61
|
-
if
|
61
|
+
if site.permalink_style == :pretty
|
62
62
|
if index? && html?
|
63
63
|
"/:path/"
|
64
64
|
elsif html?
|
@@ -87,8 +87,8 @@ module Jekyll
|
|
87
87
|
def url_placeholders
|
88
88
|
{
|
89
89
|
:path => @dir,
|
90
|
-
:basename =>
|
91
|
-
:output_ext =>
|
90
|
+
:basename => basename,
|
91
|
+
:output_ext => output_ext
|
92
92
|
}
|
93
93
|
end
|
94
94
|
|
@@ -99,7 +99,7 @@ module Jekyll
|
|
99
99
|
# Returns nothing.
|
100
100
|
def process(name)
|
101
101
|
self.ext = File.extname(name)
|
102
|
-
self.basename = name[0 .. -
|
102
|
+
self.basename = name[0 .. -ext.length - 1]
|
103
103
|
end
|
104
104
|
|
105
105
|
# Add any necessary layouts to this post
|
@@ -109,10 +109,10 @@ module Jekyll
|
|
109
109
|
#
|
110
110
|
# Returns nothing.
|
111
111
|
def render(layouts, site_payload)
|
112
|
-
payload = {
|
113
|
-
"page" =>
|
112
|
+
payload = Utils.deep_merge_hashes({
|
113
|
+
"page" => to_liquid,
|
114
114
|
'paginator' => pager.to_liquid
|
115
|
-
}
|
115
|
+
}, site_payload)
|
116
116
|
|
117
117
|
do_layout(payload, layouts)
|
118
118
|
end
|
@@ -121,7 +121,7 @@ module Jekyll
|
|
121
121
|
#
|
122
122
|
# Returns the path to the source file
|
123
123
|
def path
|
124
|
-
|
124
|
+
data.fetch('path', relative_path.sub(/\A\//, ''))
|
125
125
|
end
|
126
126
|
|
127
127
|
# The path to the page source file, relative to the site source
|
@@ -135,14 +135,14 @@ module Jekyll
|
|
135
135
|
#
|
136
136
|
# Returns the destination file path String.
|
137
137
|
def destination(dest)
|
138
|
-
path =
|
139
|
-
path = File.join(path, "index.html") if
|
138
|
+
path = Jekyll.sanitized_path(dest, url)
|
139
|
+
path = File.join(path, "index.html") if url =~ /\/$/
|
140
140
|
path
|
141
141
|
end
|
142
142
|
|
143
143
|
# Returns the object as a debug String.
|
144
144
|
def inspect
|
145
|
-
"#<Jekyll:Page @name=#{
|
145
|
+
"#<Jekyll:Page @name=#{name.inspect}>"
|
146
146
|
end
|
147
147
|
|
148
148
|
# Returns the Boolean of whether this Page is HTML or not.
|
@@ -156,7 +156,7 @@ module Jekyll
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def uses_relative_permalinks
|
159
|
-
permalink &&
|
159
|
+
permalink && !@dir.empty? && site.config['relative_permalinks']
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
data/lib/jekyll/post.rb
CHANGED
@@ -49,30 +49,30 @@ module Jekyll
|
|
49
49
|
def initialize(site, source, dir, name)
|
50
50
|
@site = site
|
51
51
|
@dir = dir
|
52
|
-
@base =
|
52
|
+
@base = containing_dir(source, dir)
|
53
53
|
@name = name
|
54
54
|
|
55
55
|
self.categories = dir.downcase.split('/').reject { |x| x.empty? }
|
56
|
-
|
57
|
-
|
56
|
+
process(name)
|
57
|
+
read_yaml(@base, name)
|
58
58
|
|
59
|
-
if
|
60
|
-
self.date = Time.parse(
|
59
|
+
if data.has_key?('date')
|
60
|
+
self.date = Time.parse(data["date"].to_s)
|
61
61
|
end
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
populate_categories
|
64
|
+
populate_tags
|
65
65
|
end
|
66
66
|
|
67
67
|
def populate_categories
|
68
|
-
if
|
69
|
-
self.categories =
|
68
|
+
if categories.empty?
|
69
|
+
self.categories = Utils.pluralized_array_from_hash(data, 'category', 'categories').map {|c| c.to_s.downcase}
|
70
70
|
end
|
71
|
-
|
71
|
+
categories.flatten!
|
72
72
|
end
|
73
73
|
|
74
74
|
def populate_tags
|
75
|
-
self.tags =
|
75
|
+
self.tags = Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
|
76
76
|
end
|
77
77
|
|
78
78
|
# Get the full path to the directory containing the post files
|
@@ -88,7 +88,7 @@ module Jekyll
|
|
88
88
|
# Returns nothing.
|
89
89
|
def read_yaml(base, name)
|
90
90
|
super(base, name)
|
91
|
-
self.extracted_excerpt =
|
91
|
+
self.extracted_excerpt = extract_excerpt
|
92
92
|
end
|
93
93
|
|
94
94
|
# The post excerpt. This is either a custom excerpt
|
@@ -96,19 +96,19 @@ module Jekyll
|
|
96
96
|
#
|
97
97
|
# Returns excerpt string.
|
98
98
|
def excerpt
|
99
|
-
|
99
|
+
data.fetch('excerpt', extracted_excerpt.to_s)
|
100
100
|
end
|
101
101
|
|
102
102
|
# Public: the Post title, from the YAML Front-Matter or from the slug
|
103
103
|
#
|
104
104
|
# Returns the post title
|
105
105
|
def title
|
106
|
-
|
106
|
+
data.fetch("title", titleized_slug)
|
107
107
|
end
|
108
108
|
|
109
109
|
# Turns the post slug into a suitable title
|
110
110
|
def titleized_slug
|
111
|
-
|
111
|
+
slug.split('-').select {|w| w.capitalize! || w }.join(' ')
|
112
112
|
end
|
113
113
|
|
114
114
|
# Public: the path to the post relative to the site source,
|
@@ -118,7 +118,7 @@ module Jekyll
|
|
118
118
|
#
|
119
119
|
# Returns the path to the file relative to the site source
|
120
120
|
def path
|
121
|
-
|
121
|
+
data.fetch('path', relative_path.sub(/\A\//, ''))
|
122
122
|
end
|
123
123
|
|
124
124
|
# The path to the post source file, relative to the site source
|
@@ -172,11 +172,11 @@ module Jekyll
|
|
172
172
|
#
|
173
173
|
# Returns the String permalink.
|
174
174
|
def permalink
|
175
|
-
|
175
|
+
data && data['permalink']
|
176
176
|
end
|
177
177
|
|
178
178
|
def template
|
179
|
-
case
|
179
|
+
case site.permalink_style
|
180
180
|
when :pretty
|
181
181
|
"/:categories/:year/:month/:day/:title/"
|
182
182
|
when :none
|
@@ -186,7 +186,7 @@ module Jekyll
|
|
186
186
|
when :ordinal
|
187
187
|
"/:categories/:year/:y_day/:title.html"
|
188
188
|
else
|
189
|
-
|
189
|
+
site.permalink_style.to_s
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
@@ -214,7 +214,7 @@ module Jekyll
|
|
214
214
|
:categories => (categories || []).map { |c| URI.escape(c.to_s) }.join('/'),
|
215
215
|
:short_month => date.strftime("%b"),
|
216
216
|
:y_day => date.strftime("%j"),
|
217
|
-
:output_ext =>
|
217
|
+
:output_ext => output_ext
|
218
218
|
}
|
219
219
|
end
|
220
220
|
|
@@ -223,7 +223,7 @@ module Jekyll
|
|
223
223
|
#
|
224
224
|
# Returns the String UID.
|
225
225
|
def id
|
226
|
-
File.join(
|
226
|
+
File.join(dir, slug)
|
227
227
|
end
|
228
228
|
|
229
229
|
# Calculate related posts.
|
@@ -241,16 +241,16 @@ module Jekyll
|
|
241
241
|
# Returns nothing.
|
242
242
|
def render(layouts, site_payload)
|
243
243
|
# construct payload
|
244
|
-
payload = {
|
244
|
+
payload = Utils.deep_merge_hashes({
|
245
245
|
"site" => { "related_posts" => related_posts(site_payload["site"]["posts"]) },
|
246
|
-
"page" =>
|
247
|
-
}
|
246
|
+
"page" => to_liquid(EXCERPT_ATTRIBUTES_FOR_LIQUID)
|
247
|
+
}, site_payload)
|
248
248
|
|
249
249
|
if generate_excerpt?
|
250
|
-
|
250
|
+
extracted_excerpt.do_layout(payload, {})
|
251
251
|
end
|
252
252
|
|
253
|
-
do_layout(payload.merge({"page" =>
|
253
|
+
do_layout(payload.merge({"page" => to_liquid}), layouts)
|
254
254
|
end
|
255
255
|
|
256
256
|
# Obtain destination path.
|
@@ -260,29 +260,29 @@ module Jekyll
|
|
260
260
|
# Returns destination file path String.
|
261
261
|
def destination(dest)
|
262
262
|
# The url needs to be unescaped in order to preserve the correct filename
|
263
|
-
path =
|
263
|
+
path = Jekyll.sanitized_path(dest, CGI.unescape(url))
|
264
264
|
path = File.join(path, "index.html") if path[/\.html$/].nil?
|
265
265
|
path
|
266
266
|
end
|
267
267
|
|
268
268
|
# Returns the shorthand String identifier of this Post.
|
269
269
|
def inspect
|
270
|
-
"<Post: #{
|
270
|
+
"<Post: #{id}>"
|
271
271
|
end
|
272
272
|
|
273
273
|
def next
|
274
|
-
pos =
|
275
|
-
if pos && pos <
|
276
|
-
|
274
|
+
pos = site.posts.index {|post| post.equal?(self) }
|
275
|
+
if pos && pos < site.posts.length - 1
|
276
|
+
site.posts[pos + 1]
|
277
277
|
else
|
278
278
|
nil
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
282
|
def previous
|
283
|
-
pos =
|
283
|
+
pos = site.posts.index {|post| post.equal?(self) }
|
284
284
|
if pos && pos > 0
|
285
|
-
|
285
|
+
site.posts[pos - 1]
|
286
286
|
else
|
287
287
|
nil
|
288
288
|
end
|