jekyll-issue-mentions 0.1.2 → 0.1.4
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-issue-mentions.rb +15 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 014068c1a07d6b50e0ca713430d7fd9a05ade586
|
4
|
+
data.tar.gz: 5a33ca964326c54e6bf0ff1c070c9748d01d49aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a012d075ec6ed451efea9ee239a0be1789f0c8c996df0e91a57ff48c900cb8507ba982e0f3edeba13777e91f975bd4669b3366cbda81c6a092984096a9d4fb74
|
7
|
+
data.tar.gz: ff3cea62ecde9726d8eccde9d518428f72930f104b492fb9572b95f77a69bf789fc0ca599019991d8fdd23b4089ff7bc5f11179d9af9ce5263bca13fdbbc90c8
|
@@ -5,9 +5,11 @@ require 'issue_mention_filter'
|
|
5
5
|
module Jekyll
|
6
6
|
class IssueMentions < Jekyll::Generator
|
7
7
|
safe true
|
8
|
+
attr_reader :base_url, :issueid_pattern
|
8
9
|
|
9
10
|
def initialize(config = Hash.new)
|
10
|
-
|
11
|
+
validate_config!(config)
|
12
|
+
@filter = HTML::Pipeline::IssueMentionFilter.new(nil, base_url: base_url, issueid_pattern: issueid_pattern)
|
11
13
|
end
|
12
14
|
|
13
15
|
def generate(site)
|
@@ -25,22 +27,22 @@ module Jekyll
|
|
25
27
|
page.html? || page.url.end_with?('/')
|
26
28
|
end
|
27
29
|
|
28
|
-
|
30
|
+
private
|
31
|
+
def validate_config!(configs)
|
32
|
+
configs = configs['jekyll-issue-mentions']
|
33
|
+
base_url = issueid_pattern = nil
|
29
34
|
case configs
|
30
|
-
when nil, NilClass
|
31
|
-
raise ArgumentError.new("Your jekyll-issue-mentions config has to configured.")
|
32
35
|
when String
|
33
|
-
configs
|
36
|
+
base_url = configs
|
34
37
|
when Hash
|
35
|
-
base_url = configs['base_url']
|
36
|
-
if
|
37
|
-
raise ArgumentError.new("Your jekyll-issue-mentions is missing base_url configuration.")
|
38
|
-
else
|
39
|
-
base_url
|
40
|
-
end
|
41
|
-
else
|
42
|
-
raise ArgumentError.new("Your jekyll-issue-mentions config has to either be a string or a hash! It's a #{configs.class} right now.")
|
38
|
+
base_url, issueid_pattern = configs['base_url'], configs['issueid_pattern']
|
39
|
+
issueid_pattern = /#{issueid_pattern}/ if issueid_pattern.is_a?(String)
|
43
40
|
end
|
41
|
+
error_prefix = "jekyll-issue-mentions"
|
42
|
+
raise ArgumentError.new("#{error_prefix}.base_url is missing/empty") if (base_url.nil? || base_url.empty?)
|
43
|
+
raise ArgumentError.new("#{error_prefix}.issueid_pattern is invalid") if (!issueid_pattern.nil? && !issueid_pattern.is_a?(Regexp))
|
44
|
+
|
45
|
+
@base_url, @issueid_pattern = base_url, issueid_pattern
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-issue-mentions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harish Shetty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|