jekyll-mentions 0.1.2 → 0.1.3

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 -4
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0cf042d821c487a934227b47778c36fae4f75b5
4
- data.tar.gz: d1a81d6d9ac676792fdf199a46e50d245536defa
3
+ metadata.gz: 02e70d12e1216d5fde99af36c90f4e521e803e92
4
+ data.tar.gz: 052da586d9c95cee55bf4865a8296053802827a7
5
5
  SHA512:
6
- metadata.gz: e6404a09fd5e4f8ec2a334906e4cf49c27d23b17c3554b7f4e6f329f2140c50e101d8ceb0243e71a0a2a455a5d15432d0bc92e431a2ad5c20dd8bf30c2a4b891
7
- data.tar.gz: 7cda778f9943d941045a2159ba549fc501c049b3be28c562b389d16631f3f4e5fda31b9f9e3f3cb03244e8fad10c0949bdc7c60dbf99e5ccaf10f9c894885367
6
+ metadata.gz: 3cea9b226accdffe648f8b33a3e1c9f382ac341947cc6fab6f2b9ada3fc2f4e206a431b9270591a84c6c44d05575799bcc88fdcdafb504a119b3ef5b52e7a335
7
+ data.tar.gz: 2d883bff8e1d87741a7c9a54636df713f68ed75b2d16022ae9275e75c1f4fd300c1da4f966eef12e8befd7e386d15b5aca5be25bcd0342ac21d9e720e838876e
@@ -3,13 +3,12 @@ require 'html/pipeline'
3
3
 
4
4
  module Jekyll
5
5
  class Mentions < Jekyll::Generator
6
-
7
6
  safe true
8
7
 
9
- URL = "https://github.com"
8
+ DEFAULT_URL = "https://github.com"
10
9
 
11
- def initialize(site)
12
- @filter = HTML::Pipeline::MentionFilter.new(nil, {:base_url => URL })
10
+ def initialize(config = Hash.new)
11
+ @filter = HTML::Pipeline::MentionFilter.new(nil, {:base_url => base_url(config['jekyll-mentions']) })
13
12
  end
14
13
 
15
14
  def generate(site)
@@ -25,5 +24,18 @@ module Jekyll
25
24
  def html_page?(page)
26
25
  page.html? || page.url.end_with?('/')
27
26
  end
27
+
28
+ def base_url(configs)
29
+ case configs
30
+ when nil, NilClass
31
+ DEFAULT_URL
32
+ when String
33
+ configs.to_s
34
+ when Hash
35
+ configs.fetch('base_url', DEFAULT_URL)
36
+ else
37
+ raise ArgumentError.new("Your jekyll-mentions config has to either be a string or a hash! It's a #{configs.class} right now.")
38
+ end
39
+ end
28
40
  end
29
41
  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: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-10 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.0
33
+ version: 1.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.5.0
40
+ version: 1.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.2.0
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: "@mention support for your Jekyll site"