deps: bump rubocop-jekyll to 0.3.0 (#316)

Merge pull request 316
This commit is contained in:
jekyllbot 2018-10-26 10:49:04 -04:00 committed by GitHub
parent 2184b8b201
commit 3be2c5eabe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 3 deletions

View File

@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "html-proofer", "~> 3.7"
spec.add_development_dependency "rspec", "~> 3.5"
spec.add_development_dependency "rubocop-jekyll", "~> 0.1.0"
spec.add_development_dependency "rubocop-jekyll", "~> 0.3"
end

View File

@ -24,7 +24,7 @@ module Jekyll
# We will not strip any whitespace if the next character is a '-'
# so that we do not interfere with the HTML comment at the
# very begining
MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!
MINIFY_REGEX = %r!(?<=[{}]|[>,]\n)\s+(?\!-)!.freeze
def initialize(_tag_name, text, _tokens)
super

View File

@ -19,6 +19,7 @@ module Jekyll
# site - The Jekyll::Drops::SiteDrop
def initialize(page: nil, site: nil)
raise ArgumentError unless page && site
@mutations = {}
@page = page
@site = site
@ -33,6 +34,7 @@ module Jekyll
def twitter
return @twitter if defined? @twitter
twitter = author_hash["twitter"] || author_hash["name"]
@twitter = twitter.is_a?(String) ? twitter.sub(%r!^@!, "") : nil
end
@ -47,6 +49,7 @@ module Jekyll
# Returns a string or hash representing the author
def resolved_author
return @resolved_author if defined? @resolved_author
sources = [page["author"]]
sources << page["authors"].first if page["authors"].is_a?(Array)
sources << site["author"]
@ -61,6 +64,7 @@ module Jekyll
@site_data_hash ||= begin
return {} unless resolved_author.is_a?(String)
return {} unless site.data["authors"].is_a?(Hash)
author_hash = site.data["authors"][resolved_author]
author_hash.is_a?(Hash) ? author_hash : {}
end

View File

@ -9,7 +9,7 @@ module Jekyll
FORMAT_STRING_METHODS = [
:markdownify, :strip_html, :normalize_whitespace, :escape_once,
].freeze
HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!
HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze
def initialize(text, context)
@obj = {}
@ -26,6 +26,7 @@ module Jekyll
def title?
return false unless title
return @display_title if defined?(@display_title)
@display_title = (@text !~ %r!title=false!i)
end
@ -63,6 +64,7 @@ module Jekyll
def name
return @name if defined?(@name)
@name = if seo_name
seo_name
elsif !homepage_or_about?
@ -141,6 +143,7 @@ module Jekyll
def logo
@logo ||= begin
return unless site["logo"]
if absolute_url? site["logo"]
filters.uri_escape site["logo"]
else

View File

@ -18,6 +18,7 @@ module Jekyll
# context - the Liquid::Context
def initialize(page: nil, context: nil)
raise ArgumentError unless page && context
@mutations = {}
@page = page
@context = context
@ -57,6 +58,7 @@ module Jekyll
def absolute_url
return unless raw_path
return @absolute_url if defined? @absolute_url
@absolute_url = if raw_path.is_a?(String) && absolute_url?(raw_path) == false
filters.absolute_url raw_path
else

View File

@ -34,6 +34,7 @@ module Jekyll
def author
return unless page_drop.author["name"]
{
"@type" => "Person",
"name" => page_drop.author["name"],
@ -52,6 +53,7 @@ module Jekyll
def publisher
return unless logo
output = {
"@type" => "Organization",
"logo" => {
@ -65,6 +67,7 @@ module Jekyll
def main_entity
return unless %w(BlogPosting CreativeWork).include?(type)
{
"@type" => "WebPage",
"@id" => page_drop.canonical_url,

View File

@ -13,6 +13,7 @@ module Jekyll
# Returns nil if it is not a string or can't be parsed as a URL
def absolute_url?(string)
return unless string
Addressable::URI.parse(string).absolute?
rescue Addressable::URI::InvalidURIError
nil