jekyll 2.1.1 → 2.2.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.

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/History.markdown +36 -3
  3. data/Rakefile +20 -1
  4. data/features/post_data.feature +41 -6
  5. data/jekyll.gemspec +7 -4
  6. data/lib/jekyll.rb +53 -50
  7. data/lib/jekyll/command.rb +1 -1
  8. data/lib/jekyll/commands/build.rb +1 -1
  9. data/lib/jekyll/converters/markdown.rb +23 -4
  10. data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
  11. data/lib/jekyll/converters/markdown/maruku_parser.rb +1 -1
  12. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +1 -5
  13. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +31 -36
  14. data/lib/jekyll/converters/textile.rb +2 -2
  15. data/lib/jekyll/convertible.rb +12 -0
  16. data/lib/jekyll/deprecator.rb +19 -1
  17. data/lib/jekyll/errors.rb +6 -1
  18. data/lib/jekyll/excerpt.rb +0 -1
  19. data/lib/jekyll/frontmatter_defaults.rb +120 -122
  20. data/lib/jekyll/post.rb +3 -1
  21. data/lib/jekyll/renderer.rb +12 -0
  22. data/lib/jekyll/site.rb +2 -2
  23. data/lib/jekyll/tags/highlight.rb +24 -3
  24. data/lib/jekyll/tags/include.rb +0 -4
  25. data/lib/jekyll/version.rb +1 -1
  26. data/script/cibuild +4 -1
  27. data/script/proof +22 -0
  28. data/script/test +8 -2
  29. data/site/_config.yml +0 -1
  30. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +1 -1
  31. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +1 -1
  32. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +1 -1
  33. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +1 -1
  34. data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +1 -1
  35. data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +2 -2
  36. data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +1 -1
  37. data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +19 -0
  38. data/site/docs/assets.md +17 -3
  39. data/site/docs/contributing.md +1 -1
  40. data/site/docs/deployment-methods.md +15 -2
  41. data/site/docs/extras.md +3 -75
  42. data/site/docs/github-pages.md +1 -1
  43. data/site/docs/history.md +260 -3
  44. data/site/docs/index.md +1 -1
  45. data/site/docs/installation.md +1 -1
  46. data/site/docs/plugins.md +6 -2
  47. data/site/docs/posts.md +3 -3
  48. data/site/docs/resources.md +3 -6
  49. data/site/docs/troubleshooting.md +0 -10
  50. data/site/index.html +1 -1
  51. data/test/test_command.rb +1 -1
  52. data/test/test_kramdown.rb +1 -1
  53. data/test/test_post.rb +17 -2
  54. data/test/test_site.rb +5 -5
  55. data/test/test_tags.rb +33 -2
  56. metadata +20 -19
  57. data/site/docs/heroku.md +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5510f33edfed966c633c208d23735d3e38c48ff9
4
- data.tar.gz: 52f440324622ff8b6ec21b9f3be4e1389ce1f5c4
3
+ metadata.gz: a31f65d756e5aebe4d34d37dfa1a94f6d1ca51bf
4
+ data.tar.gz: 20cc0c111cf0f43655be2e14ec523709606d8ff8
5
5
  SHA512:
6
- metadata.gz: 7e9ae32caf9787927f2cfec615b614d523c40948c7b7795a1387bc57b073459483babe3cf52ac1a525813d1c2cf9f0a3f0ee30e20919c91a38316338dda1dccf
7
- data.tar.gz: fa070a7a332ad16d5671da91a1e9f739b7911b32baa87e6f882fd1920a4db39de70847d7bf679386a9f5ac027094cbce4e6b58c061a379ba7634d814a5a50dec
6
+ metadata.gz: 7bf6846863ee71fd92d708c9bfc5f86227a411b529b2e5f3028bcd6788991823cdd8dceb54cd7d76369f27c0c27e694de998da8a7da6d7036c52d09ede9e9789
7
+ data.tar.gz: 5a10ab501a2df020e5f2fbdacf614a3512f50f9bbe963a70c58b046a8dc3cdb78c55224f1e646950c4b56df6b99863ef4c04d215ba805c2d7372ad34835fd93b
@@ -10,6 +10,39 @@
10
10
 
11
11
  ### Site Enhancements
12
12
 
13
+ ## 2.2.0 / 2014-07-29
14
+
15
+ ### Minor Enhancements
16
+
17
+ * Throw a warning if the specified layout does not exist (#2620)
18
+ * Whitelist Pygments options in safe mode (#2642)
19
+
20
+ ### Bug Fixes
21
+
22
+ * Remove unnecessary `Jekyll::Tags::IncludeTag#blank?` method (#2625)
23
+ * Categories in the path are ignored (#2633)
24
+
25
+ ### Development Fixes
26
+
27
+ * Refactoring Errors & Requires of Third-Party stuff (#2591)
28
+ * Add further tests for categories (#2584)
29
+ * Proof site with html-proofer on change (#2605)
30
+ * Fix up bug in #2605 which caused proofing the site not to function (#2608)
31
+ * Use `bundle exec` in `script/proof` (#2610)
32
+
33
+ ### Site Enhancements
34
+
35
+ * Update Kramdown urls (#2588)
36
+ * Add `Jekyll::AutolinkEmail` and `Jekyll::GitMetadata` to the list of
37
+ third-party plugins (#2596)
38
+ * Fix a bunch of broken links in the site (#2601)
39
+ * Replace dead links with working links (#2611)
40
+ * Add jekyll-hook to deployment methods (#2617)
41
+ * Added kramdown-with-pygments plugin to the list of third-party plugins (#2623)
42
+ * Update outdated "Extras" page and remove duplicate documentation (#2622)
43
+ * Add co2 plugin to list of third-party plugins (#2639)
44
+ * Attempt to clarify the way Sass imports happen (#2642)
45
+
13
46
  ## 2.1.1 / 2014-07-01
14
47
 
15
48
  ### Bug Fixes
@@ -1118,9 +1151,9 @@
1118
1151
  * Configuration options set in config.yml are now available through the
1119
1152
  site payload (@vilcans)
1120
1153
  * Posts can now have an empty YAML front matter or none at all
1121
- (@bahuvrihi)
1154
+ (@ bahuvrihi)
1122
1155
  * Bug Fixes
1123
- * Fixing Ruby 1.9 issue that requires to_s on the err object
1156
+ * Fixing Ruby 1.9 issue that requires `#to_s` on the err object
1124
1157
  (@Chrononaut)
1125
1158
  * Fixes for pagination and ordering posts on the same day (@ujh)
1126
1159
  * Made pages respect permalinks style and permalinks in yml front matter
@@ -1130,7 +1163,7 @@
1130
1163
  * Added trailing slash to pretty permalink style so Apache is happy
1131
1164
  (@eugenebolshakov)
1132
1165
  * Bad markdown processor in config fails sooner and with better message
1133
- (@gcnovus)
1166
+ (@ gcnovus)
1134
1167
  * Allow CRLFs in yaml frontmatter (@juretta)
1135
1168
  * Added Date#xmlschema for Ruby versions < 1.9
1136
1169
 
data/Rakefile CHANGED
@@ -53,13 +53,32 @@ def liquid_escape(markdown)
53
53
  markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
54
54
  end
55
55
 
56
+ def custom_release_header_anchors(markdown)
57
+ header_regexp = /^(\d{1,2})\.(\d{1,2})\.(\d{1,2}) \/ \d{4}-\d{2}-\d{2}/
58
+ section_regexp = /^### \w+ \w+$/
59
+ markdown.split(/^##\s/).map do |release_notes|
60
+ _, major, minor, patch = *release_notes.match(header_regexp)
61
+ release_notes
62
+ .gsub(header_regexp, "\\0\n{: #v\\1-\\2-\\3}")
63
+ .gsub(section_regexp) { |section| "#{section}\n{: ##{sluffigy(section)}-v#{major}-#{minor}-#{patch}}" }
64
+ end.join("\n## ")
65
+ end
66
+
67
+ def sluffigy(header)
68
+ header.gsub(/#/, '').strip.downcase.gsub(/\s+/, '-')
69
+ end
70
+
56
71
  def remove_head_from_history(markdown)
57
72
  index = markdown =~ /^##\s+\d+\.\d+\.\d+/
58
73
  markdown[index..-1]
59
74
  end
60
75
 
61
76
  def converted_history(markdown)
62
- remove_head_from_history(liquid_escape(linkify(normalize_bullets(markdown))))
77
+ remove_head_from_history(
78
+ custom_release_header_anchors(
79
+ liquid_escape(
80
+ linkify(
81
+ normalize_bullets(markdown)))))
63
82
  end
64
83
 
65
84
  #############################################################################
@@ -70,18 +70,42 @@ Feature: Post data
70
70
  Then the _site directory should exist
71
71
  And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
72
72
 
73
- Scenario: Use post.categories variable when category is in a folder and has categories in YAML
73
+ Scenario: Use post.categories variable when category is in a folder and has category in YAML
74
74
  Given I have a movies directory
75
75
  And I have a movies/_posts directory
76
76
  And I have a _layouts directory
77
77
  And I have the following post in "movies":
78
- | title | date | layout | categories | content |
79
- | Star Wars | 2009-03-27 | simple | [film] | Luke, I am your father. |
78
+ | title | date | layout | category | content |
79
+ | Star Wars | 2009-03-27 | simple | film | Luke, I am your father. |
80
80
  And I have a simple layout that contains "Post category: {{ page.categories }}"
81
81
  When I run jekyll build
82
82
  Then the _site directory should exist
83
83
  And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html"
84
84
 
85
+ Scenario: Use post.categories variable when category is in a folder and has categories in YAML
86
+ Given I have a movies directory
87
+ And I have a movies/_posts directory
88
+ And I have a _layouts directory
89
+ And I have the following post in "movies":
90
+ | title | date | layout | categories | content |
91
+ | Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. |
92
+ And I have a simple layout that contains "Post category: {{ page.categories }}"
93
+ When I run jekyll build
94
+ Then the _site directory should exist
95
+ And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html"
96
+
97
+ Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML
98
+ Given I have a movies directory
99
+ And I have a movies/_posts directory
100
+ And I have a _layouts directory
101
+ And I have the following post in "movies":
102
+ | title | date | layout | category | content |
103
+ | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
104
+ And I have a simple layout that contains "Post category: {{ page.categories }}"
105
+ When I run jekyll build
106
+ Then the _site directory should exist
107
+ And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
108
+
85
109
  Scenario: Use post.tags variable
86
110
  Given I have a _posts directory
87
111
  And I have a _layouts directory
@@ -141,12 +165,23 @@ Feature: Post data
141
165
  Then the _site directory should exist
142
166
  And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
143
167
 
144
- Scenario: Use post.categories variable when category is in YAML
168
+ Scenario: Use post.categories variable when categories are in YAML
145
169
  Given I have a _posts directory
146
170
  And I have a _layouts directory
147
171
  And I have the following post:
148
- | title | date | layout | category | content |
149
- | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
172
+ | title | date | layout | categories | content |
173
+ | Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. |
174
+ And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
175
+ When I run jekyll build
176
+ Then the _site directory should exist
177
+ And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
178
+
179
+ Scenario: Use post.categories variable when categories are in YAML and are duplicated
180
+ Given I have a _posts directory
181
+ And I have a _layouts directory
182
+ And I have the following post:
183
+ | title | date | layout | categories | content |
184
+ | Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. |
150
185
  And I have a simple layout that contains "Post category: {{ page.categories }}"
151
186
  When I run jekyll build
152
187
  Then the _site directory should exist
@@ -28,13 +28,16 @@ Gem::Specification.new do |s|
28
28
  s.rdoc_options = ["--charset=UTF-8"]
29
29
  s.extra_rdoc_files = %w[README.markdown LICENSE]
30
30
 
31
- s.add_runtime_dependency('liquid', "~> 2.6.1")
32
- s.add_runtime_dependency('classifier', "~> 1.3")
33
- s.add_runtime_dependency('kramdown', "~> 1.3")
34
- s.add_runtime_dependency('pygments.rb', "~> 0.6.0")
31
+ s.add_runtime_dependency('liquid', "~> 2.6.1")
32
+ s.add_runtime_dependency('kramdown', "~> 1.3")
35
33
  s.add_runtime_dependency('mercenary', "~> 0.3.3")
36
34
  s.add_runtime_dependency('safe_yaml', "~> 1.0")
37
35
  s.add_runtime_dependency('colorator', "~> 0.1")
36
+
37
+ # Before 3.0 drops, phase the following gems out as dev dependencies
38
+ # and gracefully handle their absence.
39
+ s.add_runtime_dependency('classifier', "~> 1.3")
40
+ s.add_runtime_dependency('pygments.rb', "~> 0.6.0")
38
41
  s.add_runtime_dependency('redcarpet', "~> 3.1")
39
42
  s.add_runtime_dependency('toml', '~> 0.1.0')
40
43
  s.add_runtime_dependency('jekyll-paginate', '~> 1.0')
@@ -18,69 +18,56 @@ require 'rubygems'
18
18
  # stdlib
19
19
  require 'fileutils'
20
20
  require 'time'
21
- require 'safe_yaml/load'
22
21
  require 'English'
23
22
  require 'pathname'
24
23
  require 'logger'
25
24
 
26
25
  # 3rd party
26
+ require 'safe_yaml/load'
27
27
  require 'liquid'
28
28
  require 'kramdown'
29
29
  require 'colorator'
30
- require 'toml'
31
-
32
- # internal requires
33
- require 'jekyll/version'
34
- require 'jekyll/utils'
35
- require 'jekyll/log_adapter'
36
- require 'jekyll/stevenson'
37
- require 'jekyll/deprecator'
38
- require 'jekyll/configuration'
39
- require 'jekyll/document'
40
- require 'jekyll/collection'
41
- require 'jekyll/plugin_manager'
42
- require 'jekyll/frontmatter_defaults'
43
- require 'jekyll/site'
44
- require 'jekyll/convertible'
45
- require 'jekyll/url'
46
- require 'jekyll/layout'
47
- require 'jekyll/page'
48
- require 'jekyll/post'
49
- require 'jekyll/excerpt'
50
- require 'jekyll/draft'
51
- require 'jekyll/filters'
52
- require 'jekyll/static_file'
53
- require 'jekyll/errors'
54
- require 'jekyll/related_posts'
55
- require 'jekyll/cleaner'
56
- require 'jekyll/entry_filter'
57
- require 'jekyll/layout_reader'
58
- require 'jekyll/publisher'
59
- require 'jekyll/renderer'
60
-
61
- # extensions
62
- require 'jekyll/plugin'
63
- require 'jekyll/converter'
64
- require 'jekyll/generator'
65
- require 'jekyll/command'
66
- require 'jekyll/liquid_extensions'
67
-
68
- require_all 'jekyll/commands'
69
- require_all 'jekyll/converters'
70
- require_all 'jekyll/converters/markdown'
71
- require_all 'jekyll/generators'
72
- require_all 'jekyll/tags'
73
-
74
- # plugins
75
- require 'jekyll-coffeescript'
76
- require 'jekyll-sass-converter'
77
- require 'jekyll-paginate'
78
- require 'jekyll-gist'
79
30
 
80
31
  SafeYAML::OPTIONS[:suppress_warnings] = true
81
32
 
82
33
  module Jekyll
83
34
 
35
+ # internal requires
36
+ autoload :Cleaner, 'jekyll/cleaner'
37
+ autoload :Collection, 'jekyll/collection'
38
+ autoload :Configuration, 'jekyll/configuration'
39
+ autoload :Convertible, 'jekyll/convertible'
40
+ autoload :Deprecator, 'jekyll/deprecator'
41
+ autoload :Document, 'jekyll/document'
42
+ autoload :Draft, 'jekyll/draft'
43
+ autoload :EntryFilter, 'jekyll/entry_filter'
44
+ autoload :Errors, 'jekyll/errors'
45
+ autoload :Excerpt, 'jekyll/excerpt'
46
+ autoload :Filters, 'jekyll/filters'
47
+ autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults'
48
+ autoload :Layout, 'jekyll/layout'
49
+ autoload :LayoutReader, 'jekyll/layout_reader'
50
+ autoload :LogAdapter, 'jekyll/log_adapter'
51
+ autoload :Page, 'jekyll/page'
52
+ autoload :PluginManager, 'jekyll/plugin_manager'
53
+ autoload :Post, 'jekyll/post'
54
+ autoload :Publisher, 'jekyll/publisher'
55
+ autoload :RelatedPosts, 'jekyll/related_posts'
56
+ autoload :Renderer, 'jekyll/renderer'
57
+ autoload :Site, 'jekyll/site'
58
+ autoload :StaticFile, 'jekyll/static_file'
59
+ autoload :Stevenson, 'jekyll/stevenson'
60
+ autoload :URL, 'jekyll/url'
61
+ autoload :Utils, 'jekyll/utils'
62
+ autoload :VERSION, 'jekyll/version'
63
+
64
+ # extensions
65
+ require 'jekyll/plugin'
66
+ require 'jekyll/converter'
67
+ require 'jekyll/generator'
68
+ require 'jekyll/command'
69
+ require 'jekyll/liquid_extensions'
70
+
84
71
  # Public: Tells you which Jekyll environment you are building in so you can skip tasks
85
72
  # if you need to. This is useful when doing expensive compression tasks on css and
86
73
  # images and allows you to skip that when working in development.
@@ -143,3 +130,19 @@ module Jekyll
143
130
  end
144
131
  end
145
132
  end
133
+
134
+ require_all 'jekyll/commands'
135
+ require_all 'jekyll/converters'
136
+ require_all 'jekyll/converters/markdown'
137
+ require_all 'jekyll/generators'
138
+ require_all 'jekyll/tags'
139
+
140
+ # Eventually remove these for 3.0 as non-core
141
+ Jekyll::Deprecator.gracefully_require(%w[
142
+ classifier
143
+ toml
144
+ jekyll-paginate
145
+ jekyll-gist
146
+ jekyll-coffeescript
147
+ jekyll-sass-converter
148
+ ])
@@ -51,7 +51,7 @@ module Jekyll
51
51
  # Returns nothing
52
52
  def process_site(site)
53
53
  site.process
54
- rescue Jekyll::FatalException => e
54
+ rescue Jekyll::Errors::FatalException => e
55
55
  Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
56
56
  Jekyll.logger.error "", "------------------------------------"
57
57
  Jekyll.logger.error "", e.message
@@ -58,7 +58,7 @@ module Jekyll
58
58
  #
59
59
  # Returns nothing.
60
60
  def watch(site, options)
61
- require 'jekyll-watch'
61
+ Deprecator.gracefully_require 'jekyll-watch'
62
62
  Jekyll::Commands::Watch.watch(site, options)
63
63
  end
64
64
 
@@ -11,22 +11,41 @@ module Jekyll
11
11
  @parser =
12
12
  case @config['markdown'].downcase
13
13
  when 'redcarpet' then RedcarpetParser.new(@config)
14
- when 'kramdown' then KramdownParser.new(@config)
14
+ when 'kramdown' then KramdownParser.new(@config)
15
15
  when 'rdiscount' then RDiscountParser.new(@config)
16
- when 'maruku' then MarukuParser.new(@config)
16
+ when 'maruku' then MarukuParser.new(@config)
17
17
  else
18
18
  # So they can't try some tricky bullshit or go down the ancestor chain, I hope.
19
19
  if allowed_custom_class?(@config['markdown'])
20
20
  self.class.const_get(@config['markdown']).new(@config)
21
21
  else
22
22
  Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
23
- Jekyll.logger.error "", "Valid options are [ maruku | rdiscount | kramdown | redcarpet ]"
24
- raise FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
23
+ Jekyll.logger.error "", "Valid options are [ #{valid_processors.join(" | ")} ]"
24
+ raise Errors::FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
25
25
  end
26
26
  end
27
27
  @setup = true
28
28
  end
29
29
 
30
+ def valid_processors
31
+ %w[
32
+ maruku
33
+ rdiscount
34
+ kramdown
35
+ redcarpet
36
+ ] + third_party_processors
37
+ end
38
+
39
+ def third_party_processors
40
+ self.class.constants - %w[
41
+ KramdownParser
42
+ MarukuParser
43
+ RDiscountParser
44
+ RedcarpetParser
45
+ PRIORITIES
46
+ ].map(&:to_sym)
47
+ end
48
+
30
49
  def matches(ext)
31
50
  rgx = '^\.(' + @config['markdown_ext'].gsub(',','|') +')$'
32
51
  ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
@@ -8,7 +8,7 @@ module Jekyll
8
8
  rescue LoadError
9
9
  STDERR.puts 'You are missing a library required for Markdown. Please run:'
10
10
  STDERR.puts ' $ [sudo] gem install kramdown'
11
- raise FatalException.new("Missing dependency: kramdown")
11
+ raise Errors::FatalException.new("Missing dependency: kramdown")
12
12
  end
13
13
 
14
14
  def convert(content)
@@ -15,7 +15,7 @@ module Jekyll
15
15
  rescue LoadError
16
16
  STDERR.puts 'You are missing a library required for Markdown. Please run:'
17
17
  STDERR.puts ' $ [sudo] gem install maruku'
18
- raise FatalException.new("Missing dependency: maruku")
18
+ raise Errors::FatalException.new("Missing dependency: maruku")
19
19
  end
20
20
 
21
21
  def load_divs_library
@@ -3,13 +3,9 @@ module Jekyll
3
3
  class Markdown
4
4
  class RDiscountParser
5
5
  def initialize(config)
6
- require 'rdiscount'
6
+ Jekyll::Deprecator.gracefully_require "rdiscount"
7
7
  @config = config
8
8
  @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
9
- rescue LoadError
10
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
11
- STDERR.puts ' $ [sudo] gem install rdiscount'
12
- raise FatalException.new("Missing dependency: rdiscount")
13
9
  end
14
10
 
15
11
  def convert(content)
@@ -14,7 +14,7 @@ module Jekyll
14
14
  module WithPygments
15
15
  include CommonMethods
16
16
  def block_code(code, lang)
17
- require 'pygments'
17
+ Jekyll::Deprecator.gracefully_require("pygments")
18
18
  lang = lang && lang.split.first || "text"
19
19
  add_code_tags(
20
20
  Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
@@ -55,45 +55,40 @@ module Jekyll
55
55
 
56
56
 
57
57
  def initialize(config)
58
- require 'redcarpet'
58
+ Deprecator.gracefully_require("redcarpet")
59
59
  @config = config
60
60
  @redcarpet_extensions = {}
61
61
  @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
62
62
 
63
- @renderer ||= case @config['highlighter']
64
- when 'pygments'
65
- Class.new(Redcarpet::Render::HTML) do
66
- include WithPygments
67
- end
68
- when 'rouge'
69
- Class.new(Redcarpet::Render::HTML) do
70
- begin
71
- require 'rouge'
72
- require 'rouge/plugins/redcarpet'
73
- rescue LoadError => e
74
- Jekyll.logger.error "You are missing the 'rouge' gem. Please run:"
75
- Jekyll.logger.error " $ [sudo] gem install rouge"
76
- Jekyll.logger.error "Or add 'rouge' to your Gemfile."
77
- raise FatalException.new("Missing dependency: rouge")
78
- end
79
-
80
- if Rouge.version < '1.3.0'
81
- abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
82
- end
83
-
84
- include Rouge::Plugins::Redcarpet
85
- include CommonMethods
86
- include WithRouge
87
- end
88
- else
89
- Class.new(Redcarpet::Render::HTML) do
90
- include WithoutHighlighting
91
- end
92
- end
93
- rescue LoadError
94
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
95
- STDERR.puts ' $ [sudo] gem install redcarpet'
96
- raise FatalException.new("Missing dependency: redcarpet")
63
+ @renderer ||= class_with_proper_highlighter(@config['highlighter'])
64
+ end
65
+
66
+ def class_with_proper_highlighter(highlighter)
67
+ case highlighter
68
+ when "pygments"
69
+ Class.new(Redcarpet::Render::HTML) do
70
+ include WithPygments
71
+ end
72
+ when "rouge"
73
+ Class.new(Redcarpet::Render::HTML) do
74
+ Jekyll::Deprecator.gracefully_require(%w[
75
+ rouge
76
+ rouge/plugins/redcarpet
77
+ ])
78
+
79
+ if Rouge.version < '1.3.0'
80
+ abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
81
+ end
82
+
83
+ include Rouge::Plugins::Redcarpet
84
+ include CommonMethods
85
+ include WithRouge
86
+ end
87
+ else
88
+ Class.new(Redcarpet::Render::HTML) do
89
+ include WithoutHighlighting
90
+ end
91
+ end
97
92
  end
98
93
 
99
94
  def convert(content)