jekyll-authors 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c73f67b55705106d4c373c494600845a91751b8
4
- data.tar.gz: f6af24c9c746df01f0e615659356f747a20cd490
3
+ metadata.gz: f1aabff063e1458d62bb753264526742d982a9bf
4
+ data.tar.gz: de2097638656f6790618855fd815ac46347ecb4e
5
5
  SHA512:
6
- metadata.gz: fa019f58b66891bf0f3abea129e63591721c8441fd579aff7353afbeba5bdd5370a46f0fa728eb5aef9a99fedea8d06c957a708df4909b27d7f22c5b401dd6c6
7
- data.tar.gz: 81f4b6ad80806724e09b20025e18d7018744900c21d6463eeb7a0d47ad0044d0acc87e01dbf6cc99965871df5039a3ab147074670feecf2bea99b3fcd5f38a4a
6
+ metadata.gz: efc2926535b10d15777202a43bee7e2988d28bdd2c3d964e52c680035b2f5b3f2deff6878e732ee11025554829ed1e18513fbfaf07a792fbf0aef6cb40cbccf5
7
+ data.tar.gz: 7737504f2ed13b4d777e181bc3bc3bb3e9266676c2b1251303cbd1303ccc3e023280bc0114853c5ee16a54eedbb2cf9d4343beecf06b6a35a2ff6a943ea4fe1c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-authors (0.0.2)
4
+ jekyll-authors (0.0.3)
5
5
  jekyll (>= 0.10.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -2,7 +2,7 @@ Jekyll Authors
2
2
  ==============
3
3
 
4
4
  This gem provides a [Jekyll](http://github.com/mojombo/jekyll) generator for
5
- author pages, author feeds and a author index.
5
+ author pages, author feeds and an author index.
6
6
 
7
7
  Basic Setup
8
8
  -----------
@@ -2,7 +2,34 @@ require 'jekyll-authors/tags'
2
2
 
3
3
  module Jekyll
4
4
  module Authors
5
+ module Utils
6
+
7
+ # Returns the `display_name` associated with the author. If there isn't
8
+ # one, it returns the nickname.
9
+ #
10
+ # @param author [String]
11
+ # @return [String]
12
+ def display_name(author)
13
+ return unless site.config['authors']
14
+
15
+ if site.config['authors'][author]
16
+ site.config['authors'][author]['display_name']
17
+ else
18
+ author
19
+ end
20
+ end
21
+
22
+ # Returns the `author_title_prefix` or "Author: "
23
+ #
24
+ # @return [String]
25
+ def author_title_prefix
26
+ site.config['author_title_prefix'] || 'Author: '
27
+ end
28
+ end
29
+
5
30
  class AuthorIndex < Page
31
+ include Jekyll::Authors::Utils
32
+
6
33
  def initialize(site, base, dir, author)
7
34
  @site = site
8
35
  @base = base
@@ -12,12 +39,13 @@ module Jekyll
12
39
  self.process(@name)
13
40
  self.read_yaml(File.join(base, '_layouts'), 'author_index.html')
14
41
  self.data['author'] = author
15
- author_title_prefix = site.config['author_title_prefix'] || 'Author: '
16
- self.data['title'] = "#{author_title_prefix}#{author}"
42
+ self.data['title'] = "#{author_title_prefix}#{display_name(author)}"
17
43
  end
18
44
  end
19
45
 
20
46
  class AuthorFeed < Page
47
+ include Jekyll::Authors::Utils
48
+
21
49
  def initialize(site, base, dir, author)
22
50
  @site = site
23
51
  @base = base
@@ -27,8 +55,6 @@ module Jekyll
27
55
  self.process(@name)
28
56
  self.read_yaml(File.join(base, '_layouts'), 'author_feed.xml')
29
57
  self.data['author'] = author
30
-
31
- author_title_prefix = site.config['author_title_prefix'] || 'Author: '
32
58
  self.data['title'] = "#{author_title_prefix}#{author}"
33
59
  end
34
60
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Authors
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-authors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauro Otonelli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-22 00:00:00.000000000 Z
12
+ date: 2016-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll