Rubocop: Style/PercentLiteralDelimiters
- %w-literals should be delimited by ( and ) Rubocop: Style/WordArray - Use %w or %W for array of words
This commit is contained in:
parent
fb0457bf3d
commit
98a19cdf2b
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
STDOUT.sync = true
|
STDOUT.sync = true
|
||||||
|
|
||||||
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
|
||||||
|
|
||||||
require 'jekyll'
|
require 'jekyll'
|
||||||
require 'mercenary'
|
require 'mercenary'
|
||||||
|
|
|
@ -128,7 +128,7 @@ module Jekyll
|
||||||
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
||||||
config_files = override.delete('config')
|
config_files = override.delete('config')
|
||||||
if config_files.to_s.empty?
|
if config_files.to_s.empty?
|
||||||
default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
|
default = %w(yml yaml).find(Proc.new { 'yml' }) do |ext|
|
||||||
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
||||||
end
|
end
|
||||||
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
||||||
|
@ -227,7 +227,7 @@ module Jekyll
|
||||||
config.delete('pygments')
|
config.delete('pygments')
|
||||||
end
|
end
|
||||||
|
|
||||||
%w[include exclude].each do |option|
|
%w(include exclude).each do |option|
|
||||||
config[option] ||= []
|
config[option] ||= []
|
||||||
if config[option].is_a?(String)
|
if config[option].is_a?(String)
|
||||||
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
|
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
|
||||||
|
|
|
@ -41,7 +41,7 @@ module Jekyll
|
||||||
|
|
||||||
def third_party_processors
|
def third_party_processors
|
||||||
self.class.constants - \
|
self.class.constants - \
|
||||||
%w[KramdownParser RDiscountParser RedcarpetParser PRIORITIES].map(
|
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
|
||||||
&:to_sym
|
&:to_sym
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,10 +71,10 @@ module Jekyll
|
||||||
end
|
end
|
||||||
when "rouge"
|
when "rouge"
|
||||||
Class.new(Redcarpet::Render::HTML) do
|
Class.new(Redcarpet::Render::HTML) do
|
||||||
Jekyll::External.require_with_graceful_fail(%w[
|
Jekyll::External.require_with_graceful_fail(%w(
|
||||||
rouge
|
rouge
|
||||||
rouge/plugins/redcarpet
|
rouge/plugins/redcarpet
|
||||||
])
|
))
|
||||||
|
|
||||||
unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
|
unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
|
||||||
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
|
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
|
||||||
|
|
|
@ -160,7 +160,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns true if extname == .sass or .scss, false otherwise.
|
# Returns true if extname == .sass or .scss, false otherwise.
|
||||||
def sass_file?
|
def sass_file?
|
||||||
%w[.sass .scss].include?(ext)
|
%w(.sass .scss).include?(ext)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine whether the document is a CoffeeScript file.
|
# Determine whether the document is a CoffeeScript file.
|
||||||
|
|
|
@ -21,7 +21,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_subcommand(args)
|
def no_subcommand(args)
|
||||||
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
|
if args.size > 0 && args.first =~ /^--/ && !%w(--help --version).include?(args.first)
|
||||||
deprecation_message "Jekyll now uses subcommands instead of just switches. Run `jekyll --help` to find out more."
|
deprecation_message "Jekyll now uses subcommands instead of just switches. Run `jekyll --help` to find out more."
|
||||||
abort
|
abort
|
||||||
end
|
end
|
||||||
|
|
|
@ -127,7 +127,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns true if the extname is either .yml or .yaml, false otherwise.
|
# Returns true if the extname is either .yml or .yaml, false otherwise.
|
||||||
def yaml_file?
|
def yaml_file?
|
||||||
%w[.yaml .yml].include?(extname)
|
%w(.yaml .yml).include?(extname)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine whether the document is an asset file.
|
# Determine whether the document is an asset file.
|
||||||
|
@ -143,7 +143,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns true if extname == .sass or .scss, false otherwise.
|
# Returns true if extname == .sass or .scss, false otherwise.
|
||||||
def sass_file?
|
def sass_file?
|
||||||
%w[.sass .scss].include?(extname)
|
%w(.sass .scss).include?(extname)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine whether the document is a CoffeeScript file.
|
# Determine whether the document is a CoffeeScript file.
|
||||||
|
|
|
@ -7,10 +7,10 @@ module Jekyll
|
||||||
# Usually contain subcommands.
|
# Usually contain subcommands.
|
||||||
#
|
#
|
||||||
def blessed_gems
|
def blessed_gems
|
||||||
%w{
|
%w(
|
||||||
jekyll-docs
|
jekyll-docs
|
||||||
jekyll-import
|
jekyll-import
|
||||||
}
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -72,7 +72,7 @@ module Jekyll
|
||||||
sorted = @stats.sort_by{ |filename, file_stats| -file_stats[:time] }
|
sorted = @stats.sort_by{ |filename, file_stats| -file_stats[:time] }
|
||||||
sorted = sorted.slice(0, n)
|
sorted = sorted.slice(0, n)
|
||||||
|
|
||||||
table = [[ 'Filename', 'Count', 'Bytes', 'Time' ]]
|
table = [%w(Filename Count Bytes Time)]
|
||||||
|
|
||||||
sorted.each do |filename, file_stats|
|
sorted.each do |filename, file_stats|
|
||||||
row = []
|
row = []
|
||||||
|
|
|
@ -8,13 +8,13 @@ module Jekyll
|
||||||
attr_accessor :data, :content, :output
|
attr_accessor :data, :content, :output
|
||||||
|
|
||||||
# Attributes for Liquid templates
|
# Attributes for Liquid templates
|
||||||
ATTRIBUTES_FOR_LIQUID = %w[
|
ATTRIBUTES_FOR_LIQUID = %w(
|
||||||
content
|
content
|
||||||
dir
|
dir
|
||||||
name
|
name
|
||||||
path
|
path
|
||||||
url
|
url
|
||||||
]
|
)
|
||||||
|
|
||||||
# A set of extensions that are considered HTML or HTML-like so we
|
# A set of extensions that are considered HTML or HTML-like so we
|
||||||
# should not alter them, this includes .xhtml through XHTM5.
|
# should not alter them, this includes .xhtml through XHTM5.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class CollectionReader
|
class CollectionReader
|
||||||
SPECIAL_COLLECTIONS = %w{posts data}.freeze
|
SPECIAL_COLLECTIONS = %w(posts data).freeze
|
||||||
|
|
||||||
attr_reader :site, :content
|
attr_reader :site, :content
|
||||||
def initialize(site)
|
def initialize(site)
|
||||||
|
|
|
@ -19,8 +19,8 @@ module Jekyll
|
||||||
def initialize(config)
|
def initialize(config)
|
||||||
@config = config.clone
|
@config = config.clone
|
||||||
|
|
||||||
%w[safe lsi highlighter baseurl exclude include future unpublished
|
%w(safe lsi highlighter baseurl exclude include future unpublished
|
||||||
show_drafts limit_posts keep_files gems].each do |opt|
|
show_drafts limit_posts keep_files gems).each do |opt|
|
||||||
self.send("#{opt}=", config[opt])
|
self.send("#{opt}=", config[opt])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Jekyll
|
||||||
autoload :Ansi, "jekyll/utils/ansi"
|
autoload :Ansi, "jekyll/utils/ansi"
|
||||||
|
|
||||||
# Constants for use in #slugify
|
# Constants for use in #slugify
|
||||||
SLUGIFY_MODES = %w{raw default pretty}
|
SLUGIFY_MODES = %w(raw default pretty)
|
||||||
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
|
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
|
||||||
SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
|
SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
|
||||||
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
|
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
|
||||||
|
|
Loading…
Reference in New Issue