From 80a65d161f3f342533968d31cf679248c7dd8ce2 Mon Sep 17 00:00:00 2001 From: Anatoliy Yastreb Date: Tue, 24 May 2016 17:23:25 +0300 Subject: [PATCH] rubocop: fix post URL tag code style --- .rubocop.yml | 1 - lib/jekyll/tags/post_url.rb | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2dd1e114..f5dcc93a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -57,7 +57,6 @@ AllCops: - lib/jekyll/static_file.rb - lib/jekyll/stevenson.rb - lib/jekyll/tags/include.rb - - lib/jekyll/tags/post_url.rb - lib/jekyll/theme.rb - lib/jekyll/url.rb - lib/jekyll/utils.rb diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index b05d056b..2154c0cd 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -1,14 +1,14 @@ module Jekyll module Tags class PostComparer - MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/ + MATCHER = %r!^(.+/)*(\d+-\d+-\d+)-(.*)$! attr_reader :path, :date, :slug, :name def initialize(name) @name = name - all, @path, @date, @slug = *name.sub(/^\//, "").match(MATCHER) + all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER) unless all raise Jekyll::Errors::InvalidPostNameError, "'#{name}' does not contain valid date and/or title." @@ -42,9 +42,9 @@ module Jekyll def post_slug(other) path = other.basename.split("/")[0...-1].join("/") if path.nil? || path == "" - other.data['slug'] + other.data["slug"] else - path + '/' + other.data['slug'] + path + "/" + other.data["slug"] end end end @@ -78,7 +78,8 @@ eos site.posts.docs.each do |p| next unless @post.deprecated_equality p - Jekyll::Deprecator.deprecation_message "A call to '{{ post_url #{@post.name} }}' did not match " \ + Jekyll::Deprecator.deprecation_message "A call to "\ + "'{{ post_url #{@post.name} }}' did not match " \ "a post using the new matching method of checking name " \ "(path-date-slug) equality. Please make sure that you " \ "change this tag to match the post's name exactly." @@ -95,4 +96,4 @@ eos end end -Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl) +Liquid::Template.register_tag("post_url", Jekyll::Tags::PostUrl)