jekyll 3.0.5 → 3.1.0.pre.beta1

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.

Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +1 -1
  3. data/lib/jekyll.rb +6 -5
  4. data/lib/jekyll/cleaner.rb +1 -1
  5. data/lib/jekyll/collection.rb +8 -11
  6. data/lib/jekyll/commands/clean.rb +2 -2
  7. data/lib/jekyll/commands/doctor.rb +23 -1
  8. data/lib/jekyll/commands/serve.rb +148 -103
  9. data/lib/jekyll/commands/serve/servlet.rb +61 -0
  10. data/lib/jekyll/configuration.rb +26 -46
  11. data/lib/jekyll/converters/markdown.rb +51 -36
  12. data/lib/jekyll/converters/markdown/kramdown_parser.rb +70 -17
  13. data/lib/jekyll/convertible.rb +5 -4
  14. data/lib/jekyll/document.rb +19 -63
  15. data/lib/jekyll/drops/collection_drop.rb +24 -0
  16. data/lib/jekyll/drops/document_drop.rb +28 -0
  17. data/lib/jekyll/drops/drop.rb +128 -0
  18. data/lib/jekyll/drops/jekyll_drop.rb +21 -0
  19. data/lib/jekyll/drops/site_drop.rb +39 -0
  20. data/lib/jekyll/drops/unified_payload_drop.rb +26 -0
  21. data/lib/jekyll/drops/url_drop.rb +51 -0
  22. data/lib/jekyll/entry_filter.rb +1 -1
  23. data/lib/jekyll/errors.rb +3 -4
  24. data/lib/jekyll/excerpt.rb +0 -2
  25. data/lib/jekyll/external.rb +1 -0
  26. data/lib/jekyll/filters.rb +10 -0
  27. data/lib/jekyll/frontmatter_defaults.rb +8 -1
  28. data/lib/jekyll/liquid_renderer/file.rb +1 -1
  29. data/lib/jekyll/page.rb +15 -11
  30. data/lib/jekyll/plugin_manager.rb +4 -10
  31. data/lib/jekyll/renderer.rb +12 -19
  32. data/lib/jekyll/site.rb +2 -20
  33. data/lib/jekyll/tags/highlight.rb +5 -5
  34. data/lib/jekyll/tags/include.rb +13 -2
  35. data/lib/jekyll/url.rb +22 -12
  36. data/lib/jekyll/utils.rb +48 -8
  37. data/lib/jekyll/utils/ansi.rb +59 -0
  38. data/lib/jekyll/utils/platforms.rb +2 -1
  39. data/lib/jekyll/version.rb +1 -1
  40. metadata +14 -5
@@ -1,6 +1,7 @@
1
1
  module Jekyll
2
2
  module Utils extend self
3
3
  autoload :Platforms, 'jekyll/utils/platforms'
4
+ autoload :Ansi, "jekyll/utils/ansi"
4
5
 
5
6
  # Constants for use in #slugify
6
7
  SLUGIFY_MODES = %w{raw default pretty}
@@ -8,6 +9,10 @@ module Jekyll
8
9
  SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
9
10
  SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
10
11
 
12
+ def strip_heredoc(str)
13
+ str.gsub(/^[ \t]{#{(str.scan(/^[ \t]*(?=\S)/).min || "").size}}/, "")
14
+ end
15
+
11
16
  # Non-destructive version of deep_merge_hashes! See that method.
12
17
  #
13
18
  # Returns the merged hashes.
@@ -26,7 +31,8 @@ module Jekyll
26
31
  # Thanks to whoever made it.
27
32
  def deep_merge_hashes!(target, overwrite)
28
33
  overwrite.each_key do |key|
29
- if overwrite[key].is_a? Hash and target[key].is_a? Hash
34
+ if (overwrite[key].is_a?(Hash) or overwrite[key].is_a?(Drops::Drop)) and
35
+ (target[key].is_a?(Hash) or target[key].is_a?(Drops::Drop))
30
36
  target[key] = Utils.deep_merge_hashes(target[key], overwrite[key])
31
37
  next
32
38
  end
@@ -34,7 +40,7 @@ module Jekyll
34
40
  target[key] = overwrite[key]
35
41
  end
36
42
 
37
- if target.default_proc.nil?
43
+ if target.respond_to?(:default_proc) && overwrite.respond_to?(:default_proc) && target.default_proc.nil?
38
44
  target.default_proc = overwrite.default_proc
39
45
  end
40
46
 
@@ -169,13 +175,14 @@ module Jekyll
169
175
  SLUGIFY_PRETTY_REGEXP
170
176
  end
171
177
 
172
- slug = string.
173
- # Strip according to the mode
174
- gsub(re, '-').
175
- # Remove leading/trailing hyphen
176
- gsub(/^\-|\-$/i, '')
178
+ # Strip according to the mode
179
+ slug = string.gsub(re, '-')
177
180
 
178
- cased ? slug : slug.downcase
181
+ # Remove leading/trailing hyphen
182
+ slug.gsub!(/^\-|\-$/i, '')
183
+
184
+ slug.downcase! unless cased
185
+ slug
179
186
  end
180
187
 
181
188
  # Add an appropriate suffix to template so that it matches the specified
@@ -218,5 +225,38 @@ module Jekyll
218
225
  template
219
226
  end
220
227
 
228
+
229
+ # Work the same way as Dir.glob but seperating the input into two parts
230
+ # ('dir' + '/' + 'pattern') to make sure the first part('dir') does not act
231
+ # as a pattern.
232
+ #
233
+ # For example, Dir.glob("path[/*") always returns an empty array,
234
+ # because the method fails to find the closing pattern to '[' which is ']'
235
+ #
236
+ # Examples:
237
+ # safe_glob("path[", "*")
238
+ # # => ["path[/file1", "path[/file2"]
239
+ #
240
+ # safe_glob("path", "*", File::FNM_DOTMATCH)
241
+ # # => ["path/.", "path/..", "path/file1"]
242
+ #
243
+ # safe_glob("path", ["**", "*"])
244
+ # # => ["path[/file1", "path[/folder/file2"]
245
+ #
246
+ # dir - the dir where glob will be executed under
247
+ # (the dir will be included to each result)
248
+ # patterns - the patterns (or the pattern) which will be applied under the dir
249
+ # flags - the flags which will be applied to the pattern
250
+ #
251
+ # Returns matched pathes
252
+ def safe_glob(dir, patterns, flags = 0)
253
+ return [] unless Dir.exist?(dir)
254
+ pattern = File.join(Array patterns)
255
+ return [dir] if pattern.empty?
256
+ Dir.chdir(dir) do
257
+ Dir.glob(pattern, flags).map { |f| File.join(dir, f) }
258
+ end
259
+ end
260
+
221
261
  end
222
262
  end
@@ -0,0 +1,59 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2015 Jekyll - MIT License
3
+ # Encoding: utf-8
4
+
5
+ module Jekyll
6
+ module Utils
7
+ module Ansi
8
+ extend self
9
+
10
+ ESCAPE = format("%c", 27)
11
+ MATCH = /#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix.freeze
12
+ COLORS = {
13
+ :red => 31,
14
+ :green => 32,
15
+ :black => 30,
16
+ :magenta => 35,
17
+ :yellow => 33,
18
+ :white => 37,
19
+ :blue => 34,
20
+ :cyan => 36
21
+ }
22
+
23
+ # Strip ANSI from the current string. It also strips cursor stuff,
24
+ # well some of it, and it also strips some other stuff that a lot of
25
+ # the other ANSI strippers don't.
26
+
27
+ def strip(str)
28
+ str.gsub MATCH, ""
29
+ end
30
+
31
+ #
32
+
33
+ def has?(str)
34
+ !!(str =~ MATCH)
35
+ end
36
+
37
+ # Reset the color back to the default color so that you do not leak any
38
+ # colors when you move onto the next line. This is probably normally
39
+ # used as part of a wrapper so that we don't leak colors.
40
+
41
+ def reset(str = "")
42
+ @ansi_reset ||= format("%c[0m", 27)
43
+ "#{@ansi_reset}#{str}"
44
+ end
45
+
46
+ # SEE: `self::COLORS` for a list of methods. They are mostly
47
+ # standard base colors supported by pretty much any xterm-color, we do
48
+ # not need more than the base colors so we do not include them.
49
+ # Actually... if I'm honest we don't even need most of the
50
+ # base colors.
51
+
52
+ COLORS.each do |color, num|
53
+ define_method color do |str|
54
+ "#{format("%c", 27)}[#{num}m#{str}#{reset}"
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,6 +1,7 @@
1
1
  module Jekyll
2
2
  module Utils
3
- module Platforms extend self
3
+ module Platforms
4
+ extend self
4
5
 
5
6
  # Provides jruby? and mri? which respectively detect these two types of
6
7
  # tested Engines we support, in the future we might probably support the
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.0.5'
2
+ VERSION = '3.1.0.pre.beta1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.1.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -144,6 +144,7 @@ files:
144
144
  - lib/jekyll/commands/help.rb
145
145
  - lib/jekyll/commands/new.rb
146
146
  - lib/jekyll/commands/serve.rb
147
+ - lib/jekyll/commands/serve/servlet.rb
147
148
  - lib/jekyll/configuration.rb
148
149
  - lib/jekyll/converter.rb
149
150
  - lib/jekyll/converters/identity.rb
@@ -154,6 +155,13 @@ files:
154
155
  - lib/jekyll/convertible.rb
155
156
  - lib/jekyll/deprecator.rb
156
157
  - lib/jekyll/document.rb
158
+ - lib/jekyll/drops/collection_drop.rb
159
+ - lib/jekyll/drops/document_drop.rb
160
+ - lib/jekyll/drops/drop.rb
161
+ - lib/jekyll/drops/jekyll_drop.rb
162
+ - lib/jekyll/drops/site_drop.rb
163
+ - lib/jekyll/drops/unified_payload_drop.rb
164
+ - lib/jekyll/drops/url_drop.rb
157
165
  - lib/jekyll/entry_filter.rb
158
166
  - lib/jekyll/errors.rb
159
167
  - lib/jekyll/excerpt.rb
@@ -191,6 +199,7 @@ files:
191
199
  - lib/jekyll/tags/post_url.rb
192
200
  - lib/jekyll/url.rb
193
201
  - lib/jekyll/utils.rb
202
+ - lib/jekyll/utils/ansi.rb
194
203
  - lib/jekyll/utils/platforms.rb
195
204
  - lib/jekyll/version.rb
196
205
  - lib/site_template/.gitignore
@@ -229,12 +238,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
238
  version: 2.0.0
230
239
  required_rubygems_version: !ruby/object:Gem::Requirement
231
240
  requirements:
232
- - - ">="
241
+ - - ">"
233
242
  - !ruby/object:Gem::Version
234
- version: '0'
243
+ version: 1.3.1
235
244
  requirements: []
236
245
  rubyforge_project:
237
- rubygems_version: 2.5.1
246
+ rubygems_version: 2.2.5
238
247
  signing_key:
239
248
  specification_version: 2
240
249
  summary: A simple, blog aware, static site generator.