jekyll 1.0.2 → 1.0.3
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 +8 -8
- data/History.markdown +46 -0
- data/Rakefile +35 -1
- data/bin/jekyll +6 -4
- data/features/create_sites.feature +8 -8
- data/features/drafts.feature +3 -3
- data/features/embed_filters.feature +5 -5
- data/features/markdown.feature +2 -2
- data/features/pagination.feature +8 -8
- data/features/permalinks.feature +5 -5
- data/features/post_data.feature +23 -23
- data/features/site_configuration.feature +9 -9
- data/features/site_data.feature +14 -14
- data/features/step_definitions/jekyll_steps.rb +16 -27
- data/features/support/env.rb +11 -6
- data/jekyll.gemspec +7 -4
- data/lib/jekyll.rb +7 -2
- data/lib/jekyll/command.rb +3 -3
- data/lib/jekyll/commands/build.rb +5 -5
- data/lib/jekyll/commands/doctor.rb +2 -2
- data/lib/jekyll/commands/new.rb +8 -3
- data/lib/jekyll/configuration.rb +31 -6
- data/lib/jekyll/converters/markdown/maruku_parser.rb +11 -7
- data/lib/jekyll/convertible.rb +4 -7
- data/lib/jekyll/deprecator.rb +2 -2
- data/lib/jekyll/filters.rb +12 -2
- data/lib/jekyll/generators/pagination.rb +3 -2
- data/lib/jekyll/layout.rb +3 -0
- data/lib/jekyll/post.rb +1 -23
- data/lib/jekyll/related_posts.rb +58 -0
- data/lib/jekyll/site.rb +2 -4
- data/lib/jekyll/{logger.rb → stevenson.rb} +26 -12
- data/lib/jekyll/tags/gist.rb +13 -3
- data/lib/site_template/_layouts/default.html +1 -1
- data/lib/site_template/_layouts/post.html +1 -1
- data/lib/site_template/css/main.css +7 -7
- data/site/_includes/docs_contents.html +3 -0
- data/site/css/pygments.css +1 -1
- data/site/css/style.css +9 -2
- data/site/docs/deployment-methods.md +1 -1
- data/site/docs/frontmatter.md +10 -0
- data/site/docs/history.md +536 -0
- data/site/docs/installation.md +2 -4
- data/site/docs/migrations.md +57 -58
- data/site/docs/plugins.md +3 -0
- data/site/docs/posts.md +24 -2
- data/site/docs/templates.md +50 -3
- data/site/docs/upgrading.md +45 -29
- data/test/source/_layouts/default.html +1 -1
- data/test/test_configuration.rb +15 -3
- data/test/test_page.rb +1 -1
- data/test/test_pager.rb +7 -0
- data/test/test_post.rb +11 -11
- data/test/test_redcloth.rb +3 -3
- data/test/test_related_posts.rb +41 -0
- data/test/test_site.rb +6 -6
- data/test/test_tags.rb +40 -0
- metadata +9 -5
@@ -5,12 +5,9 @@ module Jekyll
|
|
5
5
|
def initialize(config)
|
6
6
|
require 'maruku'
|
7
7
|
@config = config
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
if @config['maruku']['use_tex']
|
12
|
-
load_blahtext_library
|
13
|
-
end
|
8
|
+
@errors = []
|
9
|
+
load_divs_library if @config['maruku']['use_divs']
|
10
|
+
load_blahtext_library if @config['maruku']['use_tex']
|
14
11
|
rescue LoadError
|
15
12
|
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
16
13
|
STDERR.puts ' $ [sudo] gem install maruku'
|
@@ -38,8 +35,15 @@ module Jekyll
|
|
38
35
|
MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
|
39
36
|
end
|
40
37
|
|
38
|
+
def print_errors_and_fail
|
39
|
+
print @errors.join
|
40
|
+
raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
|
41
|
+
end
|
42
|
+
|
41
43
|
def convert(content)
|
42
|
-
Maruku.new(content).to_html
|
44
|
+
converted = Maruku.new(content, :error_stream => @errors).to_html
|
45
|
+
print_errors_and_fail unless @errors.empty?
|
46
|
+
converted
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
data/lib/jekyll/convertible.rb
CHANGED
@@ -35,7 +35,7 @@ module Jekyll
|
|
35
35
|
self.data = YAML.safe_load($1)
|
36
36
|
end
|
37
37
|
rescue SyntaxError => e
|
38
|
-
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
|
38
|
+
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
|
39
39
|
rescue Exception => e
|
40
40
|
puts "Error reading file #{File.join(base, name)}: #{e.message}"
|
41
41
|
end
|
@@ -76,11 +76,8 @@ module Jekyll
|
|
76
76
|
def render_liquid(content, payload, info)
|
77
77
|
Liquid::Template.parse(content).render!(payload, info)
|
78
78
|
rescue Exception => e
|
79
|
-
Jekyll
|
80
|
-
e
|
81
|
-
puts backtrace
|
82
|
-
end
|
83
|
-
abort("Build Failed")
|
79
|
+
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{payload[:file]}"
|
80
|
+
raise e
|
84
81
|
end
|
85
82
|
|
86
83
|
# Recursively render layouts
|
@@ -99,7 +96,7 @@ module Jekyll
|
|
99
96
|
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
|
100
97
|
|
101
98
|
self.output = self.render_liquid(layout.content,
|
102
|
-
payload.merge({:file =>
|
99
|
+
payload.merge({:file => layout.name}),
|
103
100
|
info)
|
104
101
|
|
105
102
|
if layout = layouts[layout.data["layout"]]
|
data/lib/jekyll/deprecator.rb
CHANGED
@@ -18,14 +18,14 @@ module Jekyll
|
|
18
18
|
|
19
19
|
def self.no_subcommand(args)
|
20
20
|
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
|
21
|
-
Jekyll
|
21
|
+
Jekyll.logger.error "Deprecation:", "Jekyll now uses subcommands instead of just \
|
22
22
|
switches. Run `jekyll help' to find out more."
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.deprecation_message(args, deprecated_argument, message)
|
27
27
|
if args.include?(deprecated_argument)
|
28
|
-
Jekyll
|
28
|
+
Jekyll.logger.error "Deprecation:", message
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/jekyll/filters.rb
CHANGED
@@ -99,7 +99,17 @@ module Jekyll
|
|
99
99
|
def cgi_escape(input)
|
100
100
|
CGI::escape(input)
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
|
+
# URI escape a string.
|
104
|
+
#
|
105
|
+
# input - The String to escape.
|
106
|
+
#
|
107
|
+
# Examples
|
108
|
+
#
|
109
|
+
# uri_escape('foo, bar \\baz?')
|
110
|
+
# # => "foo,%20bar%20%5Cbaz?"
|
111
|
+
#
|
112
|
+
# Returns the escaped String.
|
103
113
|
def uri_escape(input)
|
104
114
|
URI.escape(input)
|
105
115
|
end
|
@@ -146,7 +156,7 @@ module Jekyll
|
|
146
156
|
when String
|
147
157
|
Time.parse(input)
|
148
158
|
else
|
149
|
-
Jekyll
|
159
|
+
Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime."
|
150
160
|
exit(1)
|
151
161
|
end
|
152
162
|
end
|
@@ -92,8 +92,9 @@ module Jekyll
|
|
92
92
|
# Returns the pagination path as a string
|
93
93
|
def self.paginate_path(site_config, num_page)
|
94
94
|
return nil if num_page.nil? || num_page <= 1
|
95
|
-
format =
|
96
|
-
format.sub(':num', num_page.to_s)
|
95
|
+
format = site_config['paginate_path']
|
96
|
+
format = format.sub(':num', num_page.to_s)
|
97
|
+
File.basename(format)
|
97
98
|
end
|
98
99
|
|
99
100
|
# Initialize a new Pager.
|
data/lib/jekyll/layout.rb
CHANGED
data/lib/jekyll/post.rb
CHANGED
@@ -244,29 +244,7 @@ module Jekyll
|
|
244
244
|
#
|
245
245
|
# Returns an Array of related Posts.
|
246
246
|
def related_posts(posts)
|
247
|
-
|
248
|
-
|
249
|
-
if self.site.lsi
|
250
|
-
build_index
|
251
|
-
|
252
|
-
related = self.class.lsi.find_related(self.content, 11)
|
253
|
-
related - [self]
|
254
|
-
else
|
255
|
-
(posts - [self])[0..9]
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
def build_index
|
260
|
-
self.class.lsi ||= begin
|
261
|
-
puts "Starting the classifier..."
|
262
|
-
lsi = Classifier::LSI.new(:auto_rebuild => false)
|
263
|
-
$stdout.print(" Populating LSI... "); $stdout.flush
|
264
|
-
self.site.posts.each { |x| $stdout.print("."); $stdout.flush; lsi.add_item(x) }
|
265
|
-
$stdout.print("\n Rebuilding LSI index... ")
|
266
|
-
lsi.build_index
|
267
|
-
puts ""
|
268
|
-
lsi
|
269
|
-
end
|
247
|
+
Jekyll::RelatedPosts.new(self).build
|
270
248
|
end
|
271
249
|
|
272
250
|
# Add any necessary layouts to this post.
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class RelatedPosts
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_accessor :lsi
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader :post, :site
|
9
|
+
|
10
|
+
def initialize(post)
|
11
|
+
@post = post
|
12
|
+
@site = post.site
|
13
|
+
require 'classifier' if site.lsi
|
14
|
+
end
|
15
|
+
|
16
|
+
def build
|
17
|
+
return [] unless self.site.posts.size > 1
|
18
|
+
|
19
|
+
if self.site.lsi
|
20
|
+
build_index
|
21
|
+
lsi_related_posts
|
22
|
+
else
|
23
|
+
most_recent_posts
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def build_index
|
29
|
+
self.class.lsi ||= begin
|
30
|
+
lsi = Classifier::LSI.new(:auto_rebuild => false)
|
31
|
+
display("Populating LSI...")
|
32
|
+
|
33
|
+
self.site.posts.each do |x|
|
34
|
+
lsi.add_item(x)
|
35
|
+
end
|
36
|
+
|
37
|
+
display("Rebuilding index...")
|
38
|
+
lsi.build_index
|
39
|
+
display("")
|
40
|
+
lsi
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def lsi_related_posts
|
45
|
+
self.class.lsi.find_related(post.content, 11) - [self.post]
|
46
|
+
end
|
47
|
+
|
48
|
+
def most_recent_posts
|
49
|
+
(self.site.posts - [self.post])[0..9]
|
50
|
+
end
|
51
|
+
|
52
|
+
def display(output)
|
53
|
+
$stdout.print("\n")
|
54
|
+
$stdout.print(Jekyll.logger.formatted_topic(output))
|
55
|
+
$stdout.flush
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/jekyll/site.rb
CHANGED
@@ -71,8 +71,6 @@ module Jekyll
|
|
71
71
|
#
|
72
72
|
# Returns nothing.
|
73
73
|
def setup
|
74
|
-
require 'classifier' if self.lsi
|
75
|
-
|
76
74
|
# Check that the destination dir isn't the source dir or a directory
|
77
75
|
# parent to the source dir.
|
78
76
|
if self.source =~ /^#{self.dest}/
|
@@ -423,12 +421,12 @@ module Jekyll
|
|
423
421
|
def relative_permalinks_deprecation_method
|
424
422
|
if config['relative_permalinks'] && !@deprecated_relative_permalinks
|
425
423
|
$stderr.puts # Places newline after "Generating..."
|
426
|
-
Jekyll
|
424
|
+
Jekyll.logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
|
427
425
|
" in subfolders must be relative to the" +
|
428
426
|
" site source directory, not the parent" +
|
429
427
|
" directory. Check http://jekyllrb.com/docs/upgrading/"+
|
430
428
|
" for more info."
|
431
|
-
$stderr.print Jekyll
|
429
|
+
$stderr.print Jekyll.logger.formatted_topic("") + "..." # for "done."
|
432
430
|
@deprecated_relative_permalinks = true
|
433
431
|
end
|
434
432
|
end
|
@@ -1,15 +1,29 @@
|
|
1
|
-
require 'logger'
|
2
|
-
|
3
1
|
module Jekyll
|
4
|
-
class
|
2
|
+
class Stevenson
|
3
|
+
attr_accessor :log_level
|
4
|
+
|
5
|
+
DEBUG = 0
|
6
|
+
INFO = 1
|
7
|
+
WARN = 2
|
8
|
+
ERROR = 3
|
9
|
+
|
10
|
+
# Public: Create a new instance of Stevenson, Jekyll's logger
|
11
|
+
#
|
12
|
+
# level - (optional, integer) the log level
|
13
|
+
#
|
14
|
+
# Returns nothing
|
15
|
+
def initialize(level = INFO)
|
16
|
+
@log_level = level
|
17
|
+
end
|
18
|
+
|
5
19
|
# Public: Print a jekyll message to stdout
|
6
20
|
#
|
7
21
|
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
|
8
22
|
# message - the message detail
|
9
23
|
#
|
10
24
|
# Returns nothing
|
11
|
-
def
|
12
|
-
$stdout.puts
|
25
|
+
def info(topic, message)
|
26
|
+
$stdout.puts(message(topic, message)) if log_level <= INFO
|
13
27
|
end
|
14
28
|
|
15
29
|
# Public: Print a jekyll message to stderr
|
@@ -18,8 +32,8 @@ module Jekyll
|
|
18
32
|
# message - the message detail
|
19
33
|
#
|
20
34
|
# Returns nothing
|
21
|
-
def
|
22
|
-
$stderr.puts
|
35
|
+
def warn(topic, message)
|
36
|
+
$stderr.puts(message(topic, message).yellow) if log_level <= WARN
|
23
37
|
end
|
24
38
|
|
25
39
|
# Public: Print a jekyll error message to stderr
|
@@ -28,8 +42,8 @@ module Jekyll
|
|
28
42
|
# message - the message detail
|
29
43
|
#
|
30
44
|
# Returns nothing
|
31
|
-
def
|
32
|
-
$stderr.puts
|
45
|
+
def error(topic, message)
|
46
|
+
$stderr.puts(message(topic, message).red) if log_level <= ERROR
|
33
47
|
end
|
34
48
|
|
35
49
|
# Public: Build a Jekyll topic method
|
@@ -38,8 +52,8 @@ module Jekyll
|
|
38
52
|
# message - the message detail
|
39
53
|
#
|
40
54
|
# Returns the formatted message
|
41
|
-
def
|
42
|
-
|
55
|
+
def message(topic, message)
|
56
|
+
formatted_topic(topic) + message.gsub(/\s+/, ' ')
|
43
57
|
end
|
44
58
|
|
45
59
|
# Public: Format the topic
|
@@ -47,7 +61,7 @@ module Jekyll
|
|
47
61
|
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
|
48
62
|
#
|
49
63
|
# Returns the formatted topic statement
|
50
|
-
def
|
64
|
+
def formatted_topic(topic)
|
51
65
|
"#{topic} ".rjust(20)
|
52
66
|
end
|
53
67
|
end
|
data/lib/jekyll/tags/gist.rb
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
|
7
7
|
module Jekyll
|
8
8
|
class GistTag < Liquid::Tag
|
9
|
+
|
9
10
|
def render(context)
|
10
|
-
if tag_contents = @markup.strip
|
11
|
-
gist_id, filename = tag_contents[
|
11
|
+
if tag_contents = determine_arguments(@markup.strip)
|
12
|
+
gist_id, filename = tag_contents[0], tag_contents[1]
|
12
13
|
gist_script_tag(gist_id, filename)
|
13
14
|
else
|
14
15
|
"Error parsing gist id"
|
@@ -17,7 +18,16 @@ module Jekyll
|
|
17
18
|
|
18
19
|
private
|
19
20
|
|
20
|
-
def
|
21
|
+
def determine_arguments(input)
|
22
|
+
matched = if input.include?("/")
|
23
|
+
input.match(/\A([a-zA-Z0-9\/\-_]+) ?(\S*)\Z/)
|
24
|
+
else
|
25
|
+
input.match(/\A(\d+) ?(\S*)\Z/)
|
26
|
+
end
|
27
|
+
[matched[1].strip, matched[2].strip] if matched && matched.length >= 3
|
28
|
+
end
|
29
|
+
|
30
|
+
def gist_script_tag(gist_id, filename = nil)
|
21
31
|
if filename.empty?
|
22
32
|
"<script src=\"https://gist.github.com/#{gist_id}.js\"> </script>"
|
23
33
|
else
|
@@ -133,33 +133,33 @@ ul.posts span {
|
|
133
133
|
/*****************************************************************************/
|
134
134
|
|
135
135
|
/* standard */
|
136
|
-
|
136
|
+
.post pre {
|
137
137
|
border: 1px solid #ddd;
|
138
138
|
background-color: #eef;
|
139
139
|
padding: 0 .4em;
|
140
140
|
}
|
141
141
|
|
142
|
-
|
142
|
+
.post ul, .post ol {
|
143
143
|
margin-left: 1.35em;
|
144
144
|
}
|
145
145
|
|
146
|
-
|
146
|
+
.post code {
|
147
147
|
border: 1px solid #ddd;
|
148
148
|
background-color: #eef;
|
149
149
|
padding: 0 .2em;
|
150
150
|
}
|
151
151
|
|
152
|
-
|
152
|
+
.post pre code {
|
153
153
|
border: none;
|
154
154
|
}
|
155
155
|
|
156
156
|
/* terminal */
|
157
|
-
|
157
|
+
.post pre.terminal {
|
158
158
|
border: 1px solid #000;
|
159
159
|
background-color: #333;
|
160
160
|
color: #FFF;
|
161
161
|
}
|
162
162
|
|
163
|
-
|
163
|
+
.post pre.terminal code {
|
164
164
|
background-color: #333;
|
165
|
-
}
|
165
|
+
}
|
@@ -80,6 +80,9 @@
|
|
80
80
|
<li class="{% if page.title == "Upgrading" %}current{% endif %}">
|
81
81
|
<a href="{{ site.url }}/docs/upgrading">Upgrading</a>
|
82
82
|
</li>
|
83
|
+
<li class="{% if page.title == "History" %}current{% endif %}">
|
84
|
+
<a href="{{ site.url }}/docs/history">History</a>
|
85
|
+
</li>
|
83
86
|
</ul>
|
84
87
|
</aside>
|
85
88
|
</div>
|
data/site/css/pygments.css
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
.highlight .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */
|
19
19
|
.highlight .gh { color: #cd5c5c} /* Generic.Heading */
|
20
20
|
.highlight .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */
|
21
|
-
.highlight .go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output */
|
21
|
+
.highlight span.go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output, qualified with span to prevent applying this style to the Go language, see #1153. */
|
22
22
|
.highlight .gp { color: #ffffff} /* Generic.Prompt */
|
23
23
|
.highlight .gs { color: #ffffff} /* Generic.Strong */
|
24
24
|
.highlight .gu { color: #cd5c5c} /* Generic.Subheading */
|
data/site/css/style.css
CHANGED
@@ -519,7 +519,7 @@ pre, code {
|
|
519
519
|
}
|
520
520
|
}
|
521
521
|
|
522
|
-
.highlight, p > pre, p > code, p > nobr > code, li > code {
|
522
|
+
.highlight, p > pre, p > code, p > nobr > code, li > code, h5 > code, .note > code {
|
523
523
|
background: #333;
|
524
524
|
color: #fff;
|
525
525
|
border-radius: 5px;
|
@@ -528,10 +528,17 @@ pre, code {
|
|
528
528
|
0 -1px 0 rgba(0,0,0,.5);
|
529
529
|
}
|
530
530
|
|
531
|
+
.note code {
|
532
|
+
background-color: rgba(0,0,0,0.2);
|
533
|
+
margin-left: 2.5px;
|
534
|
+
margin-right: 2.5px;
|
535
|
+
font-size: 0.8em;
|
536
|
+
}
|
537
|
+
|
531
538
|
.highlight {
|
532
539
|
padding: 10px 0;
|
533
540
|
width: 100%;
|
534
|
-
overflow:
|
541
|
+
overflow: auto;
|
535
542
|
}
|
536
543
|
|
537
544
|
/* HTML Elements */
|