parent
41c25f30e1
commit
8d80ada92b
2
Gemfile
2
Gemfile
|
|
@ -25,7 +25,7 @@ group :test do
|
||||||
gem "nokogiri", "~> 1.7"
|
gem "nokogiri", "~> 1.7"
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rspec-mocks"
|
gem "rspec-mocks"
|
||||||
gem "rubocop", "~> 0.59.0"
|
gem "rubocop", "~> 0.60.0"
|
||||||
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
||||||
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
# Handles the cleanup of a site's destination before it is built.
|
# Handles the cleanup of a site's destination before it is built.
|
||||||
class Cleaner
|
class Cleaner
|
||||||
HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!
|
HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!.freeze
|
||||||
attr_reader :site
|
attr_reader :site
|
||||||
|
|
||||||
def initialize(site)
|
def initialize(site)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ module Jekyll
|
||||||
|
|
||||||
# This class inserts the LiveReload script tags into HTML as it is served
|
# This class inserts the LiveReload script tags into HTML as it is served
|
||||||
class BodyProcessor
|
class BodyProcessor
|
||||||
HEAD_TAG_REGEX = %r!<head>|<head[^(er)][^<]*>!
|
HEAD_TAG_REGEX = %r!<head>|<head[^(er)][^<]*>!.freeze
|
||||||
|
|
||||||
attr_reader :content_length, :new_body, :livereload_added
|
attr_reader :content_length, :new_body, :livereload_added
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ module Jekyll
|
||||||
|
|
||||||
def_delegator :self, :read_post_data, :post_read
|
def_delegator :self, :read_post_data, :post_read
|
||||||
|
|
||||||
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m
|
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m.freeze
|
||||||
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!
|
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!.freeze
|
||||||
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{2,4}-\d{1,2}-\d{1,2})-(.*)(\.[^.]+)$!
|
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{2,4}-\d{1,2}-\d{1,2})-(.*)(\.[^.]+)$!.freeze
|
||||||
|
|
||||||
# Create a new Document.
|
# Create a new Document.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns excerpt String
|
# Returns excerpt String
|
||||||
|
|
||||||
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+).+\s*-?%}!m
|
LIQUID_TAG_REGEX = %r!{%-?\s*(\w+).+\s*-?%}!m.freeze
|
||||||
MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!
|
MKDWN_LINK_REF_REGEX = %r!^ {0,3}\[[^\]]+\]:.+$!.freeze
|
||||||
|
|
||||||
def extract_excerpt(doc_content)
|
def extract_excerpt(doc_content)
|
||||||
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
|
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ module Jekyll
|
||||||
|
|
||||||
# Sanitizes the given path by removing a leading and adding a trailing slash
|
# Sanitizes the given path by removing a leading and adding a trailing slash
|
||||||
|
|
||||||
SANITIZATION_REGEX = %r!\A/|(?<=[^/])\z!
|
SANITIZATION_REGEX = %r!\A/|(?<=[^/])\z!.freeze
|
||||||
|
|
||||||
def sanitize_path(path)
|
def sanitize_path(path)
|
||||||
if path.nil? || path.empty?
|
if path.nil? || path.empty?
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ module Jekyll
|
||||||
# forms: name, name=value, or name="<quoted list>"
|
# forms: name, name=value, or name="<quoted list>"
|
||||||
#
|
#
|
||||||
# <quoted list> is a space-separated list of numbers
|
# <quoted list> is a space-separated list of numbers
|
||||||
SYNTAX = %r!^([a-zA-Z0-9.+#_-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$!
|
SYNTAX = %r!^([a-zA-Z0-9.+#_-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$!.freeze
|
||||||
|
|
||||||
def initialize(tag_name, markup, tokens)
|
def initialize(tag_name, markup, tokens)
|
||||||
super
|
super
|
||||||
|
|
@ -49,7 +49,7 @@ module Jekyll
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
OPTIONS_REGEX = %r!(?:\w="[^"]*"|\w=\w|\w)+!
|
OPTIONS_REGEX = %r!(?:\w="[^"]*"|\w=\w|\w)+!.freeze
|
||||||
|
|
||||||
def parse_options(input)
|
def parse_options(input)
|
||||||
options = {}
|
options = {}
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,15 @@ module Jekyll
|
||||||
VALID_SYNTAX = %r!
|
VALID_SYNTAX = %r!
|
||||||
([\w-]+)\s*=\s*
|
([\w-]+)\s*=\s*
|
||||||
(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
|
(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
|
||||||
!x
|
!x.freeze
|
||||||
VARIABLE_SYNTAX = %r!
|
VARIABLE_SYNTAX = %r!
|
||||||
(?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)
|
(?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)
|
||||||
(?<params>.*)
|
(?<params>.*)
|
||||||
!mx
|
!mx.freeze
|
||||||
|
|
||||||
FULL_VALID_SYNTAX = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z!
|
FULL_VALID_SYNTAX = %r!\A\s*(?:#{VALID_SYNTAX}(?=\s|\z)\s*)*\z!.freeze
|
||||||
VALID_FILENAME_CHARS = %r!^[\w/\.-]+$!
|
VALID_FILENAME_CHARS = %r!^[\w/\.-]+$!.freeze
|
||||||
INVALID_SEQUENCES = %r![./]{2,}!
|
INVALID_SEQUENCES = %r![./]{2,}!.freeze
|
||||||
|
|
||||||
def initialize(tag_name, markup, tokens)
|
def initialize(tag_name, markup, tokens)
|
||||||
super
|
super
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Tags
|
module Tags
|
||||||
class PostComparer
|
class PostComparer
|
||||||
MATCHER = %r!^(.+/)*(\d+-\d+-\d+)-(.*)$!
|
MATCHER = %r!^(.+/)*(\d+-\d+-\d+)-(.*)$!.freeze
|
||||||
|
|
||||||
attr_reader :path, :date, :slug, :name
|
attr_reader :path, :date, :slug, :name
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module Jekyll
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
ESCAPE = format("%c", 27)
|
ESCAPE = format("%c", 27)
|
||||||
MATCH = %r!#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m!ix
|
MATCH = %r!#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m!ix.freeze
|
||||||
COLORS = {
|
COLORS = {
|
||||||
:red => 31,
|
:red => 31,
|
||||||
:green => 32,
|
:green => 32,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue