jekyll 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +350 -347
  3. data/LICENSE +21 -21
  4. data/README.markdown +86 -86
  5. data/exe/jekyll +57 -57
  6. data/lib/blank_template/_config.yml +3 -3
  7. data/lib/blank_template/_layouts/default.html +12 -12
  8. data/lib/blank_template/_sass/main.scss +9 -9
  9. data/lib/blank_template/assets/css/main.scss +4 -4
  10. data/lib/blank_template/index.md +8 -8
  11. data/lib/jekyll/cache.rb +190 -190
  12. data/lib/jekyll/cleaner.rb +111 -111
  13. data/lib/jekyll/collection.rb +309 -309
  14. data/lib/jekyll/command.rb +105 -105
  15. data/lib/jekyll/commands/build.rb +93 -93
  16. data/lib/jekyll/commands/clean.rb +45 -45
  17. data/lib/jekyll/commands/doctor.rb +177 -177
  18. data/lib/jekyll/commands/help.rb +34 -34
  19. data/lib/jekyll/commands/new.rb +169 -169
  20. data/lib/jekyll/commands/new_theme.rb +40 -40
  21. data/lib/jekyll/commands/serve/live_reload_reactor.rb +122 -122
  22. data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
  23. data/lib/jekyll/commands/serve/servlet.rb +202 -202
  24. data/lib/jekyll/commands/serve/websockets.rb +81 -81
  25. data/lib/jekyll/commands/serve.rb +362 -365
  26. data/lib/jekyll/configuration.rb +313 -313
  27. data/lib/jekyll/converter.rb +54 -54
  28. data/lib/jekyll/converters/identity.rb +41 -41
  29. data/lib/jekyll/converters/markdown/kramdown_parser.rb +199 -199
  30. data/lib/jekyll/converters/markdown.rb +113 -113
  31. data/lib/jekyll/converters/smartypants.rb +70 -70
  32. data/lib/jekyll/convertible.rb +257 -260
  33. data/lib/jekyll/deprecator.rb +50 -50
  34. data/lib/jekyll/document.rb +544 -544
  35. data/lib/jekyll/drops/collection_drop.rb +20 -20
  36. data/lib/jekyll/drops/document_drop.rb +70 -70
  37. data/lib/jekyll/drops/drop.rb +293 -293
  38. data/lib/jekyll/drops/excerpt_drop.rb +19 -19
  39. data/lib/jekyll/drops/jekyll_drop.rb +32 -32
  40. data/lib/jekyll/drops/site_drop.rb +66 -66
  41. data/lib/jekyll/drops/static_file_drop.rb +14 -14
  42. data/lib/jekyll/drops/unified_payload_drop.rb +26 -26
  43. data/lib/jekyll/drops/url_drop.rb +140 -140
  44. data/lib/jekyll/entry_filter.rb +121 -121
  45. data/lib/jekyll/errors.rb +20 -20
  46. data/lib/jekyll/excerpt.rb +201 -201
  47. data/lib/jekyll/external.rb +79 -79
  48. data/lib/jekyll/filters/date_filters.rb +110 -110
  49. data/lib/jekyll/filters/grouping_filters.rb +64 -64
  50. data/lib/jekyll/filters/url_filters.rb +98 -98
  51. data/lib/jekyll/filters.rb +535 -535
  52. data/lib/jekyll/frontmatter_defaults.rb +240 -240
  53. data/lib/jekyll/generator.rb +5 -5
  54. data/lib/jekyll/hooks.rb +107 -107
  55. data/lib/jekyll/inclusion.rb +32 -32
  56. data/lib/jekyll/layout.rb +67 -67
  57. data/lib/jekyll/liquid_extensions.rb +22 -22
  58. data/lib/jekyll/liquid_renderer/file.rb +77 -77
  59. data/lib/jekyll/liquid_renderer/table.rb +55 -55
  60. data/lib/jekyll/liquid_renderer.rb +80 -80
  61. data/lib/jekyll/log_adapter.rb +151 -151
  62. data/lib/jekyll/mime.types +866 -866
  63. data/lib/jekyll/page.rb +217 -217
  64. data/lib/jekyll/page_excerpt.rb +25 -25
  65. data/lib/jekyll/page_without_a_file.rb +14 -14
  66. data/lib/jekyll/path_manager.rb +74 -74
  67. data/lib/jekyll/plugin.rb +92 -92
  68. data/lib/jekyll/plugin_manager.rb +115 -115
  69. data/lib/jekyll/profiler.rb +58 -58
  70. data/lib/jekyll/publisher.rb +23 -23
  71. data/lib/jekyll/reader.rb +192 -192
  72. data/lib/jekyll/readers/collection_reader.rb +23 -23
  73. data/lib/jekyll/readers/data_reader.rb +79 -79
  74. data/lib/jekyll/readers/layout_reader.rb +62 -62
  75. data/lib/jekyll/readers/page_reader.rb +25 -25
  76. data/lib/jekyll/readers/post_reader.rb +85 -85
  77. data/lib/jekyll/readers/static_file_reader.rb +25 -25
  78. data/lib/jekyll/readers/theme_assets_reader.rb +52 -52
  79. data/lib/jekyll/regenerator.rb +195 -195
  80. data/lib/jekyll/related_posts.rb +52 -52
  81. data/lib/jekyll/renderer.rb +265 -265
  82. data/lib/jekyll/site.rb +551 -551
  83. data/lib/jekyll/static_file.rb +208 -208
  84. data/lib/jekyll/stevenson.rb +60 -60
  85. data/lib/jekyll/tags/highlight.rb +110 -110
  86. data/lib/jekyll/tags/include.rb +275 -270
  87. data/lib/jekyll/tags/link.rb +42 -42
  88. data/lib/jekyll/tags/post_url.rb +106 -106
  89. data/lib/jekyll/theme.rb +86 -86
  90. data/lib/jekyll/theme_builder.rb +121 -121
  91. data/lib/jekyll/url.rb +167 -167
  92. data/lib/jekyll/utils/ansi.rb +57 -57
  93. data/lib/jekyll/utils/exec.rb +26 -26
  94. data/lib/jekyll/utils/internet.rb +37 -37
  95. data/lib/jekyll/utils/platforms.rb +67 -67
  96. data/lib/jekyll/utils/thread_event.rb +31 -31
  97. data/lib/jekyll/utils/win_tz.rb +75 -75
  98. data/lib/jekyll/utils.rb +367 -367
  99. data/lib/jekyll/version.rb +5 -5
  100. data/lib/jekyll.rb +195 -195
  101. data/lib/site_template/.gitignore +5 -5
  102. data/lib/site_template/404.html +25 -25
  103. data/lib/site_template/_config.yml +55 -55
  104. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -29
  105. data/lib/site_template/about.markdown +18 -18
  106. data/lib/site_template/index.markdown +6 -6
  107. data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -74
  108. data/lib/theme_template/Gemfile +4 -4
  109. data/lib/theme_template/LICENSE.txt.erb +21 -21
  110. data/lib/theme_template/README.md.erb +52 -52
  111. data/lib/theme_template/_layouts/default.html +1 -1
  112. data/lib/theme_template/_layouts/page.html +5 -5
  113. data/lib/theme_template/_layouts/post.html +5 -5
  114. data/lib/theme_template/example/_config.yml.erb +1 -1
  115. data/lib/theme_template/example/_post.md +12 -12
  116. data/lib/theme_template/example/index.html +14 -14
  117. data/lib/theme_template/example/style.scss +7 -7
  118. data/lib/theme_template/gitignore.erb +6 -6
  119. data/lib/theme_template/theme.gemspec.erb +16 -16
  120. data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -149
  121. data/rubocop/jekyll/no_p_allowed.rb +23 -23
  122. data/rubocop/jekyll/no_puts_allowed.rb +23 -23
  123. data/rubocop/jekyll.rb +5 -5
  124. metadata +3 -3
@@ -1,113 +1,113 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module Converters
5
- # Markdown converter.
6
- # For more info on converters see https://jekyllrb.com/docs/plugins/converters/
7
- class Markdown < Converter
8
- highlighter_prefix "\n"
9
- highlighter_suffix "\n"
10
- safe true
11
-
12
- def setup
13
- return if @setup ||= false
14
-
15
- unless (@parser = get_processor)
16
- if @config["safe"]
17
- Jekyll.logger.warn "Build Warning:", "Custom processors are not loaded in safe mode"
18
- end
19
-
20
- Jekyll.logger.error "Markdown processor:",
21
- "#{@config["markdown"].inspect} is not a valid Markdown processor."
22
- Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
23
- Jekyll.logger.error ""
24
- raise Errors::FatalException, "Invalid Markdown processor given: #{@config["markdown"]}"
25
- end
26
-
27
- @cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
28
- @setup = true
29
- end
30
-
31
- # RuboCop does not allow reader methods to have names starting with `get_`
32
- # To ensure compatibility, this check has been disabled on this method
33
- #
34
- # rubocop:disable Naming/AccessorMethodName
35
- def get_processor
36
- case @config["markdown"].downcase
37
- when "kramdown" then KramdownParser.new(@config)
38
- else
39
- custom_processor
40
- end
41
- end
42
- # rubocop:enable Naming/AccessorMethodName
43
-
44
- # Public: Provides you with a list of processors comprised of the ones we support internally
45
- # and the ones that you have provided to us (if they're whitelisted for use in safe mode).
46
- #
47
- # Returns an array of symbols.
48
- def valid_processors
49
- [:kramdown] + third_party_processors
50
- end
51
-
52
- # Public: A list of processors that you provide via plugins.
53
- #
54
- # Returns an array of symbols
55
- def third_party_processors
56
- self.class.constants - [:KramdownParser, :PRIORITIES]
57
- end
58
-
59
- # Does the given extension match this converter's list of acceptable extensions?
60
- # Takes one argument: the file's extension (including the dot).
61
- #
62
- # ext - The String extension to check.
63
- #
64
- # Returns true if it matches, false otherwise.
65
- def matches(ext)
66
- extname_list.include?(ext.downcase)
67
- end
68
-
69
- # Public: The extension to be given to the output file (including the dot).
70
- #
71
- # ext - The String extension or original file.
72
- #
73
- # Returns The String output file extension.
74
- def output_ext(_ext)
75
- ".html"
76
- end
77
-
78
- # Logic to do the content conversion.
79
- #
80
- # content - String content of file (without front matter).
81
- #
82
- # Returns a String of the converted content.
83
- def convert(content)
84
- setup
85
- @cache.getset(content) do
86
- @parser.convert(content)
87
- end
88
- end
89
-
90
- def extname_list
91
- @extname_list ||= @config["markdown_ext"].split(",").map! { |e| ".#{e.downcase}" }
92
- end
93
-
94
- private
95
-
96
- def custom_processor
97
- converter_name = @config["markdown"]
98
- self.class.const_get(converter_name).new(@config) if custom_class_allowed?(converter_name)
99
- end
100
-
101
- # Private: Determine whether a class name is an allowed custom
102
- # markdown class name.
103
- #
104
- # parser_name - the name of the parser class
105
- #
106
- # Returns true if the parser name contains only alphanumeric characters and is defined
107
- # within Jekyll::Converters::Markdown
108
- def custom_class_allowed?(parser_name)
109
- parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(parser_name.to_sym)
110
- end
111
- end
112
- end
113
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Converters
5
+ # Markdown converter.
6
+ # For more info on converters see https://jekyllrb.com/docs/plugins/converters/
7
+ class Markdown < Converter
8
+ highlighter_prefix "\n"
9
+ highlighter_suffix "\n"
10
+ safe true
11
+
12
+ def setup
13
+ return if @setup ||= false
14
+
15
+ unless (@parser = get_processor)
16
+ if @config["safe"]
17
+ Jekyll.logger.warn "Build Warning:", "Custom processors are not loaded in safe mode"
18
+ end
19
+
20
+ Jekyll.logger.error "Markdown processor:",
21
+ "#{@config["markdown"].inspect} is not a valid Markdown processor."
22
+ Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
23
+ Jekyll.logger.error ""
24
+ raise Errors::FatalException, "Invalid Markdown processor given: #{@config["markdown"]}"
25
+ end
26
+
27
+ @cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
28
+ @setup = true
29
+ end
30
+
31
+ # RuboCop does not allow reader methods to have names starting with `get_`
32
+ # To ensure compatibility, this check has been disabled on this method
33
+ #
34
+ # rubocop:disable Naming/AccessorMethodName
35
+ def get_processor
36
+ case @config["markdown"].downcase
37
+ when "kramdown" then KramdownParser.new(@config)
38
+ else
39
+ custom_processor
40
+ end
41
+ end
42
+ # rubocop:enable Naming/AccessorMethodName
43
+
44
+ # Public: Provides you with a list of processors comprised of the ones we support internally
45
+ # and the ones that you have provided to us (if they're whitelisted for use in safe mode).
46
+ #
47
+ # Returns an array of symbols.
48
+ def valid_processors
49
+ [:kramdown] + third_party_processors
50
+ end
51
+
52
+ # Public: A list of processors that you provide via plugins.
53
+ #
54
+ # Returns an array of symbols
55
+ def third_party_processors
56
+ self.class.constants - [:KramdownParser, :PRIORITIES]
57
+ end
58
+
59
+ # Does the given extension match this converter's list of acceptable extensions?
60
+ # Takes one argument: the file's extension (including the dot).
61
+ #
62
+ # ext - The String extension to check.
63
+ #
64
+ # Returns true if it matches, false otherwise.
65
+ def matches(ext)
66
+ extname_list.include?(ext.downcase)
67
+ end
68
+
69
+ # Public: The extension to be given to the output file (including the dot).
70
+ #
71
+ # ext - The String extension or original file.
72
+ #
73
+ # Returns The String output file extension.
74
+ def output_ext(_ext)
75
+ ".html"
76
+ end
77
+
78
+ # Logic to do the content conversion.
79
+ #
80
+ # content - String content of file (without front matter).
81
+ #
82
+ # Returns a String of the converted content.
83
+ def convert(content)
84
+ setup
85
+ @cache.getset(content) do
86
+ @parser.convert(content)
87
+ end
88
+ end
89
+
90
+ def extname_list
91
+ @extname_list ||= @config["markdown_ext"].split(",").map! { |e| ".#{e.downcase}" }
92
+ end
93
+
94
+ private
95
+
96
+ def custom_processor
97
+ converter_name = @config["markdown"]
98
+ self.class.const_get(converter_name).new(@config) if custom_class_allowed?(converter_name)
99
+ end
100
+
101
+ # Private: Determine whether a class name is an allowed custom
102
+ # markdown class name.
103
+ #
104
+ # parser_name - the name of the parser class
105
+ #
106
+ # Returns true if the parser name contains only alphanumeric characters and is defined
107
+ # within Jekyll::Converters::Markdown
108
+ def custom_class_allowed?(parser_name)
109
+ parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(parser_name.to_sym)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -1,70 +1,70 @@
1
- # frozen_string_literal: true
2
-
3
- module Kramdown
4
- module Parser
5
- class SmartyPants < Kramdown::Parser::Kramdown
6
- def initialize(source, options)
7
- super
8
- @block_parsers = [:block_html, :content]
9
- @span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
10
- end
11
-
12
- def parse_content
13
- add_text @src.scan(%r!\A.*\n!)
14
- end
15
- define_parser(:content, %r!\A!)
16
- end
17
- end
18
- end
19
-
20
- module Jekyll
21
- module Converters
22
- # SmartyPants converter.
23
- # For more info on converters see https://jekyllrb.com/docs/plugins/converters/
24
- class SmartyPants < Converter
25
- safe true
26
- priority :low
27
-
28
- def initialize(config)
29
- Jekyll::External.require_with_graceful_fail "kramdown" unless defined?(Kramdown)
30
- @config = config["kramdown"].dup || {}
31
- @config[:input] = :SmartyPants
32
- end
33
-
34
- # Does the given extension match this converter's list of acceptable extensions?
35
- # Takes one argument: the file's extension (including the dot).
36
- #
37
- # ext - The String extension to check.
38
- #
39
- # Returns true if it matches, false otherwise.
40
- def matches(_ext)
41
- false
42
- end
43
-
44
- # Public: The extension to be given to the output file (including the dot).
45
- #
46
- # ext - The String extension or original file.
47
- #
48
- # Returns The String output file extension.
49
- def output_ext(_ext)
50
- nil
51
- end
52
-
53
- # Logic to do the content conversion.
54
- #
55
- # content - String content of file (without front matter).
56
- #
57
- # Returns a String of the converted content.
58
- def convert(content)
59
- document = Kramdown::Document.new(content, @config)
60
- html_output = document.to_html.chomp
61
- if @config["show_warnings"]
62
- document.warnings.each do |warning|
63
- Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
64
- end
65
- end
66
- html_output
67
- end
68
- end
69
- end
70
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Kramdown
4
+ module Parser
5
+ class SmartyPants < Kramdown::Parser::Kramdown
6
+ def initialize(source, options)
7
+ super
8
+ @block_parsers = [:block_html, :content]
9
+ @span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
10
+ end
11
+
12
+ def parse_content
13
+ add_text @src.scan(%r!\A.*\n!)
14
+ end
15
+ define_parser(:content, %r!\A!)
16
+ end
17
+ end
18
+ end
19
+
20
+ module Jekyll
21
+ module Converters
22
+ # SmartyPants converter.
23
+ # For more info on converters see https://jekyllrb.com/docs/plugins/converters/
24
+ class SmartyPants < Converter
25
+ safe true
26
+ priority :low
27
+
28
+ def initialize(config)
29
+ Jekyll::External.require_with_graceful_fail "kramdown" unless defined?(Kramdown)
30
+ @config = config["kramdown"].dup || {}
31
+ @config[:input] = :SmartyPants
32
+ end
33
+
34
+ # Does the given extension match this converter's list of acceptable extensions?
35
+ # Takes one argument: the file's extension (including the dot).
36
+ #
37
+ # ext - The String extension to check.
38
+ #
39
+ # Returns true if it matches, false otherwise.
40
+ def matches(_ext)
41
+ false
42
+ end
43
+
44
+ # Public: The extension to be given to the output file (including the dot).
45
+ #
46
+ # ext - The String extension or original file.
47
+ #
48
+ # Returns The String output file extension.
49
+ def output_ext(_ext)
50
+ nil
51
+ end
52
+
53
+ # Logic to do the content conversion.
54
+ #
55
+ # content - String content of file (without front matter).
56
+ #
57
+ # Returns a String of the converted content.
58
+ def convert(content)
59
+ document = Kramdown::Document.new(content, @config)
60
+ html_output = document.to_html.chomp
61
+ if @config["show_warnings"]
62
+ document.warnings.each do |warning|
63
+ Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
64
+ end
65
+ end
66
+ html_output
67
+ end
68
+ end
69
+ end
70
+ end