Skip to content

Commit a78177b

Browse files
authored
chore(deps): rubocop-jekyll 0.3 (#65)
Merge pull request 65
1 parent 34efb89 commit a78177b

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

.rubocop.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,3 @@ AllCops:
55
TargetRubyVersion: 2.3
66
Exclude:
77
- vendor/**/*
8-
9-
Metrics/LineLength:
10-
Exclude:
11-
- spec/**/*
12-
- jekyll-mentions.gemspec
13-
14-
Metrics/BlockLength:
15-
Exclude:
16-
- spec/**/*

jekyll-mentions.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
2121

2222
s.add_development_dependency "rake", "~> 12.0"
2323
s.add_development_dependency "rspec", "~> 3.0"
24-
s.add_development_dependency "rubocop", "~> 0.57.2"
24+
s.add_development_dependency "rubocop-jekyll", "~> 0.3"
2525
end

lib/jekyll-mentions.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Mentions
88
GITHUB_DOT_COM = "https://github.com"
99
BODY_START_TAG = "<body"
1010

11-
OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!
11+
OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!.freeze
1212

1313
InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
1414

@@ -17,6 +17,7 @@ class << self
1717
def mentionify(doc)
1818
content = doc.output
1919
return unless content.include?("@")
20+
2021
src = mention_base(doc.site.config)
2122
if content.include? BODY_START_TAG
2223
head, opener, tail = content.partition(OPENING_BODY_TAG_REGEX)
@@ -28,6 +29,7 @@ def mentionify(doc)
2829
doc.output = String.new(head) << opener << processed_markup << rest.join
2930
else
3031
return unless content =~ filter_regex
32+
3133
doc.output = filter_with_mention(src).call(content)[:output].to_s
3234
end
3335
end
@@ -93,13 +95,14 @@ def mentionable?(doc)
9395
private
9496

9597
def filter_regex
96-
@filter_regex ||= begin
97-
Regexp.new(
98-
HTML::Pipeline::MentionFilter::MentionPatterns[mention_username_pattern]
99-
)
100-
rescue TypeError
101-
%r!@\w+!
102-
end
98+
@filter_regex ||=
99+
begin
100+
Regexp.new(
101+
HTML::Pipeline::MentionFilter::MentionPatterns[mention_username_pattern]
102+
)
103+
rescue TypeError
104+
%r!@\w+!
105+
end
103106
end
104107

105108
def default_mention_base

0 commit comments

Comments
 (0)