jekyll-mentions 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jekyll-mentions.rb +15 -12
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0e89bf24b373986c0a5934b996d213d48b650ef6561c875ac63d549688d9175
|
4
|
+
data.tar.gz: 3b1aaab991d6ac8039918f5ade4b68cbad5015db70d6d7ada4854222672da470
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c7e8c1dcc85fae48b7c81e54af94842d8d1c5c32365e309aa260290bb1636a896540928331ff25fe0f309afca8cadce84d5e9b0741612a000fa58b9bfd1ea7
|
7
|
+
data.tar.gz: adcdff7b0d75a5f5de02804e8d4c46dc98f43dbe6f30059f5698bdb6b617f5f7344c10c44ac0587200f16ef645772d67c65504b8ffc75ca2616f8f46fb505b79
|
data/lib/jekyll-mentions.rb
CHANGED
@@ -5,27 +5,30 @@ require "html/pipeline"
|
|
5
5
|
|
6
6
|
module Jekyll
|
7
7
|
class Mentions
|
8
|
-
GITHUB_DOT_COM = "https://github.com"
|
9
|
-
BODY_START_TAG = "<body"
|
8
|
+
GITHUB_DOT_COM = "https://github.com"
|
9
|
+
BODY_START_TAG = "<body"
|
10
|
+
|
11
|
+
OPENING_BODY_TAG_REGEX = %r!<body(.*)>\s*!
|
10
12
|
|
11
13
|
InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
|
12
14
|
|
13
15
|
class << self
|
14
16
|
# rubocop:disable Metrics/AbcSize
|
15
17
|
def mentionify(doc)
|
16
|
-
|
18
|
+
content = doc.output
|
19
|
+
return unless content.include?("@")
|
17
20
|
src = mention_base(doc.site.config)
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
+
if content.include? BODY_START_TAG
|
22
|
+
head, opener, tail = content.partition(OPENING_BODY_TAG_REGEX)
|
23
|
+
body_content, *rest = tail.partition("</body>")
|
21
24
|
|
22
|
-
return unless
|
25
|
+
return unless body_content =~ filter_regex
|
23
26
|
|
24
|
-
|
25
|
-
doc.output
|
27
|
+
processed_markup = filter_with_mention(src).call(body_content)[:output].to_s
|
28
|
+
doc.output = String.new(head) << opener << processed_markup << rest.join
|
26
29
|
else
|
27
|
-
return unless
|
28
|
-
doc.output = filter_with_mention(src).call(
|
30
|
+
return unless content =~ filter_regex
|
31
|
+
doc.output = filter_with_mention(src).call(content)[:output].to_s
|
29
32
|
end
|
30
33
|
end
|
31
34
|
# rubocop:enable Metrics/AbcSize
|
@@ -84,7 +87,7 @@ module Jekyll
|
|
84
87
|
# Returns true if the doc is written & is HTML.
|
85
88
|
def mentionable?(doc)
|
86
89
|
(doc.is_a?(Jekyll::Page) || doc.write?) &&
|
87
|
-
doc.output_ext == ".html" || (doc.permalink
|
90
|
+
doc.output_ext == ".html" || (doc.permalink&.end_with?("/"))
|
88
91
|
end
|
89
92
|
|
90
93
|
private
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-mentions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.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-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '4.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: html-pipeline
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,14 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - '='
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
75
|
+
version: '0.55'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - '='
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
82
|
+
version: '0.55'
|
97
83
|
description:
|
98
84
|
email: support@github.com
|
99
85
|
executables: []
|
@@ -113,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
99
|
requirements:
|
114
100
|
- - ">="
|
115
101
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
102
|
+
version: 2.3.0
|
117
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
104
|
requirements:
|
119
105
|
- - ">="
|