jekyll 3.4.5 → 3.5.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 007cff0a1a4dacb861f9f524753b03e1c1d4fce6
4
- data.tar.gz: 6305426138e9a83b6d494a8276372f7e0b15223d
3
+ metadata.gz: a657dd9fc0fec7b9b0a13e9eb30aadd5a4c4f36c
4
+ data.tar.gz: b7012ba4c8d92eb11118adc0869d10dbb3e425a0
5
5
  SHA512:
6
- metadata.gz: 69fd494dfb64377969bf53956593309e92c2a3f7ccfaa980c242219d96e8393352adf84622922b46bd5b82df778a2c7075fe0487ea22cbddd74a8c282ad364d2
7
- data.tar.gz: d49b0d988f0223390b3a3f07697d6c73a369feda12e7065636fa83249e3e18297bb85cedbfde218d2b53c11285a554368e89e7268c66d48f1213615e0b024ad7
6
+ metadata.gz: 351307bc6003b80a90335b757e25655fbf47c578fbabfb93b85774dc74a66c967b814949e8c9c8cd91c2a615ee2d83787f287f5cc59d986b7717a6bff4d5a603
7
+ data.tar.gz: 90066e7822209f3ce5c62c29ba375de469260551b78363951c6907a5f1231510a2b1e72b8fc808be404a4b3bad1b5119334d270ad0c33e014b10a94d6e014f43
@@ -4,12 +4,43 @@ AllCops:
4
4
  Include:
5
5
  - lib/**/*.rb
6
6
  Exclude:
7
- - lib/jekyll/renderer.rb
8
7
  - bin/**/*
9
8
  - exe/**/*
10
9
  - benchmark/**/*
11
10
  - script/**/*
12
11
  - vendor/**/*
12
+ Layout/AlignArray:
13
+ Enabled: false
14
+ Layout/AlignHash:
15
+ EnforcedHashRocketStyle: table
16
+ Layout/AlignParameters:
17
+ Enabled: false
18
+ Layout/EmptyLinesAroundAccessModifier:
19
+ Enabled: false
20
+ Layout/EmptyLinesAroundModuleBody:
21
+ Enabled: false
22
+ Layout/EndOfLine:
23
+ EnforcedStyle: lf
24
+ Layout/ExtraSpacing:
25
+ AllowForAlignment: true
26
+ Layout/FirstParameterIndentation:
27
+ EnforcedStyle: consistent
28
+ Layout/IndentationWidth:
29
+ Severity: error
30
+ Layout/IndentArray:
31
+ EnforcedStyle: consistent
32
+ Layout/IndentHash:
33
+ EnforcedStyle: consistent
34
+ Layout/IndentHeredoc:
35
+ Enabled: false
36
+ Layout/MultilineMethodCallIndentation:
37
+ EnforcedStyle: indented
38
+ Layout/MultilineOperationIndentation:
39
+ EnforcedStyle: indented
40
+ Layout/SpaceAroundOperators:
41
+ Enabled: true
42
+ Layout/SpaceInsideBrackets:
43
+ Enabled: false
13
44
  Lint/EndAlignment:
14
45
  Severity: error
15
46
  Lint/UnreachableCode:
@@ -36,6 +67,8 @@ Metrics/LineLength:
36
67
  - !ruby/regexp /features\/.*.rb/
37
68
  - Rakefile
38
69
  - rake/*.rake
70
+ - Gemfile
71
+ - jekyll.gemspec
39
72
  Max: 90
40
73
  Severity: warning
41
74
  Metrics/MethodLength:
@@ -58,13 +91,6 @@ Security/YAMLLoad:
58
91
  - !ruby/regexp /test\/.*.rb$/
59
92
  Style/Alias:
60
93
  Enabled: false
61
- Style/AlignArray:
62
- Enabled: false
63
- Style/AlignHash:
64
- EnforcedHashRocketStyle: table
65
- Style/AlignParameters:
66
- Enabled: false
67
- EnforcedStyle: with_fixed_indentation
68
94
  Style/AndOr:
69
95
  Severity: error
70
96
  Style/Attr:
@@ -79,16 +105,8 @@ Style/Documentation:
79
105
  - !ruby/regexp /features\/.*.rb$/
80
106
  Style/DoubleNegation:
81
107
  Enabled: false
82
- Style/EmptyLinesAroundAccessModifier:
83
- Enabled: false
84
- Style/EmptyLinesAroundModuleBody:
85
- Enabled: false
86
- Style/ExtraSpacing:
87
- AllowForAlignment: true
88
108
  Style/FileName:
89
109
  Enabled: false
90
- Style/FirstParameterIndentation:
91
- EnforcedStyle: consistent
92
110
  Style/GuardClause:
93
111
  Enabled: false
94
112
  Style/HashSyntax:
@@ -96,18 +114,10 @@ Style/HashSyntax:
96
114
  Severity: error
97
115
  Style/IfUnlessModifier:
98
116
  Enabled: false
99
- Style/IndentArray:
100
- EnforcedStyle: consistent
101
- Style/IndentHash:
102
- EnforcedStyle: consistent
103
- Style/IndentationWidth:
104
- Severity: error
117
+ Style/InverseMethods:
118
+ Enabled: false
105
119
  Style/ModuleFunction:
106
120
  Enabled: false
107
- Style/MultilineMethodCallIndentation:
108
- EnforcedStyle: indented
109
- Style/MultilineOperationIndentation:
110
- EnforcedStyle: indented
111
121
  Style/MultilineTernaryOperator:
112
122
  Severity: error
113
123
  Style/PercentLiteralDelimiters:
@@ -131,14 +141,12 @@ Style/SignalException:
131
141
  EnforcedStyle: only_raise
132
142
  Style/SingleLineMethods:
133
143
  Enabled: false
134
- Style/SpaceAroundOperators:
135
- Enabled: false
136
- Style/SpaceInsideBrackets:
137
- Enabled: false
138
144
  Style/StringLiterals:
139
145
  EnforcedStyle: double_quotes
140
146
  Style/StringLiteralsInInterpolation:
141
147
  EnforcedStyle: double_quotes
148
+ Style/SymbolArray:
149
+ Enabled: false
142
150
  Style/TrailingCommaInLiteral:
143
151
  EnforcedStyleForMultiline: consistent_comma
144
152
  Style/UnneededCapitalW:
data/exe/jekyll CHANGED
@@ -25,13 +25,13 @@ Mercenary.program(:jekyll) do |p|
25
25
  "Layouts directory (defaults to ./_layouts)"
26
26
  p.option "profile", "--profile", "Generate a Liquid rendering profile"
27
27
 
28
- Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g|
28
+ Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g, ver_constraint|
29
29
  cmd = g.split("-").last
30
30
  p.command(cmd.to_sym) do |c|
31
31
  c.syntax cmd
32
32
  c.action do
33
33
  Jekyll.logger.abort_with "You must install the '#{g}' gem" \
34
- " to use the 'jekyll #{cmd}' command."
34
+ " version #{ver_constraint} to use the 'jekyll #{cmd}' command."
35
35
  end
36
36
  end
37
37
  end
@@ -34,7 +34,7 @@ module Jekyll
34
34
  if docs.respond_to?(method.to_sym)
35
35
  Jekyll.logger.warn "Deprecation:",
36
36
  "#{label}.#{method} should be changed to #{label}.docs.#{method}."
37
- Jekyll.logger.warn "", "Called by #{caller.first}."
37
+ Jekyll.logger.warn "", "Called by #{caller(0..0)}."
38
38
  docs.public_send(method.to_sym, *args, &blck)
39
39
  else
40
40
  super
@@ -72,7 +72,7 @@ module Jekyll
72
72
  def entries
73
73
  return [] unless exists?
74
74
  @entries ||=
75
- Utils.safe_glob(collection_dir, ["**", "*"]).map do |entry|
75
+ Utils.safe_glob(collection_dir, ["**", "*"], File::FNM_DOTMATCH).map do |entry|
76
76
  entry["#{collection_dir}/"] = ""
77
77
  entry
78
78
  end
@@ -37,6 +37,7 @@ module Jekyll
37
37
  #
38
38
  # Returns a full Jekyll configuration
39
39
  def configuration_from_options(options)
40
+ return options if options.is_a?(Jekyll::Configuration)
40
41
  Jekyll.configuration(options)
41
42
  end
42
43
 
@@ -45,6 +46,7 @@ module Jekyll
45
46
  # c - the Jekyll::Command to add these options to
46
47
  #
47
48
  # Returns nothing
49
+ # rubocop:disable Metrics/MethodLength
48
50
  def add_build_options(c)
49
51
  c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
50
52
  Array, "Custom configuration file"
@@ -65,7 +67,10 @@ module Jekyll
65
67
  c.option "quiet", "-q", "--quiet", "Silence output."
66
68
  c.option "verbose", "-V", "--verbose", "Print verbose output."
67
69
  c.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
70
+ c.option "strict_front_matter", "--strict_front_matter",
71
+ "Fail if errors are present in front matter"
68
72
  end
73
+ # rubocop:enable Metrics/MethodLength
69
74
  end
70
75
  end
71
76
  end
@@ -61,7 +61,6 @@ module Jekyll
61
61
  def gemfile_contents
62
62
  <<-RUBY
63
63
  source "https://rubygems.org"
64
- ruby RUBY_VERSION
65
64
 
66
65
  # Hello! This is where you manage which Jekyll version is used to run.
67
66
  # When you want to use a different version, change it below, save the
@@ -109,6 +108,7 @@ RUBY
109
108
 
110
109
  def create_sample_files(path)
111
110
  FileUtils.cp_r site_template + "/.", path
111
+ FileUtils.chmod_R "u+w", path
112
112
  FileUtils.rm File.expand_path(scaffold_path, path)
113
113
  end
114
114
 
@@ -32,11 +32,12 @@ module Jekyll
32
32
  cmd.action do |_, opts|
33
33
  opts["serving"] = true
34
34
  opts["watch" ] = true unless opts.key?("watch")
35
- config = opts["config"]
36
- opts["url"] = default_url(opts) if Jekyll.env == "development"
37
- Build.process(opts)
38
- opts["config"] = config
39
- Serve.process(opts)
35
+
36
+ config = configuration_from_options(opts)
37
+ if Jekyll.env == "development"
38
+ config["url"] = default_url(config)
39
+ end
40
+ [Build, Serve].each { |klass| klass.process(config) }
40
41
  end
41
42
  end
42
43
  end
@@ -135,7 +136,7 @@ module Jekyll
135
136
 
136
137
  private
137
138
  def format_url(ssl_enabled, address, port, baseurl = nil)
138
- format("%{prefix}://%{address}:%{port}%{baseurl}", {
139
+ format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", {
139
140
  :prefix => ssl_enabled ? "https" : "http",
140
141
  :address => address,
141
142
  :port => port,
@@ -6,70 +6,72 @@ module Jekyll
6
6
  # Strings rather than symbols are used for compatibility with YAML.
7
7
  DEFAULTS = Configuration[{
8
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" => {},
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
16
 
17
17
  # Handling Reading
18
- "safe" => false,
19
- "include" => [".htaccess"],
20
- "exclude" => %w(
21
- node_modules vendor/bundle/ vendor/cache/ vendor/gems/ vendor/ruby/
18
+ "safe" => false,
19
+ "include" => [".htaccess"],
20
+ "exclude" => %w(
21
+ Gemfile Gemfile.lock node_modules vendor/bundle/ vendor/cache/ vendor/gems/
22
+ vendor/ruby/
22
23
  ),
23
- "keep_files" => [".git", ".svn"],
24
- "encoding" => "utf-8",
25
- "markdown_ext" => "markdown,mkdown,mkdn,mkd,md",
24
+ "keep_files" => [".git", ".svn"],
25
+ "encoding" => "utf-8",
26
+ "markdown_ext" => "markdown,mkdown,mkdn,mkd,md",
27
+ "strict_front_matter" => false,
26
28
 
27
29
  # Filtering Content
28
- "show_drafts" => nil,
29
- "limit_posts" => 0,
30
- "future" => false,
31
- "unpublished" => false,
30
+ "show_drafts" => nil,
31
+ "limit_posts" => 0,
32
+ "future" => false,
33
+ "unpublished" => false,
32
34
 
33
35
  # Plugins
34
- "whitelist" => [],
35
- "gems" => [],
36
+ "whitelist" => [],
37
+ "plugins" => [],
36
38
 
37
39
  # Conversion
38
- "markdown" => "kramdown",
39
- "highlighter" => "rouge",
40
- "lsi" => false,
41
- "excerpt_separator" => "\n\n",
42
- "incremental" => false,
40
+ "markdown" => "kramdown",
41
+ "highlighter" => "rouge",
42
+ "lsi" => false,
43
+ "excerpt_separator" => "\n\n",
44
+ "incremental" => false,
43
45
 
44
46
  # Serving
45
- "detach" => false, # default to not detaching the server
46
- "port" => "4000",
47
- "host" => "127.0.0.1",
48
- "baseurl" => nil, # this mounts at /, i.e. no subdirectory
49
- "show_dir_listing" => false,
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,
50
52
 
51
53
  # Output Configuration
52
- "permalink" => "date",
53
- "paginate_path" => "/page:num",
54
- "timezone" => nil, # use the local timezone
54
+ "permalink" => "date",
55
+ "paginate_path" => "/page:num",
56
+ "timezone" => nil, # use the local timezone
55
57
 
56
- "quiet" => false,
57
- "verbose" => false,
58
- "defaults" => [],
58
+ "quiet" => false,
59
+ "verbose" => false,
60
+ "defaults" => [],
59
61
 
60
- "liquid" => {
62
+ "liquid" => {
61
63
  "error_mode" => "warn",
62
64
  },
63
65
 
64
- "rdiscount" => {
66
+ "rdiscount" => {
65
67
  "extensions" => [],
66
68
  },
67
69
 
68
- "redcarpet" => {
70
+ "redcarpet" => {
69
71
  "extensions" => [],
70
72
  },
71
73
 
72
- "kramdown" => {
74
+ "kramdown" => {
73
75
  "auto_ids" => true,
74
76
  "toc_levels" => "1..6",
75
77
  "entity_output" => "as_char",
@@ -136,7 +138,7 @@ module Jekyll
136
138
  SafeYAML.load_file(filename) || {}
137
139
  else
138
140
  raise ArgumentError, "No parser for '#{filename}' is available.
139
- Use a .toml or .y(a)ml file instead."
141
+ Use a .y(a)ml or .toml file instead."
140
142
  end
141
143
  end
142
144
 
@@ -228,9 +230,10 @@ module Jekyll
228
230
  # Provide backwards-compatibility
229
231
  check_auto(config)
230
232
  check_server(config)
233
+ check_plugins(config)
231
234
 
232
235
  renamed_key "server_port", "port", config
233
- renamed_key "plugins", "plugins_dir", config
236
+ renamed_key "gems", "plugins", config
234
237
  renamed_key "layouts", "layouts_dir", config
235
238
  renamed_key "data_source", "data_dir", config
236
239
 
@@ -384,5 +387,24 @@ module Jekyll
384
387
  "`_config.yml` file."
385
388
  end
386
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
387
409
  end
388
410
  end
@@ -8,7 +8,7 @@ module Jekyll
8
8
  #
9
9
  # Returns the String prefix.
10
10
  def self.highlighter_prefix(highlighter_prefix = nil)
11
- if !defined?(@highlighter_prefix) || !highlighter_prefix.nil?
11
+ unless defined?(@highlighter_prefix) && highlighter_prefix.nil?
12
12
  @highlighter_prefix = highlighter_prefix
13
13
  end
14
14
  @highlighter_prefix
@@ -22,7 +22,7 @@ module Jekyll
22
22
  #
23
23
  # Returns the String suffix.
24
24
  def self.highlighter_suffix(highlighter_suffix = nil)
25
- if !defined?(@highlighter_suffix) || !highlighter_suffix.nil?
25
+ unless defined?(@highlighter_suffix) && highlighter_suffix.nil?
26
26
  @highlighter_suffix = highlighter_suffix
27
27
  end
28
28
  @highlighter_suffix
@@ -48,8 +48,10 @@ module Jekyll
48
48
  end
49
49
  rescue SyntaxError => e
50
50
  Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}"
51
+ raise e if self.site.config["strict_front_matter"]
51
52
  rescue => e
52
53
  Jekyll.logger.warn "Error reading file #{filename}: #{e.message}"
54
+ raise e if self.site.config["strict_front_matter"]
53
55
  end
54
56
 
55
57
  self.data ||= {}
@@ -69,7 +71,7 @@ module Jekyll
69
71
  end
70
72
 
71
73
  def validate_permalink!(filename)
72
- if self.data["permalink"] && self.data["permalink"].empty?
74
+ if self.data["permalink"] && self.data["permalink"].to_s.empty?
73
75
  raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}"
74
76
  end
75
77
  end
@@ -78,7 +80,7 @@ module Jekyll
78
80
  #
79
81
  # Returns the transformed contents.
80
82
  def transform
81
- _renderer.transform
83
+ _renderer.convert(content)
82
84
  end
83
85
 
84
86
  # Determine the extension depending on content_type.
@@ -158,7 +160,7 @@ module Jekyll
158
160
  #
159
161
  # Returns true if extname == .coffee, false otherwise.
160
162
  def coffeescript_file?
161
- ".coffee" == ext
163
+ ext == ".coffee"
162
164
  end
163
165
 
164
166
  # Determine whether the file should be rendered with Liquid.