jekyll 3.1.0.pre.beta1 → 3.1.0.pre.rc1
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/LICENSE +1 -1
- data/README.markdown +1 -0
- data/bin/jekyll +17 -8
- data/lib/jekyll.rb +6 -6
- data/lib/jekyll/cleaner.rb +1 -1
- data/lib/jekyll/collection.rb +8 -7
- data/lib/jekyll/command.rb +0 -4
- data/lib/jekyll/commands/build.rb +2 -6
- data/lib/jekyll/commands/clean.rb +1 -3
- data/lib/jekyll/commands/doctor.rb +15 -19
- data/lib/jekyll/commands/help.rb +0 -2
- data/lib/jekyll/commands/serve.rb +11 -3
- data/lib/jekyll/commands/serve/servlet.rb +3 -3
- data/lib/jekyll/configuration.rb +28 -29
- data/lib/jekyll/converters/identity.rb +1 -1
- data/lib/jekyll/converters/markdown.rb +7 -7
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +1 -1
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +5 -6
- data/lib/jekyll/converters/smartypants.rb +34 -0
- data/lib/jekyll/convertible.rb +29 -16
- data/lib/jekyll/deprecator.rb +1 -1
- data/lib/jekyll/document.rb +26 -27
- data/lib/jekyll/drops/collection_drop.rb +0 -2
- data/lib/jekyll/drops/document_drop.rb +0 -1
- data/lib/jekyll/drops/drop.rb +54 -6
- data/lib/jekyll/drops/site_drop.rb +0 -1
- data/lib/jekyll/drops/unified_payload_drop.rb +0 -1
- data/lib/jekyll/drops/url_drop.rb +45 -13
- data/lib/jekyll/entry_filter.rb +1 -1
- data/lib/jekyll/errors.rb +4 -2
- data/lib/jekyll/external.rb +5 -6
- data/lib/jekyll/filters.rb +18 -7
- data/lib/jekyll/frontmatter_defaults.rb +16 -15
- data/lib/jekyll/generator.rb +1 -2
- data/lib/jekyll/hooks.rb +26 -26
- data/lib/jekyll/liquid_renderer.rb +1 -1
- data/lib/jekyll/liquid_renderer/table.rb +2 -2
- data/lib/jekyll/page.rb +7 -8
- data/lib/jekyll/plugin.rb +31 -12
- data/lib/jekyll/plugin_manager.rb +3 -4
- data/lib/jekyll/reader.rb +7 -7
- data/lib/jekyll/readers/collection_reader.rb +1 -2
- data/lib/jekyll/readers/data_reader.rb +7 -7
- data/lib/jekyll/readers/page_reader.rb +3 -3
- data/lib/jekyll/readers/post_reader.rb +2 -2
- data/lib/jekyll/readers/static_file_reader.rb +2 -2
- data/lib/jekyll/regenerator.rb +17 -18
- data/lib/jekyll/related_posts.rb +0 -2
- data/lib/jekyll/renderer.rb +14 -12
- data/lib/jekyll/site.rb +18 -22
- data/lib/jekyll/static_file.rb +15 -15
- data/lib/jekyll/stevenson.rb +2 -2
- data/lib/jekyll/tags/highlight.rb +10 -11
- data/lib/jekyll/tags/include.rb +10 -11
- data/lib/jekyll/tags/post_url.rb +7 -10
- data/lib/jekyll/url.rb +4 -5
- data/lib/jekyll/utils.rb +27 -22
- data/lib/jekyll/utils/ansi.rb +1 -1
- data/lib/jekyll/utils/platforms.rb +0 -1
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/_includes/head.html +1 -1
- metadata +4 -3
data/lib/jekyll/drops/drop.rb
CHANGED
@@ -15,8 +15,13 @@ module Jekyll
|
|
15
15
|
def self.mutable(is_mutable = nil)
|
16
16
|
if is_mutable
|
17
17
|
@is_mutable = is_mutable
|
18
|
+
else
|
19
|
+
@is_mutable = false
|
18
20
|
end
|
19
|
-
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.mutable?
|
24
|
+
@is_mutable
|
20
25
|
end
|
21
26
|
|
22
27
|
# Create a new Drop
|
@@ -39,7 +44,7 @@ module Jekyll
|
|
39
44
|
#
|
40
45
|
# Returns the value for the given key, or nil if none exists
|
41
46
|
def [](key)
|
42
|
-
if self.class.mutable && @mutations.key?(key)
|
47
|
+
if self.class.mutable? && @mutations.key?(key)
|
43
48
|
@mutations[key]
|
44
49
|
elsif respond_to? key
|
45
50
|
public_send key
|
@@ -62,10 +67,14 @@ module Jekyll
|
|
62
67
|
# and the key matches a method in which case it raises a
|
63
68
|
# DropMutationException.
|
64
69
|
def []=(key, val)
|
65
|
-
if
|
66
|
-
|
70
|
+
if respond_to?("#{key}=")
|
71
|
+
public_send("#{key}=", val)
|
67
72
|
elsif respond_to? key
|
68
|
-
|
73
|
+
if self.class.mutable?
|
74
|
+
@mutations[key] = val
|
75
|
+
else
|
76
|
+
raise Errors::DropMutationException, "Key #{key} cannot be set in the drop."
|
77
|
+
end
|
69
78
|
else
|
70
79
|
fallback_data[key] = val
|
71
80
|
end
|
@@ -83,6 +92,19 @@ module Jekyll
|
|
83
92
|
end
|
84
93
|
end
|
85
94
|
|
95
|
+
# Check if key exists in Drop
|
96
|
+
#
|
97
|
+
# key - the string key whose value to fetch
|
98
|
+
#
|
99
|
+
# Returns true if the given key is present
|
100
|
+
def key?(key)
|
101
|
+
if self.class.mutable && @mutations.key?(key)
|
102
|
+
true
|
103
|
+
else
|
104
|
+
respond_to?(key) || fallback_data.key?(key)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
86
108
|
# Generates a list of keys with user content as their values.
|
87
109
|
# This gathers up the Drop methods and keys of the mutations and
|
88
110
|
# underlying data hashes and performs a set union to ensure a list
|
@@ -101,16 +123,18 @@ module Jekyll
|
|
101
123
|
#
|
102
124
|
# Returns a Hash with all the keys and values resolved.
|
103
125
|
def to_h
|
104
|
-
keys.each_with_object({}) do |(key,
|
126
|
+
keys.each_with_object({}) do |(key, _), result|
|
105
127
|
result[key] = self[key]
|
106
128
|
end
|
107
129
|
end
|
130
|
+
alias_method :to_hash, :to_h
|
108
131
|
|
109
132
|
# Inspect the drop's keys and values through a JSON representation
|
110
133
|
# of its keys and values.
|
111
134
|
#
|
112
135
|
# Returns a pretty generation of the hash representation of the Drop.
|
113
136
|
def inspect
|
137
|
+
require 'json'
|
114
138
|
JSON.pretty_generate to_h
|
115
139
|
end
|
116
140
|
|
@@ -123,6 +147,30 @@ module Jekyll
|
|
123
147
|
keys.each(&block)
|
124
148
|
end
|
125
149
|
|
150
|
+
def merge(other, &block)
|
151
|
+
self.dup.tap do |me|
|
152
|
+
if block.nil?
|
153
|
+
me.merge!(other)
|
154
|
+
else
|
155
|
+
me.merge!(other, block)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def merge!(other)
|
161
|
+
other.each_key do |key|
|
162
|
+
if block_given?
|
163
|
+
self[key] = yield key, self[key], other[key]
|
164
|
+
else
|
165
|
+
if Utils.mergable?(self[key]) && Utils.mergable?(other[key])
|
166
|
+
self[key] = Utils.deep_merge_hashes(self[key], other[key])
|
167
|
+
next
|
168
|
+
end
|
169
|
+
|
170
|
+
self[key] = other[key] unless other[key].nil?
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
126
174
|
end
|
127
175
|
end
|
128
176
|
end
|
@@ -19,8 +19,8 @@ module Jekyll
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def title
|
22
|
-
Utils.slugify(@obj.data['slug'], mode
|
23
|
-
Utils.slugify(@obj.basename_without_ext, mode
|
22
|
+
Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
|
23
|
+
Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
|
24
24
|
end
|
25
25
|
|
26
26
|
def slug
|
@@ -35,17 +35,49 @@ module Jekyll
|
|
35
35
|
category_set.to_a.join('/')
|
36
36
|
end
|
37
37
|
|
38
|
-
def year
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
def
|
47
|
-
|
48
|
-
|
38
|
+
def year
|
39
|
+
@obj.date.strftime("%Y")
|
40
|
+
end
|
41
|
+
|
42
|
+
def month
|
43
|
+
@obj.date.strftime("%m")
|
44
|
+
end
|
45
|
+
|
46
|
+
def day
|
47
|
+
@obj.date.strftime("%d")
|
48
|
+
end
|
49
|
+
|
50
|
+
def hour
|
51
|
+
@obj.date.strftime("%H")
|
52
|
+
end
|
53
|
+
|
54
|
+
def minute
|
55
|
+
@obj.date.strftime("%M")
|
56
|
+
end
|
57
|
+
|
58
|
+
def second
|
59
|
+
@obj.date.strftime("%S")
|
60
|
+
end
|
61
|
+
|
62
|
+
def i_day
|
63
|
+
@obj.date.strftime("%-d")
|
64
|
+
end
|
65
|
+
|
66
|
+
def i_month
|
67
|
+
@obj.date.strftime("%-m")
|
68
|
+
end
|
69
|
+
|
70
|
+
def short_month
|
71
|
+
@obj.date.strftime("%b")
|
72
|
+
end
|
73
|
+
|
74
|
+
def short_year
|
75
|
+
@obj.date.strftime("%y")
|
76
|
+
end
|
77
|
+
|
78
|
+
def y_day
|
79
|
+
@obj.date.strftime("%j")
|
80
|
+
end
|
49
81
|
end
|
50
82
|
end
|
51
83
|
end
|
data/lib/jekyll/entry_filter.rb
CHANGED
@@ -47,7 +47,7 @@ module Jekyll
|
|
47
47
|
|
48
48
|
def excluded?(entry)
|
49
49
|
excluded = glob_include?(site.exclude, relative_to_source(entry))
|
50
|
-
Jekyll.logger.debug "EntryFilter:", "excluded
|
50
|
+
Jekyll.logger.debug "EntryFilter:", "excluded #{relative_to_source(entry)}" if excluded
|
51
51
|
excluded
|
52
52
|
end
|
53
53
|
|
data/lib/jekyll/errors.rb
CHANGED
@@ -2,7 +2,9 @@ module Jekyll
|
|
2
2
|
module Errors
|
3
3
|
FatalException = Class.new(::RuntimeError)
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
DropMutationException = Class.new(FatalException)
|
6
|
+
InvalidPermalinkError = Class.new(FatalException)
|
7
|
+
InvalidYAMLFrontMatterError = Class.new(FatalException)
|
8
|
+
MissingDependencyException = Class.new(FatalException)
|
7
9
|
end
|
8
10
|
end
|
data/lib/jekyll/external.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
module Jekyll
|
2
2
|
module External
|
3
3
|
class << self
|
4
|
-
|
5
4
|
#
|
6
5
|
# Gems that, if installed, should be loaded.
|
7
6
|
# Usually contain subcommands.
|
8
7
|
#
|
9
8
|
def blessed_gems
|
10
|
-
%w
|
9
|
+
%w(
|
11
10
|
jekyll-docs
|
12
11
|
jekyll-import
|
13
|
-
|
12
|
+
)
|
14
13
|
end
|
15
14
|
|
16
15
|
#
|
@@ -18,12 +17,13 @@ module Jekyll
|
|
18
17
|
#
|
19
18
|
# names - a string gem name or array of gem names
|
20
19
|
#
|
21
|
-
def require_if_present(names)
|
20
|
+
def require_if_present(names, &block)
|
22
21
|
Array(names).each do |name|
|
23
22
|
begin
|
24
23
|
require name
|
25
24
|
rescue LoadError
|
26
25
|
Jekyll.logger.debug "Couldn't load #{name}. Skipping."
|
26
|
+
block.call(name) if block
|
27
27
|
false
|
28
28
|
end
|
29
29
|
end
|
@@ -39,7 +39,7 @@ module Jekyll
|
|
39
39
|
def require_with_graceful_fail(names)
|
40
40
|
Array(names).each do |name|
|
41
41
|
begin
|
42
|
-
Jekyll.logger.debug
|
42
|
+
Jekyll.logger.debug "Requiring:", "#{name}"
|
43
43
|
require name
|
44
44
|
rescue LoadError => e
|
45
45
|
Jekyll.logger.error "Dependency Error:", <<-MSG
|
@@ -54,7 +54,6 @@ If you run into trouble, you can find helpful resources at http://jekyllrb.com/h
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
data/lib/jekyll/filters.rb
CHANGED
@@ -15,6 +15,17 @@ module Jekyll
|
|
15
15
|
converter.convert(input)
|
16
16
|
end
|
17
17
|
|
18
|
+
# Convert a Markdown string into HTML output.
|
19
|
+
#
|
20
|
+
# input - The Markdown String to convert.
|
21
|
+
#
|
22
|
+
# Returns the HTML formatted String.
|
23
|
+
def smartify(input)
|
24
|
+
site = @context.registers[:site]
|
25
|
+
converter = site.find_converter_instance(Jekyll::Converters::SmartyPants)
|
26
|
+
converter.convert(input)
|
27
|
+
end
|
28
|
+
|
18
29
|
# Convert a Sass string into CSS output.
|
19
30
|
#
|
20
31
|
# input - The Sass String to convert.
|
@@ -45,7 +56,7 @@ module Jekyll
|
|
45
56
|
# Returns the given filename or title as a lowercase URL String.
|
46
57
|
# See Utils.slugify for more detail.
|
47
58
|
def slugify(input, mode=nil)
|
48
|
-
Utils.slugify(input, mode
|
59
|
+
Utils.slugify(input, :mode => mode)
|
49
60
|
end
|
50
61
|
|
51
62
|
# Format a date in short format e.g. "27 Jan 2011".
|
@@ -194,7 +205,7 @@ module Jekyll
|
|
194
205
|
input.group_by do |item|
|
195
206
|
item_property(item, property).to_s
|
196
207
|
end.inject([]) do |memo, i|
|
197
|
-
memo << {"name" => i.first, "items" => i.last}
|
208
|
+
memo << { "name" => i.first, "items" => i.last }
|
198
209
|
end
|
199
210
|
else
|
200
211
|
input
|
@@ -223,7 +234,7 @@ module Jekyll
|
|
223
234
|
# Returns the filtered array of objects
|
224
235
|
def sort(input, property = nil, nils = "first")
|
225
236
|
if input.nil?
|
226
|
-
|
237
|
+
raise ArgumentError.new("Cannot sort a null object.")
|
227
238
|
end
|
228
239
|
if property.nil?
|
229
240
|
input.sort
|
@@ -234,11 +245,11 @@ module Jekyll
|
|
234
245
|
when nils == "last"
|
235
246
|
order = + 1
|
236
247
|
else
|
237
|
-
raise ArgumentError.new("Invalid nils order: "
|
248
|
+
raise ArgumentError.new("Invalid nils order: " \
|
238
249
|
"'#{nils}' is not a valid nils order. It must be 'first' or 'last'.")
|
239
250
|
end
|
240
251
|
|
241
|
-
input.sort
|
252
|
+
input.sort do |apple, orange|
|
242
253
|
apple_property = item_property(apple, property)
|
243
254
|
orange_property = item_property(orange, property)
|
244
255
|
|
@@ -249,7 +260,7 @@ module Jekyll
|
|
249
260
|
else
|
250
261
|
apple_property <=> orange_property
|
251
262
|
end
|
252
|
-
|
263
|
+
end
|
253
264
|
end
|
254
265
|
end
|
255
266
|
|
@@ -337,7 +348,7 @@ module Jekyll
|
|
337
348
|
pairs = item.map { |k, v| as_liquid([k, v]) }
|
338
349
|
Hash[pairs]
|
339
350
|
when Array
|
340
|
-
item.map{ |i| as_liquid(i) }
|
351
|
+
item.map { |i| as_liquid(i) }
|
341
352
|
else
|
342
353
|
if item.respond_to?(:to_liquid)
|
343
354
|
liquidated = item.to_liquid
|
@@ -13,19 +13,20 @@ module Jekyll
|
|
13
13
|
def update_deprecated_types(set)
|
14
14
|
return set unless set.key?('scope') && set['scope'].key?('type')
|
15
15
|
|
16
|
-
set['scope']['type'] =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
16
|
+
set['scope']['type'] =
|
17
|
+
case set['scope']['type']
|
18
|
+
when 'page'
|
19
|
+
Deprecator.defaults_deprecate_type('page', 'pages')
|
20
|
+
'pages'
|
21
|
+
when 'post'
|
22
|
+
Deprecator.defaults_deprecate_type('post', 'posts')
|
23
|
+
'posts'
|
24
|
+
when 'draft'
|
25
|
+
Deprecator.defaults_deprecate_type('draft', 'drafts')
|
26
|
+
'drafts'
|
27
|
+
else
|
28
|
+
set['scope']['type']
|
29
|
+
end
|
29
30
|
|
30
31
|
set
|
31
32
|
end
|
@@ -90,7 +91,7 @@ module Jekyll
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def applies_path?(scope, path)
|
93
|
-
return true if !scope.
|
94
|
+
return true if !scope.key?('path') || scope['path'].empty?
|
94
95
|
|
95
96
|
scope_path = Pathname.new(scope['path'])
|
96
97
|
Pathname.new(sanitize_path(path)).ascend do |path|
|
@@ -150,7 +151,7 @@ module Jekyll
|
|
150
151
|
# Returns an array of hashes
|
151
152
|
def matching_sets(path, type)
|
152
153
|
valid_sets.select do |set|
|
153
|
-
!set.
|
154
|
+
!set.key?('scope') || applies?(set['scope'], path, type)
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
data/lib/jekyll/generator.rb
CHANGED
data/lib/jekyll/hooks.rb
CHANGED
@@ -4,38 +4,38 @@ module Jekyll
|
|
4
4
|
|
5
5
|
# compatibility layer for octopress-hooks users
|
6
6
|
PRIORITY_MAP = {
|
7
|
-
low
|
8
|
-
normal
|
9
|
-
high
|
7
|
+
:low => 10,
|
8
|
+
:normal => 20,
|
9
|
+
:high => 30
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
# initial empty hooks
|
13
13
|
@registry = {
|
14
14
|
:site => {
|
15
|
-
after_reset
|
16
|
-
post_read
|
17
|
-
pre_render
|
18
|
-
post_render
|
19
|
-
post_write
|
15
|
+
:after_reset => [],
|
16
|
+
:post_read => [],
|
17
|
+
:pre_render => [],
|
18
|
+
:post_render => [],
|
19
|
+
:post_write => []
|
20
20
|
},
|
21
21
|
:pages => {
|
22
|
-
post_init
|
23
|
-
pre_render
|
24
|
-
post_render
|
25
|
-
post_write
|
22
|
+
:post_init => [],
|
23
|
+
:pre_render => [],
|
24
|
+
:post_render => [],
|
25
|
+
:post_write => []
|
26
26
|
},
|
27
27
|
:posts => {
|
28
|
-
post_init
|
29
|
-
pre_render
|
30
|
-
post_render
|
31
|
-
post_write
|
28
|
+
:post_init => [],
|
29
|
+
:pre_render => [],
|
30
|
+
:post_render => [],
|
31
|
+
:post_write => []
|
32
32
|
},
|
33
33
|
:documents => {
|
34
|
-
post_init
|
35
|
-
pre_render
|
36
|
-
post_render
|
37
|
-
post_write
|
38
|
-
}
|
34
|
+
:post_init => [],
|
35
|
+
:pre_render => [],
|
36
|
+
:post_render => [],
|
37
|
+
:post_write => []
|
38
|
+
}
|
39
39
|
}
|
40
40
|
|
41
41
|
# map of all hooks and their priorities
|
@@ -60,14 +60,14 @@ module Jekyll
|
|
60
60
|
# register a single hook to be called later, internal API
|
61
61
|
def self.register_one(owner, event, priority, &block)
|
62
62
|
@registry[owner] ||={
|
63
|
-
post_init
|
64
|
-
pre_render
|
65
|
-
post_render
|
66
|
-
post_write
|
63
|
+
:post_init => [],
|
64
|
+
:pre_render => [],
|
65
|
+
:post_render => [],
|
66
|
+
:post_write => []
|
67
67
|
}
|
68
68
|
|
69
69
|
unless @registry[owner][event]
|
70
|
-
raise NotAvailable, "Invalid hook. #{owner} supports only the "
|
70
|
+
raise NotAvailable, "Invalid hook. #{owner} supports only the " \
|
71
71
|
"following hooks #{@registry[owner].keys.inspect}"
|
72
72
|
end
|
73
73
|
|