mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Enforce Style/FrozenStringLiteralComment. (#6265)
Merge pull request 6265
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed
|
||||
|
||||
# Require all of the Ruby files in the given directory.
|
||||
@@ -162,8 +164,9 @@ module Jekyll
|
||||
def sanitized_path(base_directory, questionable_path)
|
||||
return base_directory if base_directory.eql?(questionable_path)
|
||||
|
||||
questionable_path.insert(0, "/") if questionable_path.start_with?("~")
|
||||
clean_path = File.expand_path(questionable_path, "/")
|
||||
clean_path = questionable_path.dup
|
||||
clean_path.insert(0, "/") if clean_path.start_with?("~")
|
||||
clean_path = File.expand_path(clean_path, "/")
|
||||
|
||||
return clean_path if clean_path.eql?(base_directory)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "set"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Collection
|
||||
attr_reader :site, :label, :metadata
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Command
|
||||
class << self
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Build < Command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Clean < Command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "addressable/uri"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Help < Command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "erb"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "erb"
|
||||
|
||||
class Jekyll::Commands::NewTheme < Jekyll::Command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Serve < Command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "webrick"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Configuration < Hash
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Converter < Plugin
|
||||
# Public: Get or set the highlighter prefix. When an argument is specified,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Converters
|
||||
class Identity < Converter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Converters
|
||||
class Markdown < Converter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Converters
|
||||
class Markdown
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Jekyll::Converters::Markdown::RedcarpetParser
|
||||
module CommonMethods
|
||||
def add_code_tags(code, lang)
|
||||
@@ -48,9 +50,7 @@ class Jekyll::Converters::Markdown::RedcarpetParser
|
||||
def block_code(code, lang)
|
||||
code = "<pre>#{super}</pre>"
|
||||
|
||||
output = "<div class=\"highlight\">"
|
||||
output << add_code_tags(code, lang)
|
||||
output << "</div>"
|
||||
"<div class=\"highlight\">#{add_code_tags(code, lang)}</div>"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
|
||||
def initialize(source, options)
|
||||
super
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "set"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Deprecator
|
||||
extend self
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Document
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
class StaticFileDrop < Drop
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Drops
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class EntryFilter
|
||||
attr_reader :site
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Errors
|
||||
FatalException = Class.new(::RuntimeError)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Excerpt
|
||||
extend Forwardable
|
||||
@@ -117,7 +119,7 @@ module Jekyll
|
||||
if tail.empty?
|
||||
head
|
||||
else
|
||||
"" << head << "\n\n" << tail.scan(%r!^ {0,3}\[[^\]]+\]:.+$!).join("\n")
|
||||
head.to_s.dup << "\n\n" << tail.scan(%r!^ {0,3}\[[^\]]+\]:.+$!).join("\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module External
|
||||
class << self
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "addressable/uri"
|
||||
require "json"
|
||||
require "date"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Filters
|
||||
module GroupingFilters
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "addressable/uri"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
# This class handles custom defaults for YAML frontmatter settings.
|
||||
# These are set in _config.yml and apply both to internal use (e.g. layout)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
Generator = Class.new(Plugin)
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Hooks
|
||||
DEFAULT_PRIORITY = 20
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Layout
|
||||
include Convertible
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module LiquidExtensions
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "jekyll/liquid_renderer/file"
|
||||
require "jekyll/liquid_renderer/table"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class LiquidRenderer
|
||||
class File
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class LiquidRenderer::Table
|
||||
def initialize(stats)
|
||||
@@ -13,7 +15,7 @@ module Jekyll
|
||||
private
|
||||
|
||||
def generate_table(data, widths)
|
||||
str = "\n"
|
||||
str = String.new("\n")
|
||||
|
||||
table_head = data.shift
|
||||
str << generate_row(table_head, widths)
|
||||
@@ -28,7 +30,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def generate_table_head_border(row_data, widths)
|
||||
str = ""
|
||||
str = String.new("")
|
||||
|
||||
row_data.each_index do |cell_index|
|
||||
str << "-" * widths[cell_index]
|
||||
@@ -40,7 +42,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def generate_row(row_data, widths)
|
||||
str = ""
|
||||
str = String.new("")
|
||||
|
||||
row_data.each_with_index do |cell_data, cell_index|
|
||||
str << if cell_index.zero?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class LogAdapter
|
||||
attr_reader :writer, :messages
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Page
|
||||
include Convertible
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Plugin
|
||||
PRIORITIES = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class PluginManager
|
||||
attr_reader :site
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Publisher
|
||||
def initialize(site)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "csv"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class CollectionReader
|
||||
SPECIAL_COLLECTIONS = %w(posts data).freeze
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class DataReader
|
||||
attr_reader :site, :content
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class LayoutReader
|
||||
attr_reader :site
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class PageReader
|
||||
attr_reader :site, :dir, :unfiltered_content
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class PostReader
|
||||
attr_reader :site, :unfiltered_content
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class StaticFileReader
|
||||
attr_reader :site, :dir, :unfiltered_content
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class ThemeAssetsReader
|
||||
attr_reader :site
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Regenerator
|
||||
attr_reader :site, :metadata, :cache
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class RelatedPosts
|
||||
class << self
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Renderer
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "csv"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class StaticFile
|
||||
attr_reader :relative_path, :extname, :name, :data
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Stevenson < ::Logger
|
||||
def initialize
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Tags
|
||||
class HighlightBlock < Liquid::Block
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Tags
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Tags
|
||||
class Link < Liquid::Tag
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Tags
|
||||
class PostComparer
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Theme
|
||||
extend Forwardable
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Jekyll::ThemeBuilder
|
||||
SCAFFOLD_DIRECTORIES = %w(
|
||||
assets _layouts _includes _sass
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "addressable/uri"
|
||||
|
||||
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
||||
@@ -93,7 +95,7 @@ module Jekyll
|
||||
|
||||
def generate_url_from_drop(template)
|
||||
template.gsub(%r!:([a-z_]+)!) do |match|
|
||||
pool = possible_keys(match.sub(":".freeze, "".freeze))
|
||||
pool = possible_keys(match.sub(":", ""))
|
||||
|
||||
winner = pool.find { |key| @placeholders.key?(key) }
|
||||
if winner.nil?
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
extend self
|
||||
@@ -247,6 +249,8 @@ module Jekyll
|
||||
#
|
||||
# Returns the updated permalink template
|
||||
def add_permalink_suffix(template, permalink_style)
|
||||
template = template.dup
|
||||
|
||||
case permalink_style
|
||||
when :pretty
|
||||
template << "/"
|
||||
@@ -256,6 +260,7 @@ module Jekyll
|
||||
template << "/" if permalink_style.to_s.end_with?("/")
|
||||
template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
|
||||
end
|
||||
|
||||
template
|
||||
end
|
||||
|
||||
@@ -296,7 +301,7 @@ module Jekyll
|
||||
def merged_file_read_opts(site, opts)
|
||||
merged = (site ? site.file_read_opts : {}).merge(opts)
|
||||
if merged["encoding"] && !merged["encoding"].start_with?("bom|")
|
||||
merged["encoding"].insert(0, "bom|")
|
||||
merged["encoding"] = "bom|#{merged["encoding"]}"
|
||||
end
|
||||
merged
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "open3"
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
module Platforms
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
module WinTZ
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "3.5.1".freeze
|
||||
end
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
gemspec
|
||||
|
||||
Reference in New Issue
Block a user