jekyll-mentions 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-mentions.rb +15 -12
  3. metadata +31 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 670e75c1d3673af75ac30aa9bea725c333652ddb5836df91860b56687d4cbb70
4
- data.tar.gz: ccd2e43c0410f7ca7968c466c8070dbb67cd1de9a6c765653859d64a74c24006
3
+ metadata.gz: f1ffce69767436058819f0c3af92d3113b2c92b9252bce2d424385e0096793f1
4
+ data.tar.gz: 2dde31e17c6c0cd84a18483cf2484e22461ee36e58a9fcfef75e77da155ae341
5
5
  SHA512:
6
- metadata.gz: 3499b620e5e3d45616b99d2dae62345534609015f9bc17e2dfdc616a591e0ad551229f8e716918dd757a1d5ee417d657172025e92e970e75902adee7dfaeeb64
7
- data.tar.gz: f7411204e7acceba0fe20b957861c5880d8a18e0530871ad23f1c87ec1cbb3d6da9cfba940ec768df02df0eff6fe2cd7610c352496754385ab5e540493291c3d
6
+ metadata.gz: 1d434e5f10d31a5c6b8529562accfd5b62638e14e8a79ad97b36f0cad17b5145a3032b6b209e51d30fe9e23d7b1b824fa71fe4c756d0350420e807de43285f6f
7
+ data.tar.gz: c89dd484b4d2b34b87b78ab25e3233397e83e18cd00bccdb91cf5341d5710e911107c9cb70a91248b5408edeb1635819c36940eb39f2ea69c568b12d897369d6
@@ -8,7 +8,7 @@ module Jekyll
8
8
  GITHUB_DOT_COM = "https://github.com"
9
9
  BODY_START_TAG = "<body"
10
10
 
11
- OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!
11
+ OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!.freeze
12
12
 
13
13
  InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
14
14
 
@@ -17,6 +17,7 @@ module Jekyll
17
17
  def mentionify(doc)
18
18
  content = doc.output
19
19
  return unless content.include?("@")
20
+
20
21
  src = mention_base(doc.site.config)
21
22
  if content.include? BODY_START_TAG
22
23
  head, opener, tail = content.partition(OPENING_BODY_TAG_REGEX)
@@ -28,6 +29,7 @@ module Jekyll
28
29
  doc.output = String.new(head) << opener << processed_markup << rest.join
29
30
  else
30
31
  return unless content =~ filter_regex
32
+
31
33
  doc.output = filter_with_mention(src).call(content)[:output].to_s
32
34
  end
33
35
  end
@@ -41,7 +43,7 @@ module Jekyll
41
43
  def filter_with_mention(src)
42
44
  filters[src] ||= HTML::Pipeline.new([
43
45
  HTML::Pipeline::MentionFilter,
44
- ], { :base_url => src, :username_pattern => mention_username_pattern })
46
+ ], :base_url => src, :username_pattern => mention_username_pattern)
45
47
  end
46
48
 
47
49
  def mention_username_pattern
@@ -75,8 +77,8 @@ module Jekyll
75
77
  mention_config.fetch("base_url", default_mention_base)
76
78
  else
77
79
  raise InvalidJekyllMentionConfig,
78
- "Your jekyll-mentions config has to either be a" \
79
- " string or a hash. It's a #{mention_config.class} right now."
80
+ "Your jekyll-mentions config has to either be a string or a hash. " \
81
+ "It's a #{mention_config.class} right now."
80
82
  end
81
83
  end
82
84
 
@@ -93,13 +95,14 @@ module Jekyll
93
95
  private
94
96
 
95
97
  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
103
106
  end
104
107
 
105
108
  def default_mention_base
@@ -114,6 +117,6 @@ module Jekyll
114
117
  end
115
118
  end
116
119
 
117
- Jekyll::Hooks.register %i[pages documents], :post_render do |doc|
120
+ Jekyll::Hooks.register [:pages, :documents], :post_render do |doc|
118
121
  Jekyll::Mentions.mentionify(doc) if Jekyll::Mentions.mentionable?(doc)
119
122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-mentions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-08 00:00:00.000000000 Z
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -28,16 +28,36 @@ dependencies:
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: '3.7'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '5.0'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: '3.0'
43
+ version: '3.7'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rake
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +87,19 @@ dependencies:
67
87
  - !ruby/object:Gem::Version
68
88
  version: '3.0'
69
89
  - !ruby/object:Gem::Dependency
70
- name: rubocop
90
+ name: rubocop-jekyll
71
91
  requirement: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: 0.57.2
95
+ version: '0.4'
76
96
  type: :development
77
97
  prerelease: false
78
98
  version_requirements: !ruby/object:Gem::Requirement
79
99
  requirements:
80
100
  - - "~>"
81
101
  - !ruby/object:Gem::Version
82
- version: 0.57.2
102
+ version: '0.4'
83
103
  description:
84
104
  email: support@github.com
85
105
  executables: []
@@ -99,15 +119,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
119
  requirements:
100
120
  - - ">="
101
121
  - !ruby/object:Gem::Version
102
- version: 2.3.0
122
+ version: 2.4.0
103
123
  required_rubygems_version: !ruby/object:Gem::Requirement
104
124
  requirements:
105
125
  - - ">="
106
126
  - !ruby/object:Gem::Version
107
127
  version: '0'
108
128
  requirements: []
109
- rubyforge_project:
110
- rubygems_version: 2.7.7
129
+ rubygems_version: 3.0.3
111
130
  signing_key:
112
131
  specification_version: 4
113
132
  summary: "@mention support for your Jekyll site"