jekyll 4.2.0 → 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 -347
- data/LICENSE +21 -21
- data/README.markdown +86 -86
- 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 -105
- data/lib/jekyll/commands/build.rb +93 -93
- data/lib/jekyll/commands/clean.rb +45 -45
- data/lib/jekyll/commands/doctor.rb +177 -177
- data/lib/jekyll/commands/help.rb +34 -34
- data/lib/jekyll/commands/new.rb +169 -169
- data/lib/jekyll/commands/new_theme.rb +40 -40
- 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 -365
- data/lib/jekyll/configuration.rb +313 -313
- data/lib/jekyll/converter.rb +54 -54
- data/lib/jekyll/converters/identity.rb +41 -41
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +199 -199
- data/lib/jekyll/converters/markdown.rb +113 -113
- data/lib/jekyll/converters/smartypants.rb +70 -70
- data/lib/jekyll/convertible.rb +257 -260
- data/lib/jekyll/deprecator.rb +50 -50
- data/lib/jekyll/document.rb +544 -544
- data/lib/jekyll/drops/collection_drop.rb +20 -20
- data/lib/jekyll/drops/document_drop.rb +70 -70
- data/lib/jekyll/drops/drop.rb +293 -293
- 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 -140
- data/lib/jekyll/entry_filter.rb +121 -121
- 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 -98
- data/lib/jekyll/filters.rb +535 -535
- data/lib/jekyll/frontmatter_defaults.rb +240 -240
- data/lib/jekyll/generator.rb +5 -5
- data/lib/jekyll/hooks.rb +107 -107
- data/lib/jekyll/inclusion.rb +32 -32
- data/lib/jekyll/layout.rb +67 -67
- 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 -55
- data/lib/jekyll/liquid_renderer.rb +80 -80
- data/lib/jekyll/log_adapter.rb +151 -151
- data/lib/jekyll/mime.types +866 -866
- data/lib/jekyll/page.rb +217 -217
- data/lib/jekyll/page_excerpt.rb +25 -25
- data/lib/jekyll/page_without_a_file.rb +14 -14
- data/lib/jekyll/path_manager.rb +74 -74
- data/lib/jekyll/plugin.rb +92 -92
- data/lib/jekyll/plugin_manager.rb +115 -115
- data/lib/jekyll/profiler.rb +58 -58
- data/lib/jekyll/publisher.rb +23 -23
- data/lib/jekyll/reader.rb +192 -192
- data/lib/jekyll/readers/collection_reader.rb +23 -23
- data/lib/jekyll/readers/data_reader.rb +79 -79
- data/lib/jekyll/readers/layout_reader.rb +62 -62
- data/lib/jekyll/readers/page_reader.rb +25 -25
- data/lib/jekyll/readers/post_reader.rb +85 -85
- data/lib/jekyll/readers/static_file_reader.rb +25 -25
- data/lib/jekyll/readers/theme_assets_reader.rb +52 -52
- data/lib/jekyll/regenerator.rb +195 -195
- data/lib/jekyll/related_posts.rb +52 -52
- data/lib/jekyll/renderer.rb +265 -265
- data/lib/jekyll/site.rb +551 -551
- data/lib/jekyll/static_file.rb +208 -208
- data/lib/jekyll/stevenson.rb +60 -60
- data/lib/jekyll/tags/highlight.rb +110 -110
- data/lib/jekyll/tags/include.rb +275 -270
- data/lib/jekyll/tags/link.rb +42 -42
- data/lib/jekyll/tags/post_url.rb +106 -106
- data/lib/jekyll/theme.rb +86 -86
- data/lib/jekyll/theme_builder.rb +121 -121
- data/lib/jekyll/url.rb +167 -167
- 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 -67
- 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 -195
- 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 -16
- 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 +3 -3
@@ -1,110 +1,110 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Jekyll
|
4
|
-
module Tags
|
5
|
-
class HighlightBlock < Liquid::Block
|
6
|
-
include Liquid::StandardFilters
|
7
|
-
|
8
|
-
# The regular expression syntax checker. Start with the language specifier.
|
9
|
-
# Follow that by zero or more space separated options that take one of three
|
10
|
-
# forms: name, name=value, or name="<quoted list>"
|
11
|
-
#
|
12
|
-
# <quoted list> is a space-separated list of numbers
|
13
|
-
SYNTAX = %r!^([a-zA-Z0-9.+#_-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$!.freeze
|
14
|
-
|
15
|
-
def initialize(tag_name, markup, tokens)
|
16
|
-
super
|
17
|
-
if markup.strip =~ SYNTAX
|
18
|
-
@lang = Regexp.last_match(1).downcase
|
19
|
-
@highlight_options = parse_options(Regexp.last_match(2))
|
20
|
-
else
|
21
|
-
raise SyntaxError, <<~MSG
|
22
|
-
Syntax Error in tag 'highlight' while parsing the following markup:
|
23
|
-
|
24
|
-
#{markup}
|
25
|
-
|
26
|
-
Valid syntax: highlight <lang> [linenos]
|
27
|
-
MSG
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
LEADING_OR_TRAILING_LINE_TERMINATORS = %r!\A(\n|\r)+|(\n|\r)+\z!.freeze
|
32
|
-
|
33
|
-
def render(context)
|
34
|
-
prefix = context["highlighter_prefix"] || ""
|
35
|
-
suffix = context["highlighter_suffix"] || ""
|
36
|
-
code = super.to_s.gsub(LEADING_OR_TRAILING_LINE_TERMINATORS, "")
|
37
|
-
|
38
|
-
output =
|
39
|
-
case context.registers[:site].highlighter
|
40
|
-
when "rouge"
|
41
|
-
render_rouge(code)
|
42
|
-
when "pygments"
|
43
|
-
render_pygments(code, context)
|
44
|
-
else
|
45
|
-
render_codehighlighter(code)
|
46
|
-
end
|
47
|
-
|
48
|
-
rendered_output = add_code_tag(output)
|
49
|
-
prefix + rendered_output + suffix
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
OPTIONS_REGEX = %r!(?:\w="[^"]*"|\w=\w|\w)+!.freeze
|
55
|
-
|
56
|
-
def parse_options(input)
|
57
|
-
options = {}
|
58
|
-
return options if input.empty?
|
59
|
-
|
60
|
-
# Split along 3 possible forms -- key="<quoted list>", key=value, or key
|
61
|
-
input.scan(OPTIONS_REGEX) do |opt|
|
62
|
-
key, value = opt.split("=")
|
63
|
-
# If a quoted list, convert to array
|
64
|
-
if value&.include?('"')
|
65
|
-
value.delete!('"')
|
66
|
-
value = value.split
|
67
|
-
end
|
68
|
-
options[key.to_sym] = value || true
|
69
|
-
end
|
70
|
-
|
71
|
-
options[:linenos] = "inline" if options[:linenos] == true
|
72
|
-
options
|
73
|
-
end
|
74
|
-
|
75
|
-
def render_pygments(code, _context)
|
76
|
-
Jekyll.logger.warn "Warning:", "Highlight Tag no longer supports rendering with Pygments."
|
77
|
-
Jekyll.logger.warn "", "Using the default highlighter, Rouge, instead."
|
78
|
-
render_rouge(code)
|
79
|
-
end
|
80
|
-
|
81
|
-
def render_rouge(code)
|
82
|
-
require "rouge"
|
83
|
-
formatter = ::Rouge::Formatters::HTMLLegacy.new(
|
84
|
-
:line_numbers => @highlight_options[:linenos],
|
85
|
-
:wrap => false,
|
86
|
-
:css_class => "highlight",
|
87
|
-
:gutter_class => "gutter",
|
88
|
-
:code_class => "code"
|
89
|
-
)
|
90
|
-
lexer = ::Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
|
91
|
-
formatter.format(lexer.lex(code))
|
92
|
-
end
|
93
|
-
|
94
|
-
def render_codehighlighter(code)
|
95
|
-
h(code).strip
|
96
|
-
end
|
97
|
-
|
98
|
-
def add_code_tag(code)
|
99
|
-
code_attributes = [
|
100
|
-
"class=\"language-#{@lang.to_s.tr("+", "-")}\"",
|
101
|
-
"data-lang=\"#{@lang}\"",
|
102
|
-
].join(" ")
|
103
|
-
"<figure class=\"highlight\"><pre><code #{code_attributes}>"\
|
104
|
-
"#{code.chomp}</code></pre></figure>"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
Liquid::Template.register_tag("highlight", Jekyll::Tags::HighlightBlock)
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Tags
|
5
|
+
class HighlightBlock < Liquid::Block
|
6
|
+
include Liquid::StandardFilters
|
7
|
+
|
8
|
+
# The regular expression syntax checker. Start with the language specifier.
|
9
|
+
# Follow that by zero or more space separated options that take one of three
|
10
|
+
# forms: name, name=value, or name="<quoted list>"
|
11
|
+
#
|
12
|
+
# <quoted list> is a space-separated list of numbers
|
13
|
+
SYNTAX = %r!^([a-zA-Z0-9.+#_-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$!.freeze
|
14
|
+
|
15
|
+
def initialize(tag_name, markup, tokens)
|
16
|
+
super
|
17
|
+
if markup.strip =~ SYNTAX
|
18
|
+
@lang = Regexp.last_match(1).downcase
|
19
|
+
@highlight_options = parse_options(Regexp.last_match(2))
|
20
|
+
else
|
21
|
+
raise SyntaxError, <<~MSG
|
22
|
+
Syntax Error in tag 'highlight' while parsing the following markup:
|
23
|
+
|
24
|
+
#{markup}
|
25
|
+
|
26
|
+
Valid syntax: highlight <lang> [linenos]
|
27
|
+
MSG
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
LEADING_OR_TRAILING_LINE_TERMINATORS = %r!\A(\n|\r)+|(\n|\r)+\z!.freeze
|
32
|
+
|
33
|
+
def render(context)
|
34
|
+
prefix = context["highlighter_prefix"] || ""
|
35
|
+
suffix = context["highlighter_suffix"] || ""
|
36
|
+
code = super.to_s.gsub(LEADING_OR_TRAILING_LINE_TERMINATORS, "")
|
37
|
+
|
38
|
+
output =
|
39
|
+
case context.registers[:site].highlighter
|
40
|
+
when "rouge"
|
41
|
+
render_rouge(code)
|
42
|
+
when "pygments"
|
43
|
+
render_pygments(code, context)
|
44
|
+
else
|
45
|
+
render_codehighlighter(code)
|
46
|
+
end
|
47
|
+
|
48
|
+
rendered_output = add_code_tag(output)
|
49
|
+
prefix + rendered_output + suffix
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
OPTIONS_REGEX = %r!(?:\w="[^"]*"|\w=\w|\w)+!.freeze
|
55
|
+
|
56
|
+
def parse_options(input)
|
57
|
+
options = {}
|
58
|
+
return options if input.empty?
|
59
|
+
|
60
|
+
# Split along 3 possible forms -- key="<quoted list>", key=value, or key
|
61
|
+
input.scan(OPTIONS_REGEX) do |opt|
|
62
|
+
key, value = opt.split("=")
|
63
|
+
# If a quoted list, convert to array
|
64
|
+
if value&.include?('"')
|
65
|
+
value.delete!('"')
|
66
|
+
value = value.split
|
67
|
+
end
|
68
|
+
options[key.to_sym] = value || true
|
69
|
+
end
|
70
|
+
|
71
|
+
options[:linenos] = "inline" if options[:linenos] == true
|
72
|
+
options
|
73
|
+
end
|
74
|
+
|
75
|
+
def render_pygments(code, _context)
|
76
|
+
Jekyll.logger.warn "Warning:", "Highlight Tag no longer supports rendering with Pygments."
|
77
|
+
Jekyll.logger.warn "", "Using the default highlighter, Rouge, instead."
|
78
|
+
render_rouge(code)
|
79
|
+
end
|
80
|
+
|
81
|
+
def render_rouge(code)
|
82
|
+
require "rouge"
|
83
|
+
formatter = ::Rouge::Formatters::HTMLLegacy.new(
|
84
|
+
:line_numbers => @highlight_options[:linenos],
|
85
|
+
:wrap => false,
|
86
|
+
:css_class => "highlight",
|
87
|
+
:gutter_class => "gutter",
|
88
|
+
:code_class => "code"
|
89
|
+
)
|
90
|
+
lexer = ::Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
|
91
|
+
formatter.format(lexer.lex(code))
|
92
|
+
end
|
93
|
+
|
94
|
+
def render_codehighlighter(code)
|
95
|
+
h(code).strip
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_code_tag(code)
|
99
|
+
code_attributes = [
|
100
|
+
"class=\"language-#{@lang.to_s.tr("+", "-")}\"",
|
101
|
+
"data-lang=\"#{@lang}\"",
|
102
|
+
].join(" ")
|
103
|
+
"<figure class=\"highlight\"><pre><code #{code_attributes}>"\
|
104
|
+
"#{code.chomp}</code></pre></figure>"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
Liquid::Template.register_tag("highlight", Jekyll::Tags::HighlightBlock)
|