jekyll-docs 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll.rb +195 -0
- data/lib/jekyll/cleaner.rb +110 -0
- data/lib/jekyll/collection.rb +230 -0
- data/lib/jekyll/command.rb +78 -0
- data/lib/jekyll/commands/build.rb +102 -0
- data/lib/jekyll/commands/clean.rb +43 -0
- data/lib/jekyll/commands/doctor.rb +153 -0
- data/lib/jekyll/commands/help.rb +34 -0
- data/lib/jekyll/commands/new.rb +156 -0
- data/lib/jekyll/commands/new_theme.rb +40 -0
- data/lib/jekyll/commands/serve.rb +245 -0
- data/lib/jekyll/commands/serve/servlet.rb +62 -0
- data/lib/jekyll/configuration.rb +410 -0
- data/lib/jekyll/converter.rb +54 -0
- data/lib/jekyll/converters/identity.rb +23 -0
- data/lib/jekyll/converters/markdown.rb +104 -0
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +123 -0
- data/lib/jekyll/converters/markdown/rdiscount_parser.rb +35 -0
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +108 -0
- data/lib/jekyll/converters/smartypants.rb +36 -0
- data/lib/jekyll/convertible.rb +251 -0
- data/lib/jekyll/deprecator.rb +52 -0
- data/lib/jekyll/document.rb +507 -0
- data/lib/jekyll/drops/collection_drop.rb +22 -0
- data/lib/jekyll/drops/document_drop.rb +69 -0
- data/lib/jekyll/drops/drop.rb +214 -0
- data/lib/jekyll/drops/excerpt_drop.rb +15 -0
- data/lib/jekyll/drops/jekyll_drop.rb +33 -0
- data/lib/jekyll/drops/site_drop.rb +47 -0
- data/lib/jekyll/drops/static_file_drop.rb +13 -0
- data/lib/jekyll/drops/unified_payload_drop.rb +25 -0
- data/lib/jekyll/drops/url_drop.rb +88 -0
- data/lib/jekyll/entry_filter.rb +123 -0
- data/lib/jekyll/errors.rb +20 -0
- data/lib/jekyll/excerpt.rb +126 -0
- data/lib/jekyll/external.rb +74 -0
- data/lib/jekyll/filters.rb +430 -0
- data/lib/jekyll/filters/grouping_filters.rb +65 -0
- data/lib/jekyll/filters/url_filters.rb +60 -0
- data/lib/jekyll/frontmatter_defaults.rb +197 -0
- data/lib/jekyll/generator.rb +5 -0
- data/lib/jekyll/hooks.rb +104 -0
- data/lib/jekyll/layout.rb +62 -0
- data/lib/jekyll/liquid_extensions.rb +24 -0
- data/lib/jekyll/liquid_renderer.rb +49 -0
- data/lib/jekyll/liquid_renderer/file.rb +56 -0
- data/lib/jekyll/liquid_renderer/table.rb +96 -0
- data/lib/jekyll/log_adapter.rb +147 -0
- data/lib/jekyll/mime.types +825 -0
- data/lib/jekyll/page.rb +187 -0
- data/lib/jekyll/plugin.rb +98 -0
- data/lib/jekyll/plugin_manager.rb +113 -0
- data/lib/jekyll/publisher.rb +23 -0
- data/lib/jekyll/reader.rb +134 -0
- data/lib/jekyll/readers/collection_reader.rb +22 -0
- data/lib/jekyll/readers/data_reader.rb +77 -0
- data/lib/jekyll/readers/layout_reader.rb +71 -0
- data/lib/jekyll/readers/page_reader.rb +25 -0
- data/lib/jekyll/readers/post_reader.rb +72 -0
- data/lib/jekyll/readers/static_file_reader.rb +25 -0
- data/lib/jekyll/readers/theme_assets_reader.rb +49 -0
- data/lib/jekyll/regenerator.rb +201 -0
- data/lib/jekyll/related_posts.rb +52 -0
- data/lib/jekyll/renderer.rb +269 -0
- data/lib/jekyll/site.rb +471 -0
- data/lib/jekyll/static_file.rb +162 -0
- data/lib/jekyll/stevenson.rb +61 -0
- data/lib/jekyll/tags/highlight.rb +141 -0
- data/lib/jekyll/tags/include.rb +215 -0
- data/lib/jekyll/tags/link.rb +37 -0
- data/lib/jekyll/tags/post_url.rb +103 -0
- data/lib/jekyll/theme.rb +68 -0
- data/lib/jekyll/theme_builder.rb +119 -0
- data/lib/jekyll/url.rb +161 -0
- data/lib/jekyll/utils.rb +337 -0
- data/lib/jekyll/utils/ansi.rb +59 -0
- data/lib/jekyll/utils/exec.rb +27 -0
- data/lib/jekyll/utils/platforms.rb +82 -0
- data/lib/jekyll/utils/rouge.rb +21 -0
- data/lib/jekyll/utils/win_tz.rb +75 -0
- data/lib/jekyll/version.rb +5 -0
- data/lib/site_template/404.html +24 -0
- data/lib/site_template/_config.yml +43 -0
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +25 -0
- data/lib/site_template/about.md +18 -0
- data/lib/site_template/index.md +6 -0
- data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
- data/lib/theme_template/Gemfile +4 -0
- data/lib/theme_template/LICENSE.txt.erb +21 -0
- data/lib/theme_template/README.md.erb +52 -0
- data/lib/theme_template/_layouts/default.html +1 -0
- data/lib/theme_template/_layouts/page.html +5 -0
- data/lib/theme_template/_layouts/post.html +5 -0
- data/lib/theme_template/example/_config.yml.erb +1 -0
- data/lib/theme_template/example/_post.md +12 -0
- data/lib/theme_template/example/index.html +14 -0
- data/lib/theme_template/example/style.scss +7 -0
- data/lib/theme_template/gitignore.erb +5 -0
- data/lib/theme_template/theme.gemspec.erb +19 -0
- metadata +103 -156
- data/lib/jekyll-docs.rb +0 -31
- data/site/404.html +0 -153
- data/site/CNAME +0 -1
- data/site/community/index.html +0 -299
- data/site/conduct/index.html +0 -10
- data/site/css/screen.css +0 -1
- data/site/docs/assets/index.html +0 -724
- data/site/docs/code_of_conduct/index.html +0 -730
- data/site/docs/collections/index.html +0 -1097
- data/site/docs/conduct/index.html +0 -744
- data/site/docs/configuration/index.html +0 -1403
- data/site/docs/continuous-integration/buddyworks/index.html +0 -726
- data/site/docs/continuous-integration/circleci/index.html +0 -757
- data/site/docs/continuous-integration/index.html +0 -681
- data/site/docs/continuous-integration/travis-ci/index.html +0 -891
- data/site/docs/contributing/index.html +0 -863
- data/site/docs/datafiles/index.html +0 -780
- data/site/docs/deployment-methods/index.html +0 -875
- data/site/docs/drafts/index.html +0 -636
- data/site/docs/extras/index.html +0 -689
- data/site/docs/frontmatter/index.html +0 -807
- data/site/docs/github-pages/index.html +0 -819
- data/site/docs/history/index.html +0 -3955
- data/site/docs/home/index.html +0 -644
- data/site/docs/includes/index.html +0 -800
- data/site/docs/index.html +0 -10
- data/site/docs/installation/index.html +0 -732
- data/site/docs/maintaining/affinity-team-captain/index.html +0 -706
- data/site/docs/maintaining/avoiding-burnout/index.html +0 -709
- data/site/docs/maintaining/becoming-a-maintainer/index.html +0 -717
- data/site/docs/maintaining/index.html +0 -713
- data/site/docs/maintaining/merging-a-pull-request/index.html +0 -747
- data/site/docs/maintaining/reviewing-a-pull-request/index.html +0 -725
- data/site/docs/maintaining/special-labels/index.html +0 -705
- data/site/docs/maintaining/triaging-an-issue/index.html +0 -735
- data/site/docs/migrations/index.html +0 -647
- data/site/docs/pages/index.html +0 -695
- data/site/docs/pagination/index.html +0 -870
- data/site/docs/permalinks/index.html +0 -1027
- data/site/docs/plugins/index.html +0 -1800
- data/site/docs/posts/index.html +0 -858
- data/site/docs/quickstart/index.html +0 -650
- data/site/docs/resources/index.html +0 -769
- data/site/docs/sites/index.html +0 -702
- data/site/docs/static-files/index.html +0 -720
- data/site/docs/structure/index.html +0 -822
- data/site/docs/templates/index.html +0 -1208
- data/site/docs/themes/index.html +0 -935
- data/site/docs/troubleshooting/index.html +0 -893
- data/site/docs/upgrading/0-to-2/index.html +0 -826
- data/site/docs/upgrading/2-to-3/index.html +0 -824
- data/site/docs/upgrading/index.html +0 -693
- data/site/docs/usage/index.html +0 -705
- data/site/docs/variables/index.html +0 -1048
- data/site/docs/windows/index.html +0 -799
- data/site/favicon.ico +0 -0
- data/site/feed.xml +0 -372
- data/site/fonts/FontAwesome.eot +0 -0
- data/site/fonts/FontAwesome.svg +0 -12
- data/site/fonts/FontAwesome.ttf +0 -0
- data/site/fonts/FontAwesome.woff +0 -0
- data/site/github.html +0 -10
- data/site/help/index.html +0 -244
- data/site/icomoon-selection.json +0 -96
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/jekyll-sticker.jpg +0 -0
- data/site/img/jekylllayoutconcept.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/logo-rss.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/index.html +0 -267
- data/site/issues.html +0 -10
- data/site/js/html5shiv.min.js +0 -4
- data/site/js/respond.min.js +0 -5
- data/site/latest_version.txt +0 -1
- data/site/news/2013/05/05/jekyll-1-0-0-released/index.html +0 -570
- data/site/news/2013/05/08/jekyll-1-0-1-released/index.html +0 -570
- data/site/news/2013/05/12/jekyll-1-0-2-released/index.html +0 -571
- data/site/news/2013/06/07/jekyll-1-0-3-released/index.html +0 -568
- data/site/news/2013/07/14/jekyll-1-1-0-released/index.html +0 -570
- data/site/news/2013/07/24/jekyll-1-1-1-released/index.html +0 -569
- data/site/news/2013/07/25/jekyll-1-0-4-released/index.html +0 -565
- data/site/news/2013/07/25/jekyll-1-1-2-released/index.html +0 -565
- data/site/news/2013/09/06/jekyll-1-2-0-released/index.html +0 -572
- data/site/news/2013/09/14/jekyll-1-2-1-released/index.html +0 -566
- data/site/news/2013/10/28/jekyll-1-3-0-rc1-released/index.html +0 -564
- data/site/news/2013/11/04/jekyll-1-3-0-released/index.html +0 -599
- data/site/news/2013/11/26/jekyll-1-3-1-released/index.html +0 -568
- data/site/news/2013/12/07/jekyll-1-4-0-released/index.html +0 -583
- data/site/news/2013/12/09/jekyll-1-4-1-released/index.html +0 -565
- data/site/news/2013/12/16/jekyll-1-4-2-released/index.html +0 -564
- data/site/news/2014/01/13/jekyll-1-4-3-released/index.html +0 -573
- data/site/news/2014/03/24/jekyll-1-5-0-released/index.html +0 -564
- data/site/news/2014/03/27/jekyll-1-5-1-released/index.html +0 -569
- data/site/news/2014/05/06/jekyll-turns-2-0-0/index.html +0 -585
- data/site/news/2014/05/08/jekyll-2-0-3-released/index.html +0 -565
- data/site/news/2014/06/04/jekyll-stickers-1-dollar-stickermule/index.html +0 -567
- data/site/news/2014/06/28/jekyll-turns-21-i-mean-2-1-0/index.html +0 -582
- data/site/news/2014/07/01/jekyll-2-1-1-released/index.html +0 -579
- data/site/news/2014/07/29/jekyll-2-2-0-released/index.html +0 -568
- data/site/news/2014/08/10/jekyll-2-3-0-released/index.html +0 -588
- data/site/news/2014/09/09/jekyll-2-4-0-released/index.html +0 -574
- data/site/news/2014/11/05/jekylls-midlife-crisis-jekyll-turns-2-5-0/index.html +0 -597
- data/site/news/2014/11/09/jekyll-2-5-1-released/index.html +0 -575
- data/site/news/2014/11/12/jekyll-2-5-2-released/index.html +0 -565
- data/site/news/2014/12/17/alfredxing-welcome-to-jekyll-core/index.html +0 -572
- data/site/news/2014/12/22/jekyll-2-5-3-released/index.html +0 -567
- data/site/news/2015/01/20/jekyll-meet-and-greet/index.html +0 -568
- data/site/news/2015/01/24/jekyll-3-0-0-beta1-released/index.html +0 -588
- data/site/news/2015/02/26/introducing-jekyll-talk/index.html +0 -563
- data/site/news/2015/10/26/jekyll-3-0-released/index.html +0 -592
- data/site/news/2015/11/17/jekyll-3-0-1-released/index.html +0 -576
- data/site/news/2016/01/20/jekyll-3-0-2-released/index.html +0 -566
- data/site/news/2016/01/24/jekyll-3-1-0-released/index.html +0 -599
- data/site/news/2016/01/28/jekyll-3-1-1-released/index.html +0 -583
- data/site/news/2016/02/08/jekyll-3-0-3-released/index.html +0 -578
- data/site/news/2016/02/19/jekyll-3-1-2-released/index.html +0 -569
- data/site/news/2016/03/10/making-it-easier-to-contribute-to-jekyll/index.html +0 -565
- data/site/news/2016/04/19/jekyll-3-0-4-released/index.html +0 -571
- data/site/news/2016/04/19/jekyll-3-1-3-released/index.html +0 -566
- data/site/news/2016/04/26/jekyll-3-0-5-released/index.html +0 -572
- data/site/news/2016/05/18/jekyll-3-1-4-released/index.html +0 -576
- data/site/news/2016/05/18/jekyll-3-1-5-released/index.html +0 -564
- data/site/news/2016/05/19/jekyll-3-1-6-released/index.html +0 -566
- data/site/news/2016/06/03/update-on-jekyll-s-google-summer-of-code-projects/index.html +0 -567
- data/site/news/2016/07/26/jekyll-3-2-0-released/index.html +0 -676
- data/site/news/2016/08/02/jekyll-3-2-1-released/index.html +0 -571
- data/site/news/2016/08/24/jekyll-admin-initial-release/index.html +0 -566
- data/site/news/2016/10/06/jekyll-3-3-is-here/index.html +0 -645
- data/site/news/2016/11/14/jekyll-3-3-1-released/index.html +0 -569
- data/site/news/2017/01/18/jekyll-3-4-0-released/index.html +0 -592
- data/site/news/2017/03/02/jekyll-3-4-1-released/index.html +0 -649
- data/site/news/2017/03/09/jekyll-3-4-2-released/index.html +0 -598
- data/site/news/2017/03/21/jekyll-3-4-3-released/index.html +0 -594
- data/site/news/2017/06/15/jekyll-3-5-0-released/index.html +0 -589
- data/site/news/2017/07/17/jekyll-3-5-1-released/index.html +0 -569
- data/site/news/2017/08/12/jekyll-3-5-2-released/index.html +0 -573
- data/site/news/2017/09/21/jekyll-3-6-0-released/index.html +0 -565
- data/site/news/index.html +0 -3609
- data/site/news/releases/index.html +0 -3344
- data/site/philosophy.html +0 -46
- data/site/readme.md +0 -23
- data/site/robots.txt +0 -1
- data/site/sitemap.xml +0 -485
- data/site/tutorials/convert-site-to-jekyll/index.html +0 -793
- data/site/tutorials/custom-404-page/index.html +0 -358
- data/site/tutorials/home/index.html +0 -323
- data/site/tutorials/index.html +0 -10
- data/site/tutorials/navigation/index.html +0 -872
- data/site/tutorials/orderofinterpretation/index.html +0 -441
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "erb"
|
4
|
+
|
5
|
+
class Jekyll::Commands::NewTheme < Jekyll::Command
|
6
|
+
class << self
|
7
|
+
def init_with_program(prog)
|
8
|
+
prog.command(:"new-theme") do |c|
|
9
|
+
c.syntax "new-theme NAME"
|
10
|
+
c.description "Creates a new Jekyll theme scaffold"
|
11
|
+
c.option "code_of_conduct", \
|
12
|
+
"-c", "--code-of-conduct", \
|
13
|
+
"Include a Code of Conduct. (defaults to false)"
|
14
|
+
|
15
|
+
c.action do |args, opts|
|
16
|
+
Jekyll::Commands::NewTheme.process(args, opts)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# rubocop:disable Metrics/AbcSize
|
22
|
+
def process(args, opts)
|
23
|
+
if !args || args.empty?
|
24
|
+
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
|
25
|
+
end
|
26
|
+
|
27
|
+
new_theme_name = args.join("_")
|
28
|
+
theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
|
29
|
+
if theme.path.exist?
|
30
|
+
Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists."
|
31
|
+
end
|
32
|
+
|
33
|
+
theme.create!
|
34
|
+
Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
|
35
|
+
" is ready for you in #{theme.path.to_s.cyan}!"
|
36
|
+
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
|
37
|
+
end
|
38
|
+
# rubocop:enable Metrics/AbcSize
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Commands
|
5
|
+
class Serve < Command
|
6
|
+
class << self
|
7
|
+
COMMAND_OPTIONS = {
|
8
|
+
"ssl_cert" => ["--ssl-cert [CERT]", "X.509 (SSL) certificate."],
|
9
|
+
"host" => ["host", "-H", "--host [HOST]", "Host to bind to"],
|
10
|
+
"open_url" => ["-o", "--open-url", "Launch your site in a browser"],
|
11
|
+
"detach" => ["-B", "--detach", "Run the server in the background"],
|
12
|
+
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
|
13
|
+
"port" => ["-P", "--port [PORT]", "Port to listen on"],
|
14
|
+
"show_dir_listing" => ["--show-dir-listing",
|
15
|
+
"Show a directory listing instead of loading your index file.",],
|
16
|
+
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
|
17
|
+
"Skips the initial site build which occurs before the server is started.",],
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
#
|
21
|
+
|
22
|
+
def init_with_program(prog)
|
23
|
+
prog.command(:serve) do |cmd|
|
24
|
+
cmd.description "Serve your site locally"
|
25
|
+
cmd.syntax "serve [options]"
|
26
|
+
cmd.alias :server
|
27
|
+
cmd.alias :s
|
28
|
+
|
29
|
+
add_build_options(cmd)
|
30
|
+
COMMAND_OPTIONS.each do |key, val|
|
31
|
+
cmd.option key, *val
|
32
|
+
end
|
33
|
+
|
34
|
+
cmd.action do |_, opts|
|
35
|
+
opts["serving"] = true
|
36
|
+
opts["watch" ] = true unless opts.key?("watch")
|
37
|
+
|
38
|
+
config = configuration_from_options(opts)
|
39
|
+
if Jekyll.env == "development"
|
40
|
+
config["url"] = default_url(config)
|
41
|
+
end
|
42
|
+
[Build, Serve].each { |klass| klass.process(config) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
|
49
|
+
def process(opts)
|
50
|
+
opts = configuration_from_options(opts)
|
51
|
+
destination = opts["destination"]
|
52
|
+
setup(destination)
|
53
|
+
|
54
|
+
start_up_webrick(opts, destination)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Do a base pre-setup of WEBRick so that everything is in place
|
58
|
+
# when we get ready to party, checking for an setting up an error page
|
59
|
+
# and making sure our destination exists.
|
60
|
+
|
61
|
+
private
|
62
|
+
def setup(destination)
|
63
|
+
require_relative "serve/servlet"
|
64
|
+
|
65
|
+
FileUtils.mkdir_p(destination)
|
66
|
+
if File.exist?(File.join(destination, "404.html"))
|
67
|
+
WEBrick::HTTPResponse.class_eval do
|
68
|
+
def create_error_page
|
69
|
+
@header["Content-Type"] = "text/html; charset=UTF-8"
|
70
|
+
@body = IO.read(File.join(@config[:DocumentRoot], "404.html"))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
|
78
|
+
private
|
79
|
+
def webrick_opts(opts)
|
80
|
+
opts = {
|
81
|
+
:JekyllOptions => opts,
|
82
|
+
:DoNotReverseLookup => true,
|
83
|
+
:MimeTypes => mime_types,
|
84
|
+
:DocumentRoot => opts["destination"],
|
85
|
+
:StartCallback => start_callback(opts["detach"]),
|
86
|
+
:BindAddress => opts["host"],
|
87
|
+
:Port => opts["port"],
|
88
|
+
:DirectoryIndex => %W(
|
89
|
+
index.htm
|
90
|
+
index.html
|
91
|
+
index.rhtml
|
92
|
+
index.cgi
|
93
|
+
index.xml
|
94
|
+
),
|
95
|
+
}
|
96
|
+
|
97
|
+
opts[:DirectoryIndex] = [] if opts[:JekyllOptions]["show_dir_listing"]
|
98
|
+
|
99
|
+
enable_ssl(opts)
|
100
|
+
enable_logging(opts)
|
101
|
+
opts
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
|
106
|
+
private
|
107
|
+
def start_up_webrick(opts, destination)
|
108
|
+
server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
109
|
+
server.mount(opts["baseurl"].to_s, Servlet, destination, file_handler_opts)
|
110
|
+
Jekyll.logger.info "Server address:", server_address(server, opts)
|
111
|
+
launch_browser server, opts if opts["open_url"]
|
112
|
+
boot_or_detach server, opts
|
113
|
+
end
|
114
|
+
|
115
|
+
# Recreate NondisclosureName under utf-8 circumstance
|
116
|
+
|
117
|
+
private
|
118
|
+
def file_handler_opts
|
119
|
+
WEBrick::Config::FileHandler.merge({
|
120
|
+
:FancyIndexing => true,
|
121
|
+
:NondisclosureName => [
|
122
|
+
".ht*", "~*",
|
123
|
+
],
|
124
|
+
})
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
|
129
|
+
private
|
130
|
+
def server_address(server, options = {})
|
131
|
+
format_url(
|
132
|
+
server.config[:SSLEnable],
|
133
|
+
server.config[:BindAddress],
|
134
|
+
server.config[:Port],
|
135
|
+
options["baseurl"]
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
private
|
140
|
+
def format_url(ssl_enabled, address, port, baseurl = nil)
|
141
|
+
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", {
|
142
|
+
:prefix => ssl_enabled ? "https" : "http",
|
143
|
+
:address => address,
|
144
|
+
:port => port,
|
145
|
+
:baseurl => baseurl ? "#{baseurl}/" : "",
|
146
|
+
})
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
|
151
|
+
private
|
152
|
+
def default_url(opts)
|
153
|
+
config = configuration_from_options(opts)
|
154
|
+
format_url(
|
155
|
+
config["ssl_cert"] && config["ssl_key"],
|
156
|
+
config["host"] == "127.0.0.1" ? "localhost" : config["host"],
|
157
|
+
config["port"]
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
#
|
162
|
+
|
163
|
+
private
|
164
|
+
def launch_browser(server, opts)
|
165
|
+
address = server_address(server, opts)
|
166
|
+
return system "start", address if Utils::Platforms.windows?
|
167
|
+
return system "xdg-open", address if Utils::Platforms.linux?
|
168
|
+
return system "open", address if Utils::Platforms.osx?
|
169
|
+
Jekyll.logger.error "Refusing to launch browser; " \
|
170
|
+
"Platform launcher unknown."
|
171
|
+
end
|
172
|
+
|
173
|
+
# Keep in our area with a thread or detach the server as requested
|
174
|
+
# by the user. This method determines what we do based on what you
|
175
|
+
# ask us to do.
|
176
|
+
|
177
|
+
private
|
178
|
+
def boot_or_detach(server, opts)
|
179
|
+
if opts["detach"]
|
180
|
+
pid = Process.fork do
|
181
|
+
server.start
|
182
|
+
end
|
183
|
+
|
184
|
+
Process.detach(pid)
|
185
|
+
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
|
186
|
+
"Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
|
187
|
+
else
|
188
|
+
t = Thread.new { server.start }
|
189
|
+
trap("INT") { server.shutdown }
|
190
|
+
t.join
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Make the stack verbose if the user requests it.
|
195
|
+
|
196
|
+
private
|
197
|
+
def enable_logging(opts)
|
198
|
+
opts[:AccessLog] = []
|
199
|
+
level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN)
|
200
|
+
opts[:Logger] = WEBrick::Log.new($stdout, level)
|
201
|
+
end
|
202
|
+
|
203
|
+
# Add SSL to the stack if the user triggers --enable-ssl and they
|
204
|
+
# provide both types of certificates commonly needed. Raise if they
|
205
|
+
# forget to add one of the certificates.
|
206
|
+
|
207
|
+
private
|
208
|
+
# rubocop:disable Metrics/AbcSize
|
209
|
+
def enable_ssl(opts)
|
210
|
+
return if !opts[:JekyllOptions]["ssl_cert"] && !opts[:JekyllOptions]["ssl_key"]
|
211
|
+
if !opts[:JekyllOptions]["ssl_cert"] || !opts[:JekyllOptions]["ssl_key"]
|
212
|
+
# rubocop:disable Style/RedundantException
|
213
|
+
raise RuntimeError, "--ssl-cert or --ssl-key missing."
|
214
|
+
end
|
215
|
+
require "openssl"
|
216
|
+
require "webrick/https"
|
217
|
+
source_key = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], \
|
218
|
+
opts[:JekyllOptions]["ssl_key" ])
|
219
|
+
source_certificate = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], \
|
220
|
+
opts[:JekyllOptions]["ssl_cert"])
|
221
|
+
opts[:SSLCertificate] =
|
222
|
+
OpenSSL::X509::Certificate.new(File.read(source_certificate))
|
223
|
+
opts[:SSLPrivateKey ] = OpenSSL::PKey::RSA.new(File.read(source_key))
|
224
|
+
opts[:SSLEnable] = true
|
225
|
+
end
|
226
|
+
|
227
|
+
private
|
228
|
+
|
229
|
+
def start_callback(detached)
|
230
|
+
unless detached
|
231
|
+
proc do
|
232
|
+
Jekyll.logger.info("Server running...", "press ctrl-c to stop.")
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
private
|
238
|
+
def mime_types
|
239
|
+
file = File.expand_path("../mime.types", __dir__)
|
240
|
+
WEBrick::HTTPUtils.load_mime_types(file)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "webrick"
|
4
|
+
|
5
|
+
module Jekyll
|
6
|
+
module Commands
|
7
|
+
class Serve
|
8
|
+
class Servlet < WEBrick::HTTPServlet::FileHandler
|
9
|
+
DEFAULTS = {
|
10
|
+
"Cache-Control" => "private, max-age=0, proxy-revalidate, " \
|
11
|
+
"no-store, no-cache, must-revalidate",
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
def initialize(server, root, callbacks)
|
15
|
+
# So we can access them easily.
|
16
|
+
@jekyll_opts = server.config[:JekyllOptions]
|
17
|
+
set_defaults
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add the ability to tap file.html the same way that Nginx does on our
|
22
|
+
# Docker images (or on GitHub Pages.) The difference is that we might end
|
23
|
+
# up with a different preference on which comes first.
|
24
|
+
|
25
|
+
def search_file(req, res, basename)
|
26
|
+
# /file.* > /file/index.html > /file.html
|
27
|
+
super || super(req, res, ".html") || super(req, res, "#{basename}.html")
|
28
|
+
end
|
29
|
+
|
30
|
+
# rubocop:disable Naming/MethodName
|
31
|
+
def do_GET(req, res)
|
32
|
+
rtn = super
|
33
|
+
validate_and_ensure_charset(req, res)
|
34
|
+
res.header.merge!(@headers)
|
35
|
+
rtn
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
|
40
|
+
private
|
41
|
+
def validate_and_ensure_charset(_req, res)
|
42
|
+
key = res.header.keys.grep(%r!content-type!i).first
|
43
|
+
typ = res.header[key]
|
44
|
+
|
45
|
+
unless typ =~ %r!;\s*charset=!
|
46
|
+
res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
|
52
|
+
private
|
53
|
+
def set_defaults
|
54
|
+
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
|
55
|
+
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
|
56
|
+
hash[key] = val unless hash.key?(key)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,410 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class Configuration < Hash
|
5
|
+
# Default options. Overridden by values in _config.yml.
|
6
|
+
# Strings rather than symbols are used for compatibility with YAML.
|
7
|
+
DEFAULTS = Configuration[{
|
8
|
+
# Where things are
|
9
|
+
"source" => Dir.pwd,
|
10
|
+
"destination" => File.join(Dir.pwd, "_site"),
|
11
|
+
"plugins_dir" => "_plugins",
|
12
|
+
"layouts_dir" => "_layouts",
|
13
|
+
"data_dir" => "_data",
|
14
|
+
"includes_dir" => "_includes",
|
15
|
+
"collections" => {},
|
16
|
+
|
17
|
+
# Handling Reading
|
18
|
+
"safe" => false,
|
19
|
+
"include" => [".htaccess"],
|
20
|
+
"exclude" => %w(
|
21
|
+
Gemfile Gemfile.lock node_modules vendor/bundle/ vendor/cache/ vendor/gems/
|
22
|
+
vendor/ruby/
|
23
|
+
),
|
24
|
+
"keep_files" => [".git", ".svn"],
|
25
|
+
"encoding" => "utf-8",
|
26
|
+
"markdown_ext" => "markdown,mkdown,mkdn,mkd,md",
|
27
|
+
"strict_front_matter" => false,
|
28
|
+
|
29
|
+
# Filtering Content
|
30
|
+
"show_drafts" => nil,
|
31
|
+
"limit_posts" => 0,
|
32
|
+
"future" => false,
|
33
|
+
"unpublished" => false,
|
34
|
+
|
35
|
+
# Plugins
|
36
|
+
"whitelist" => [],
|
37
|
+
"plugins" => [],
|
38
|
+
|
39
|
+
# Conversion
|
40
|
+
"markdown" => "kramdown",
|
41
|
+
"highlighter" => "rouge",
|
42
|
+
"lsi" => false,
|
43
|
+
"excerpt_separator" => "\n\n",
|
44
|
+
"incremental" => false,
|
45
|
+
|
46
|
+
# Serving
|
47
|
+
"detach" => false, # default to not detaching the server
|
48
|
+
"port" => "4000",
|
49
|
+
"host" => "127.0.0.1",
|
50
|
+
"baseurl" => nil, # this mounts at /, i.e. no subdirectory
|
51
|
+
"show_dir_listing" => false,
|
52
|
+
|
53
|
+
# Output Configuration
|
54
|
+
"permalink" => "date",
|
55
|
+
"paginate_path" => "/page:num",
|
56
|
+
"timezone" => nil, # use the local timezone
|
57
|
+
|
58
|
+
"quiet" => false,
|
59
|
+
"verbose" => false,
|
60
|
+
"defaults" => [],
|
61
|
+
|
62
|
+
"liquid" => {
|
63
|
+
"error_mode" => "warn",
|
64
|
+
},
|
65
|
+
|
66
|
+
"rdiscount" => {
|
67
|
+
"extensions" => [],
|
68
|
+
},
|
69
|
+
|
70
|
+
"redcarpet" => {
|
71
|
+
"extensions" => [],
|
72
|
+
},
|
73
|
+
|
74
|
+
"kramdown" => {
|
75
|
+
"auto_ids" => true,
|
76
|
+
"toc_levels" => "1..6",
|
77
|
+
"entity_output" => "as_char",
|
78
|
+
"smart_quotes" => "lsquo,rsquo,ldquo,rdquo",
|
79
|
+
"input" => "GFM",
|
80
|
+
"hard_wrap" => false,
|
81
|
+
"footnote_nr" => 1,
|
82
|
+
},
|
83
|
+
}.map { |k, v| [k, v.freeze] }].freeze
|
84
|
+
|
85
|
+
class << self
|
86
|
+
# Static: Produce a Configuration ready for use in a Site.
|
87
|
+
# It takes the input, fills in the defaults where values do not
|
88
|
+
# exist, and patches common issues including migrating options for
|
89
|
+
# backwards compatiblity. Except where a key or value is being fixed,
|
90
|
+
# the user configuration will override the defaults.
|
91
|
+
#
|
92
|
+
# user_config - a Hash or Configuration of overrides.
|
93
|
+
#
|
94
|
+
# Returns a Configuration filled with defaults and fixed for common
|
95
|
+
# problems and backwards-compatibility.
|
96
|
+
def from(user_config)
|
97
|
+
Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys)
|
98
|
+
.fix_common_issues.add_default_collections
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Public: Turn all keys into string
|
103
|
+
#
|
104
|
+
# Return a copy of the hash where all its keys are strings
|
105
|
+
def stringify_keys
|
106
|
+
reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_config_value_with_override(config_key, override)
|
110
|
+
override[config_key] || self[config_key] || DEFAULTS[config_key]
|
111
|
+
end
|
112
|
+
|
113
|
+
# Public: Directory of the Jekyll source folder
|
114
|
+
#
|
115
|
+
# override - the command-line options hash
|
116
|
+
#
|
117
|
+
# Returns the path to the Jekyll source directory
|
118
|
+
def source(override)
|
119
|
+
get_config_value_with_override("source", override)
|
120
|
+
end
|
121
|
+
|
122
|
+
def quiet(override = {})
|
123
|
+
get_config_value_with_override("quiet", override)
|
124
|
+
end
|
125
|
+
alias_method :quiet?, :quiet
|
126
|
+
|
127
|
+
def verbose(override = {})
|
128
|
+
get_config_value_with_override("verbose", override)
|
129
|
+
end
|
130
|
+
alias_method :verbose?, :verbose
|
131
|
+
|
132
|
+
def safe_load_file(filename)
|
133
|
+
case File.extname(filename)
|
134
|
+
when %r!\.toml!i
|
135
|
+
Jekyll::External.require_with_graceful_fail("toml") unless defined?(TOML)
|
136
|
+
TOML.load_file(filename)
|
137
|
+
when %r!\.ya?ml!i
|
138
|
+
SafeYAML.load_file(filename) || {}
|
139
|
+
else
|
140
|
+
raise ArgumentError, "No parser for '#{filename}' is available.
|
141
|
+
Use a .y(a)ml or .toml file instead."
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Public: Generate list of configuration files from the override
|
146
|
+
#
|
147
|
+
# override - the command-line options hash
|
148
|
+
#
|
149
|
+
# Returns an Array of config files
|
150
|
+
def config_files(override)
|
151
|
+
# Adjust verbosity quickly
|
152
|
+
Jekyll.logger.adjust_verbosity(
|
153
|
+
:quiet => quiet?(override),
|
154
|
+
:verbose => verbose?(override)
|
155
|
+
)
|
156
|
+
|
157
|
+
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
158
|
+
config_files = override["config"]
|
159
|
+
if config_files.to_s.empty?
|
160
|
+
default = %w(yml yaml).find(-> { "yml" }) do |ext|
|
161
|
+
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
162
|
+
end
|
163
|
+
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
164
|
+
@default_config_file = true
|
165
|
+
end
|
166
|
+
config_files = [config_files] unless config_files.is_a? Array
|
167
|
+
config_files
|
168
|
+
end
|
169
|
+
|
170
|
+
# Public: Read configuration and return merged Hash
|
171
|
+
#
|
172
|
+
# file - the path to the YAML file to be read in
|
173
|
+
#
|
174
|
+
# Returns this configuration, overridden by the values in the file
|
175
|
+
def read_config_file(file)
|
176
|
+
next_config = safe_load_file(file)
|
177
|
+
check_config_is_hash!(next_config, file)
|
178
|
+
Jekyll.logger.info "Configuration file:", file
|
179
|
+
next_config
|
180
|
+
rescue SystemCallError
|
181
|
+
if @default_config_file ||= nil
|
182
|
+
Jekyll.logger.warn "Configuration file:", "none"
|
183
|
+
{}
|
184
|
+
else
|
185
|
+
Jekyll.logger.error "Fatal:", "The configuration file '#{file}'
|
186
|
+
could not be found."
|
187
|
+
raise LoadError, "The Configuration file '#{file}' could not be found."
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Public: Read in a list of configuration files and merge with this hash
|
192
|
+
#
|
193
|
+
# files - the list of configuration file paths
|
194
|
+
#
|
195
|
+
# Returns the full configuration, with the defaults overridden by the values in the
|
196
|
+
# configuration files
|
197
|
+
def read_config_files(files)
|
198
|
+
configuration = clone
|
199
|
+
|
200
|
+
begin
|
201
|
+
files.each do |config_file|
|
202
|
+
next if config_file.nil? || config_file.empty?
|
203
|
+
new_config = read_config_file(config_file)
|
204
|
+
configuration = Utils.deep_merge_hashes(configuration, new_config)
|
205
|
+
end
|
206
|
+
rescue ArgumentError => err
|
207
|
+
Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
|
208
|
+
"Using defaults (and options)."
|
209
|
+
$stderr.puts err
|
210
|
+
end
|
211
|
+
|
212
|
+
configuration.fix_common_issues.backwards_compatibilize.add_default_collections
|
213
|
+
end
|
214
|
+
|
215
|
+
# Public: Split a CSV string into an array containing its values
|
216
|
+
#
|
217
|
+
# csv - the string of comma-separated values
|
218
|
+
#
|
219
|
+
# Returns an array of the values contained in the CSV
|
220
|
+
def csv_to_array(csv)
|
221
|
+
csv.split(",").map(&:strip)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Public: Ensure the proper options are set in the configuration to allow for
|
225
|
+
# backwards-compatibility with Jekyll pre-1.0
|
226
|
+
#
|
227
|
+
# Returns the backwards-compatible configuration
|
228
|
+
def backwards_compatibilize
|
229
|
+
config = clone
|
230
|
+
# Provide backwards-compatibility
|
231
|
+
check_auto(config)
|
232
|
+
check_server(config)
|
233
|
+
check_plugins(config)
|
234
|
+
|
235
|
+
renamed_key "server_port", "port", config
|
236
|
+
renamed_key "gems", "plugins", config
|
237
|
+
renamed_key "layouts", "layouts_dir", config
|
238
|
+
renamed_key "data_source", "data_dir", config
|
239
|
+
|
240
|
+
check_pygments(config)
|
241
|
+
check_include_exclude(config)
|
242
|
+
check_coderay(config)
|
243
|
+
check_maruku(config)
|
244
|
+
|
245
|
+
config
|
246
|
+
end
|
247
|
+
|
248
|
+
def fix_common_issues
|
249
|
+
config = clone
|
250
|
+
|
251
|
+
if config.key?("paginate") && (!config["paginate"].is_a?(Integer) ||
|
252
|
+
config["paginate"] < 1)
|
253
|
+
|
254
|
+
Jekyll.logger.warn "Config Warning:", "The `paginate` key must be a positive" \
|
255
|
+
" integer or nil. It's currently set to '#{config["paginate"].inspect}'."
|
256
|
+
config["paginate"] = nil
|
257
|
+
end
|
258
|
+
|
259
|
+
config
|
260
|
+
end
|
261
|
+
|
262
|
+
def add_default_collections
|
263
|
+
config = clone
|
264
|
+
|
265
|
+
# It defaults to `{}`, so this is only if someone sets it to null manually.
|
266
|
+
return config if config["collections"].nil?
|
267
|
+
|
268
|
+
# Ensure we have a hash.
|
269
|
+
if config["collections"].is_a?(Array)
|
270
|
+
config["collections"] = Hash[config["collections"].map { |c| [c, {}] }]
|
271
|
+
end
|
272
|
+
|
273
|
+
config["collections"] = Utils.deep_merge_hashes(
|
274
|
+
{ "posts" => {} }, config["collections"]
|
275
|
+
).tap do |collections|
|
276
|
+
collections["posts"]["output"] = true
|
277
|
+
if config["permalink"]
|
278
|
+
collections["posts"]["permalink"] ||= style_to_permalink(config["permalink"])
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
config
|
283
|
+
end
|
284
|
+
|
285
|
+
def renamed_key(old, new, config, _ = nil)
|
286
|
+
if config.key?(old)
|
287
|
+
Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" \
|
288
|
+
" option has been renamed to '#{new}'. Please update your config" \
|
289
|
+
" file accordingly."
|
290
|
+
config[new] = config.delete(old)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
private
|
295
|
+
def style_to_permalink(permalink_style)
|
296
|
+
case permalink_style.to_sym
|
297
|
+
when :pretty
|
298
|
+
"/:categories/:year/:month/:day/:title/"
|
299
|
+
when :none
|
300
|
+
"/:categories/:title:output_ext"
|
301
|
+
when :date
|
302
|
+
"/:categories/:year/:month/:day/:title:output_ext"
|
303
|
+
when :ordinal
|
304
|
+
"/:categories/:year/:y_day/:title:output_ext"
|
305
|
+
else
|
306
|
+
permalink_style.to_s
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
# Private: Checks if a given config is a hash
|
311
|
+
#
|
312
|
+
# extracted_config - the value to check
|
313
|
+
# file - the file from which the config was extracted
|
314
|
+
#
|
315
|
+
# Raises an ArgumentError if given config is not a hash
|
316
|
+
private
|
317
|
+
def check_config_is_hash!(extracted_config, file)
|
318
|
+
unless extracted_config.is_a?(Hash)
|
319
|
+
raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
private
|
324
|
+
def check_auto(config)
|
325
|
+
if config.key?("auto") || config.key?("watch")
|
326
|
+
Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
|
327
|
+
" be set from your configuration file(s). Use the" \
|
328
|
+
" --[no-]watch/-w command-line option instead."
|
329
|
+
config.delete("auto")
|
330
|
+
config.delete("watch")
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
private
|
335
|
+
def check_server(config)
|
336
|
+
if config.key?("server")
|
337
|
+
Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
|
338
|
+
" is no longer accepted. Use the 'jekyll serve'" \
|
339
|
+
" subcommand to serve your site with WEBrick."
|
340
|
+
config.delete("server")
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
private
|
345
|
+
def check_pygments(config)
|
346
|
+
if config.key?("pygments")
|
347
|
+
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
|
348
|
+
" has been renamed to 'highlighter'. Please update your" \
|
349
|
+
" config file accordingly. The allowed values are 'rouge', " \
|
350
|
+
"'pygments' or null."
|
351
|
+
|
352
|
+
config["highlighter"] = "pygments" if config["pygments"]
|
353
|
+
config.delete("pygments")
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
private
|
358
|
+
def check_include_exclude(config)
|
359
|
+
%w(include exclude).each do |option|
|
360
|
+
if config[option].is_a?(String)
|
361
|
+
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
|
362
|
+
" must now be specified as an array, but you specified" \
|
363
|
+
" a string. For now, we've treated the string you provided" \
|
364
|
+
" as a list of comma-separated values."
|
365
|
+
config[option] = csv_to_array(config[option])
|
366
|
+
end
|
367
|
+
config[option].map!(&:to_s) if config[option]
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
private
|
372
|
+
def check_coderay(config)
|
373
|
+
if (config["kramdown"] || {}).key?("use_coderay")
|
374
|
+
Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
|
375
|
+
" to 'enable_coderay' in your configuration file."
|
376
|
+
config["kramdown"]["use_coderay"] = config["kramdown"].delete("enable_coderay")
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
private
|
381
|
+
def check_maruku(config)
|
382
|
+
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
|
383
|
+
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
|
384
|
+
"Markdown processor, which has been removed as of 3.0.0. " \
|
385
|
+
"We recommend you switch to Kramdown. To do this, replace " \
|
386
|
+
"`markdown: maruku` with `markdown: kramdown` in your " \
|
387
|
+
"`_config.yml` file."
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
# Private: Checks if the `plugins` config is a String
|
392
|
+
#
|
393
|
+
# config - the config hash
|
394
|
+
#
|
395
|
+
# Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins`
|
396
|
+
# is a string
|
397
|
+
private
|
398
|
+
def check_plugins(config)
|
399
|
+
if config.key?("plugins") && config["plugins"].is_a?(String)
|
400
|
+
Jekyll.logger.error "Configuration Error:", "You specified the" \
|
401
|
+
" `plugins` config in your configuration file as a string, please" \
|
402
|
+
" use an array instead. If you wanted to set the directory of your" \
|
403
|
+
" plugins, use the config key `plugins_dir` instead."
|
404
|
+
raise Jekyll::Errors::InvalidConfigurationError,
|
405
|
+
"'plugins' should not be a string, but was: " \
|
406
|
+
"#{config["plugins"].inspect}. Use 'plugins_dir' instead."
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|