jekyll-mentions 1.5.1 → 1.6.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 +16 -10
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 996edd82c9c80ad5a3774d78d279fd75beb84f03812d218cf2b2eea942130e72
4
- data.tar.gz: f8ce9881c7247c802632ce87a382ecf59e9c0458287501aa06cf4f97943fe2e7
3
+ metadata.gz: b5e0f98686e0994a76293868c6a2b233cc3a7129c24564b9e60c0b7434c94247
4
+ data.tar.gz: 2bc905f57f71087a55217e2df95f8968160dd6cf07175ad7a2f8707be7901081
5
5
  SHA512:
6
- metadata.gz: bb6c01145b55d42eba2f8623e8c6c6b8568f0458563ab89dc5d23c3d4f61e40abbc8ea2c1f506f0506750e89697ef063c7681702281861d1ad7cb32f899a7543
7
- data.tar.gz: 9494a57cd572a132ce3f2111ec2aa5e7365518b02881b9c89fac4ecd1c0dbd370edaacdd8953c00d11ad5683b884ccde07b13e788d53832a6688bf5c87c320de
6
+ metadata.gz: b243373d63ee58f0315f3aacfcd45106628dc053de3658aad6d5eed5aa01e13ddf1382fcffc3df68f914159503c52b023eaf65f8644260e63007e4103ade18f7
7
+ data.tar.gz: 9ee9b5e187ed0837f4bb104f71ca55030d2935de865de4cc832fee5f1830fbce7962d69a7bd25273a314e418f637a2e8777391d360aef38633d8462c2ad89249
@@ -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*!.freeze
11
+ OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!m.freeze
12
12
 
13
13
  InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
14
14
 
@@ -18,17 +18,21 @@ module Jekyll
18
18
  content = doc.output
19
19
  return unless content.include?("@")
20
20
 
21
- src = mention_base(doc.site.config)
21
+ config = doc.site.config
22
+ config = config.merge(doc.data) if doc.data.key?("jekyll-mentions")
23
+
24
+ src = mention_base(config)
25
+
22
26
  if content.include? BODY_START_TAG
23
27
  head, opener, tail = content.partition(OPENING_BODY_TAG_REGEX)
24
28
  body_content, *rest = tail.partition("</body>")
25
29
 
26
- return unless body_content =~ filter_regex
30
+ return unless body_content&.match?(filter_regex)
27
31
 
28
32
  processed_markup = filter_with_mention(src).call(body_content)[:output].to_s
29
33
  doc.output = String.new(head) << opener << processed_markup << rest.join
30
34
  else
31
- return unless content =~ filter_regex
35
+ return unless content&.match?(filter_regex)
32
36
 
33
37
  doc.output = filter_with_mention(src).call(content)[:output].to_s
34
38
  end
@@ -57,12 +61,13 @@ module Jekyll
57
61
  end
58
62
 
59
63
  # Public: Calculate the base URL to use for mentioning.
60
- # The custom base URL can be defined in the config as
61
- # jekyll-mentions.base_url or jekyll-mentions, and must
62
- # be a valid URL (i.e. it must include a protocol and valid domain)
64
+ #
65
+ # The custom base URL can be defined in either the site config or a document's
66
+ # front matter as `jekyll-mentions.base_url` or `jekyll-mentions`, and must be
67
+ # a valid URL (i.e. it must include a protocol and valid domain).
63
68
  # It should _not_ have a trailing slash.
64
69
  #
65
- # config - the hash-like configuration of the document's site
70
+ # config - The effective configuration that includes configurations for mentions.
66
71
  #
67
72
  # Returns a URL to use as the base URL for mentions.
68
73
  # Defaults to the https://github.com.
@@ -82,14 +87,15 @@ module Jekyll
82
87
  end
83
88
  end
84
89
 
85
- # Public: Defines the conditions for a document to be emojiable.
90
+ # Public: Defines the conditions for a document to be mentionable.
86
91
  #
87
92
  # doc - the Jekyll::Document or Jekyll::Page
88
93
  #
89
94
  # Returns true if the doc is written & is HTML.
90
95
  def mentionable?(doc)
91
96
  (doc.is_a?(Jekyll::Page) || doc.write?) &&
92
- doc.output_ext == ".html" || (doc.permalink&.end_with?("/"))
97
+ (doc.output_ext == ".html" || (doc.permalink&.end_with?("/"))) &&
98
+ (doc.data["jekyll-mentions"] != false)
93
99
  end
94
100
 
95
101
  private
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.5.1
4
+ version: 1.6.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: 2019-03-23 00:00:00.000000000 Z
11
+ date: 2020-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -119,14 +119,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 2.3.0
122
+ version: 2.4.0
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.3
129
+ rubygems_version: 3.0.6
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: "@mention support for your Jekyll site"