jekyll 4.0.1 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +350 -163
- data/LICENSE +21 -21
- data/README.markdown +86 -90
- data/exe/jekyll +57 -57
- data/lib/blank_template/_config.yml +3 -3
- data/lib/blank_template/_layouts/default.html +12 -12
- data/lib/blank_template/_sass/main.scss +9 -9
- data/lib/blank_template/assets/css/main.scss +4 -4
- data/lib/blank_template/index.md +8 -8
- data/lib/jekyll/cache.rb +190 -190
- data/lib/jekyll/cleaner.rb +111 -111
- data/lib/jekyll/collection.rb +309 -309
- data/lib/jekyll/command.rb +105 -103
- data/lib/jekyll/commands/build.rb +93 -93
- data/lib/jekyll/commands/clean.rb +45 -45
- data/lib/jekyll/commands/doctor.rb +177 -173
- data/lib/jekyll/commands/help.rb +34 -34
- data/lib/jekyll/commands/new.rb +169 -169
- data/lib/jekyll/commands/new_theme.rb +40 -42
- data/lib/jekyll/commands/serve/live_reload_reactor.rb +122 -122
- data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
- data/lib/jekyll/commands/serve/servlet.rb +202 -202
- data/lib/jekyll/commands/serve/websockets.rb +81 -81
- data/lib/jekyll/commands/serve.rb +362 -354
- data/lib/jekyll/configuration.rb +313 -316
- data/lib/jekyll/converter.rb +54 -54
- data/lib/jekyll/converters/identity.rb +41 -41
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +199 -130
- data/lib/jekyll/converters/markdown.rb +113 -113
- data/lib/jekyll/converters/smartypants.rb +70 -70
- data/lib/jekyll/convertible.rb +257 -254
- data/lib/jekyll/deprecator.rb +50 -50
- data/lib/jekyll/document.rb +544 -522
- data/lib/jekyll/drops/collection_drop.rb +20 -20
- data/lib/jekyll/drops/document_drop.rb +70 -69
- data/lib/jekyll/drops/drop.rb +293 -215
- data/lib/jekyll/drops/excerpt_drop.rb +19 -19
- data/lib/jekyll/drops/jekyll_drop.rb +32 -32
- data/lib/jekyll/drops/site_drop.rb +66 -66
- data/lib/jekyll/drops/static_file_drop.rb +14 -14
- data/lib/jekyll/drops/unified_payload_drop.rb +26 -26
- data/lib/jekyll/drops/url_drop.rb +140 -132
- data/lib/jekyll/entry_filter.rb +121 -110
- data/lib/jekyll/errors.rb +20 -20
- data/lib/jekyll/excerpt.rb +201 -201
- data/lib/jekyll/external.rb +79 -79
- data/lib/jekyll/filters/date_filters.rb +110 -110
- data/lib/jekyll/filters/grouping_filters.rb +64 -64
- data/lib/jekyll/filters/url_filters.rb +98 -68
- data/lib/jekyll/filters.rb +535 -454
- data/lib/jekyll/frontmatter_defaults.rb +240 -245
- data/lib/jekyll/generator.rb +5 -5
- data/lib/jekyll/hooks.rb +107 -106
- data/lib/jekyll/inclusion.rb +32 -0
- data/lib/jekyll/layout.rb +67 -62
- data/lib/jekyll/liquid_extensions.rb +22 -22
- data/lib/jekyll/liquid_renderer/file.rb +77 -77
- data/lib/jekyll/liquid_renderer/table.rb +55 -75
- data/lib/jekyll/liquid_renderer.rb +80 -77
- data/lib/jekyll/log_adapter.rb +151 -151
- data/lib/jekyll/mime.types +866 -866
- data/lib/jekyll/page.rb +217 -186
- data/lib/jekyll/page_excerpt.rb +25 -0
- data/lib/jekyll/page_without_a_file.rb +14 -14
- data/lib/jekyll/path_manager.rb +74 -31
- data/lib/jekyll/plugin.rb +92 -92
- data/lib/jekyll/plugin_manager.rb +115 -115
- data/lib/jekyll/profiler.rb +58 -0
- data/lib/jekyll/publisher.rb +23 -23
- data/lib/jekyll/reader.rb +192 -187
- data/lib/jekyll/readers/collection_reader.rb +23 -22
- data/lib/jekyll/readers/data_reader.rb +79 -75
- data/lib/jekyll/readers/layout_reader.rb +62 -61
- data/lib/jekyll/readers/page_reader.rb +25 -24
- data/lib/jekyll/readers/post_reader.rb +85 -84
- data/lib/jekyll/readers/static_file_reader.rb +25 -24
- data/lib/jekyll/readers/theme_assets_reader.rb +52 -51
- data/lib/jekyll/regenerator.rb +195 -195
- data/lib/jekyll/related_posts.rb +52 -52
- data/lib/jekyll/renderer.rb +265 -267
- data/lib/jekyll/site.rb +551 -527
- data/lib/jekyll/static_file.rb +208 -203
- data/lib/jekyll/stevenson.rb +60 -60
- data/lib/jekyll/tags/highlight.rb +110 -110
- data/lib/jekyll/tags/include.rb +275 -221
- data/lib/jekyll/tags/link.rb +42 -41
- data/lib/jekyll/tags/post_url.rb +106 -107
- data/lib/jekyll/theme.rb +86 -80
- data/lib/jekyll/theme_builder.rb +121 -121
- data/lib/jekyll/url.rb +167 -164
- data/lib/jekyll/utils/ansi.rb +57 -57
- data/lib/jekyll/utils/exec.rb +26 -26
- data/lib/jekyll/utils/internet.rb +37 -37
- data/lib/jekyll/utils/platforms.rb +67 -82
- data/lib/jekyll/utils/thread_event.rb +31 -31
- data/lib/jekyll/utils/win_tz.rb +75 -75
- data/lib/jekyll/utils.rb +367 -367
- data/lib/jekyll/version.rb +5 -5
- data/lib/jekyll.rb +195 -206
- data/lib/site_template/.gitignore +5 -5
- data/lib/site_template/404.html +25 -25
- data/lib/site_template/_config.yml +55 -55
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -29
- data/lib/site_template/about.markdown +18 -18
- data/lib/site_template/index.markdown +6 -6
- data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -74
- data/lib/theme_template/Gemfile +4 -4
- data/lib/theme_template/LICENSE.txt.erb +21 -21
- data/lib/theme_template/README.md.erb +52 -52
- data/lib/theme_template/_layouts/default.html +1 -1
- data/lib/theme_template/_layouts/page.html +5 -5
- data/lib/theme_template/_layouts/post.html +5 -5
- data/lib/theme_template/example/_config.yml.erb +1 -1
- data/lib/theme_template/example/_post.md +12 -12
- data/lib/theme_template/example/index.html +14 -14
- data/lib/theme_template/example/style.scss +7 -7
- data/lib/theme_template/gitignore.erb +6 -6
- data/lib/theme_template/theme.gemspec.erb +16 -19
- data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -149
- data/rubocop/jekyll/no_p_allowed.rb +23 -23
- data/rubocop/jekyll/no_puts_allowed.rb +23 -23
- data/rubocop/jekyll.rb +5 -5
- metadata +20 -38
data/lib/jekyll/converter.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
class Converter < Plugin
|
5
|
-
# Public: Get or set the highlighter prefix. When an argument is specified,
|
6
|
-
# the prefix will be set. If no argument is specified, the current prefix
|
7
|
-
# will be returned.
|
8
|
-
#
|
9
|
-
# highlighter_prefix - The String prefix (default: nil).
|
10
|
-
#
|
11
|
-
# Returns the String prefix.
|
12
|
-
def self.highlighter_prefix(highlighter_prefix = nil)
|
13
|
-
unless defined?(@highlighter_prefix) && highlighter_prefix.nil?
|
14
|
-
@highlighter_prefix = highlighter_prefix
|
15
|
-
end
|
16
|
-
@highlighter_prefix
|
17
|
-
end
|
18
|
-
|
19
|
-
# Public: Get or set the highlighter suffix. When an argument is specified,
|
20
|
-
# the suffix will be set. If no argument is specified, the current suffix
|
21
|
-
# will be returned.
|
22
|
-
#
|
23
|
-
# highlighter_suffix - The String suffix (default: nil).
|
24
|
-
#
|
25
|
-
# Returns the String suffix.
|
26
|
-
def self.highlighter_suffix(highlighter_suffix = nil)
|
27
|
-
unless defined?(@highlighter_suffix) && highlighter_suffix.nil?
|
28
|
-
@highlighter_suffix = highlighter_suffix
|
29
|
-
end
|
30
|
-
@highlighter_suffix
|
31
|
-
end
|
32
|
-
|
33
|
-
# Initialize the converter.
|
34
|
-
#
|
35
|
-
# Returns an initialized Converter.
|
36
|
-
def initialize(config = {})
|
37
|
-
@config = config
|
38
|
-
end
|
39
|
-
|
40
|
-
# Get the highlighter prefix.
|
41
|
-
#
|
42
|
-
# Returns the String prefix.
|
43
|
-
def highlighter_prefix
|
44
|
-
self.class.highlighter_prefix
|
45
|
-
end
|
46
|
-
|
47
|
-
# Get the highlighter suffix.
|
48
|
-
#
|
49
|
-
# Returns the String suffix.
|
50
|
-
def highlighter_suffix
|
51
|
-
self.class.highlighter_suffix
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class Converter < Plugin
|
5
|
+
# Public: Get or set the highlighter prefix. When an argument is specified,
|
6
|
+
# the prefix will be set. If no argument is specified, the current prefix
|
7
|
+
# will be returned.
|
8
|
+
#
|
9
|
+
# highlighter_prefix - The String prefix (default: nil).
|
10
|
+
#
|
11
|
+
# Returns the String prefix.
|
12
|
+
def self.highlighter_prefix(highlighter_prefix = nil)
|
13
|
+
unless defined?(@highlighter_prefix) && highlighter_prefix.nil?
|
14
|
+
@highlighter_prefix = highlighter_prefix
|
15
|
+
end
|
16
|
+
@highlighter_prefix
|
17
|
+
end
|
18
|
+
|
19
|
+
# Public: Get or set the highlighter suffix. When an argument is specified,
|
20
|
+
# the suffix will be set. If no argument is specified, the current suffix
|
21
|
+
# will be returned.
|
22
|
+
#
|
23
|
+
# highlighter_suffix - The String suffix (default: nil).
|
24
|
+
#
|
25
|
+
# Returns the String suffix.
|
26
|
+
def self.highlighter_suffix(highlighter_suffix = nil)
|
27
|
+
unless defined?(@highlighter_suffix) && highlighter_suffix.nil?
|
28
|
+
@highlighter_suffix = highlighter_suffix
|
29
|
+
end
|
30
|
+
@highlighter_suffix
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initialize the converter.
|
34
|
+
#
|
35
|
+
# Returns an initialized Converter.
|
36
|
+
def initialize(config = {})
|
37
|
+
@config = config
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get the highlighter prefix.
|
41
|
+
#
|
42
|
+
# Returns the String prefix.
|
43
|
+
def highlighter_prefix
|
44
|
+
self.class.highlighter_prefix
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get the highlighter suffix.
|
48
|
+
#
|
49
|
+
# Returns the String suffix.
|
50
|
+
def highlighter_suffix
|
51
|
+
self.class.highlighter_suffix
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,41 +1,41 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Converters
|
5
|
-
#
|
6
|
-
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
7
|
-
class Identity < Converter
|
8
|
-
safe true
|
9
|
-
|
10
|
-
priority :lowest
|
11
|
-
|
12
|
-
# Public: Does the given extension match this converter's list of acceptable extensions?
|
13
|
-
# Takes one argument: the file's extension (including the dot).
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# Returns true since it always matches.
|
18
|
-
def matches(_ext)
|
19
|
-
true
|
20
|
-
end
|
21
|
-
|
22
|
-
# Public: The extension to be given to the output file (including the dot).
|
23
|
-
#
|
24
|
-
# ext - The String extension or original file.
|
25
|
-
#
|
26
|
-
# Returns The String output file extension.
|
27
|
-
def output_ext(ext)
|
28
|
-
ext
|
29
|
-
end
|
30
|
-
|
31
|
-
# Logic to do the content conversion.
|
32
|
-
#
|
33
|
-
# content - String content of file (without front matter).
|
34
|
-
#
|
35
|
-
# Returns a String of the converted content.
|
36
|
-
def convert(content)
|
37
|
-
content
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Converters
|
5
|
+
# Identity converter. Returns same content as given.
|
6
|
+
# For more info on converters see https://jekyllrb.com/docs/plugins/converters/
|
7
|
+
class Identity < Converter
|
8
|
+
safe true
|
9
|
+
|
10
|
+
priority :lowest
|
11
|
+
|
12
|
+
# Public: Does the given extension match this converter's list of acceptable extensions?
|
13
|
+
# Takes one argument: the file's extension (including the dot).
|
14
|
+
#
|
15
|
+
# _ext - The String extension to check (not relevant here)
|
16
|
+
#
|
17
|
+
# Returns true since it always matches.
|
18
|
+
def matches(_ext)
|
19
|
+
true
|
20
|
+
end
|
21
|
+
|
22
|
+
# Public: The extension to be given to the output file (including the dot).
|
23
|
+
#
|
24
|
+
# ext - The String extension or original file.
|
25
|
+
#
|
26
|
+
# Returns The String output file extension.
|
27
|
+
def output_ext(ext)
|
28
|
+
ext
|
29
|
+
end
|
30
|
+
|
31
|
+
# Logic to do the content conversion.
|
32
|
+
#
|
33
|
+
# content - String content of file (without front matter).
|
34
|
+
#
|
35
|
+
# Returns a String of the converted content.
|
36
|
+
def convert(content)
|
37
|
+
content
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,130 +1,199 @@
|
|
1
|
-
# Frozen-string-literal: true
|
2
|
-
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
1
|
+
# Frozen-string-literal: true
|
2
|
+
|
3
|
+
module Kramdown
|
4
|
+
# A Kramdown::Document subclass meant to optimize memory usage from initializing
|
5
|
+
# a kramdown document for parsing.
|
6
|
+
#
|
7
|
+
# The optimization is by using the same options Hash (and its derivatives) for
|
8
|
+
# converting all Markdown documents in a Jekyll site.
|
9
|
+
class JekyllDocument < Document
|
10
|
+
class << self
|
11
|
+
attr_reader :options, :parser
|
12
|
+
|
13
|
+
# The implementation is basically the core logic in +Kramdown::Document#initialize+
|
14
|
+
#
|
15
|
+
# rubocop:disable Naming/MemoizedInstanceVariableName
|
16
|
+
def setup(options)
|
17
|
+
@cache ||= {}
|
18
|
+
|
19
|
+
# reset variables on a subsequent set up with a different options Hash
|
20
|
+
unless @cache[:id] == options.hash
|
21
|
+
@options = @parser = nil
|
22
|
+
@cache[:id] = options.hash
|
23
|
+
end
|
24
|
+
|
25
|
+
@options ||= Options.merge(options).freeze
|
26
|
+
@parser ||= begin
|
27
|
+
parser_name = (@options[:input] || "kramdown").to_s
|
28
|
+
parser_name = parser_name[0..0].upcase + parser_name[1..-1]
|
29
|
+
try_require("parser", parser_name)
|
30
|
+
|
31
|
+
if Parser.const_defined?(parser_name)
|
32
|
+
Parser.const_get(parser_name)
|
33
|
+
else
|
34
|
+
raise Kramdown::Error, "kramdown has no parser to handle the specified " \
|
35
|
+
"input format: #{@options[:input]}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# rubocop:enable Naming/MemoizedInstanceVariableName
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def try_require(type, name)
|
44
|
+
require "kramdown/#{type}/#{Utils.snake_case(name)}"
|
45
|
+
rescue LoadError
|
46
|
+
false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def initialize(source, options = {})
|
51
|
+
JekyllDocument.setup(options)
|
52
|
+
|
53
|
+
@options = JekyllDocument.options
|
54
|
+
@root, @warnings = JekyllDocument.parser.parse(source, @options)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Use Kramdown::Converter::Html class to convert this document into HTML.
|
58
|
+
#
|
59
|
+
# The implementation is basically an optimized version of core logic in
|
60
|
+
# +Kramdown::Document#method_missing+ from kramdown-2.1.0.
|
61
|
+
def to_html
|
62
|
+
output, warnings = Kramdown::Converter::Html.convert(@root, @options)
|
63
|
+
@warnings.concat(warnings)
|
64
|
+
output
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
|
71
|
+
module Jekyll
|
72
|
+
module Converters
|
73
|
+
class Markdown
|
74
|
+
class KramdownParser
|
75
|
+
CODERAY_DEFAULTS = {
|
76
|
+
"css" => "style",
|
77
|
+
"bold_every" => 10,
|
78
|
+
"line_numbers" => "inline",
|
79
|
+
"line_number_start" => 1,
|
80
|
+
"tab_width" => 4,
|
81
|
+
"wrap" => "div",
|
82
|
+
}.freeze
|
83
|
+
|
84
|
+
def initialize(config)
|
85
|
+
@main_fallback_highlighter = config["highlighter"] || "rouge"
|
86
|
+
@config = config["kramdown"] || {}
|
87
|
+
@highlighter = nil
|
88
|
+
setup
|
89
|
+
load_dependencies
|
90
|
+
end
|
91
|
+
|
92
|
+
# Setup and normalize the configuration:
|
93
|
+
# * Create Kramdown if it doesn't exist.
|
94
|
+
# * Set syntax_highlighter, detecting enable_coderay and merging
|
95
|
+
# highlighter if none.
|
96
|
+
# * Merge kramdown[coderay] into syntax_highlighter_opts stripping coderay_.
|
97
|
+
# * Make sure `syntax_highlighter_opts` exists.
|
98
|
+
|
99
|
+
def setup
|
100
|
+
@config["syntax_highlighter"] ||= highlighter
|
101
|
+
@config["syntax_highlighter_opts"] ||= {}
|
102
|
+
@config["syntax_highlighter_opts"]["default_lang"] ||= "plaintext"
|
103
|
+
@config["syntax_highlighter_opts"]["guess_lang"] = @config["guess_lang"]
|
104
|
+
@config["coderay"] ||= {} # XXX: Legacy.
|
105
|
+
modernize_coderay_config
|
106
|
+
end
|
107
|
+
|
108
|
+
def convert(content)
|
109
|
+
document = Kramdown::JekyllDocument.new(content, @config)
|
110
|
+
html_output = document.to_html
|
111
|
+
if @config["show_warnings"]
|
112
|
+
document.warnings.each do |warning|
|
113
|
+
Jekyll.logger.warn "Kramdown warning:", warning
|
114
|
+
end
|
115
|
+
end
|
116
|
+
html_output
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
def load_dependencies
|
122
|
+
require "kramdown-parser-gfm" if @config["input"] == "GFM"
|
123
|
+
|
124
|
+
if highlighter == "coderay"
|
125
|
+
Jekyll::External.require_with_graceful_fail("kramdown-syntax-coderay")
|
126
|
+
end
|
127
|
+
|
128
|
+
# `mathjax` emgine is bundled within kramdown-2.x and will be handled by
|
129
|
+
# kramdown itself.
|
130
|
+
if (math_engine = @config["math_engine"]) && math_engine != "mathjax"
|
131
|
+
Jekyll::External.require_with_graceful_fail("kramdown-math-#{math_engine}")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# config[kramdown][syntax_higlighter] >
|
136
|
+
# config[kramdown][enable_coderay] >
|
137
|
+
# config[highlighter]
|
138
|
+
# Where `enable_coderay` is now deprecated because Kramdown
|
139
|
+
# supports Rouge now too.
|
140
|
+
def highlighter
|
141
|
+
return @highlighter if @highlighter
|
142
|
+
|
143
|
+
if @config["syntax_highlighter"]
|
144
|
+
return @highlighter = @config[
|
145
|
+
"syntax_highlighter"
|
146
|
+
]
|
147
|
+
end
|
148
|
+
|
149
|
+
@highlighter = begin
|
150
|
+
if @config.key?("enable_coderay") && @config["enable_coderay"]
|
151
|
+
Jekyll::Deprecator.deprecation_message(
|
152
|
+
"You are using 'enable_coderay', " \
|
153
|
+
"use syntax_highlighter: coderay in your configuration file."
|
154
|
+
)
|
155
|
+
|
156
|
+
"coderay"
|
157
|
+
else
|
158
|
+
@main_fallback_highlighter
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def strip_coderay_prefix(hash)
|
164
|
+
hash.each_with_object({}) do |(key, val), hsh|
|
165
|
+
cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
|
166
|
+
|
167
|
+
if key != cleaned_key
|
168
|
+
Jekyll::Deprecator.deprecation_message(
|
169
|
+
"You are using '#{key}'. Normalizing to #{cleaned_key}."
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
hsh[cleaned_key] = val
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# If our highlighter is CodeRay we go in to merge the CodeRay defaults
|
178
|
+
# with your "coderay" key if it's there, deprecating it in the
|
179
|
+
# process of you using it.
|
180
|
+
def modernize_coderay_config
|
181
|
+
unless @config["coderay"].empty?
|
182
|
+
Jekyll::Deprecator.deprecation_message(
|
183
|
+
"You are using 'kramdown.coderay' in your configuration, " \
|
184
|
+
"please use 'syntax_highlighter_opts' instead."
|
185
|
+
)
|
186
|
+
|
187
|
+
@config["syntax_highlighter_opts"] = begin
|
188
|
+
strip_coderay_prefix(
|
189
|
+
@config["syntax_highlighter_opts"] \
|
190
|
+
.merge(CODERAY_DEFAULTS) \
|
191
|
+
.merge(@config["coderay"])
|
192
|
+
)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|