jekyll-authors 0.0.1
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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +76 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/jekyll-authors.gemspec +21 -0
- data/lib/jekyll-authors/tags.rb +121 -0
- data/lib/jekyll-authors/version.rb +5 -0
- data/lib/jekyll-authors.rb +123 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4209e6a6fc998af91e2cda7f1d7254eb2497dca4
|
4
|
+
data.tar.gz: fa428c2ab5af1fb1d70c22cf8412f1eab6837128
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 04b8aa8cb3c16e70edcdea7106eeefffa939e6febcba925ab0968f968fb5638537dd5cf9dbe44bea8279fd416f08a2761db9d14c5c46d067634777b40ccc8a45
|
7
|
+
data.tar.gz: 69e17f77aef96b4a847c155ec690d5abd8df00a12deced26cf2ad4c49f1cbacc8d60bfc9e89a918c45231675aafbaf09ec10245c40a73e919e736b57e5b7fad5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll-authors (0.0.1)
|
5
|
+
jekyll (>= 0.10.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
blankslate (2.1.2.4)
|
11
|
+
celluloid (0.16.0)
|
12
|
+
timers (~> 4.0.0)
|
13
|
+
classifier-reborn (2.0.3)
|
14
|
+
fast-stemmer (~> 1.0)
|
15
|
+
coffee-script (2.4.1)
|
16
|
+
coffee-script-source
|
17
|
+
execjs
|
18
|
+
coffee-script-source (1.9.1.1)
|
19
|
+
colorator (0.1)
|
20
|
+
execjs (2.5.2)
|
21
|
+
fast-stemmer (1.0.2)
|
22
|
+
ffi (1.9.8)
|
23
|
+
hitimes (1.2.2)
|
24
|
+
jekyll (2.5.3)
|
25
|
+
classifier-reborn (~> 2.0)
|
26
|
+
colorator (~> 0.1)
|
27
|
+
jekyll-coffeescript (~> 1.0)
|
28
|
+
jekyll-gist (~> 1.0)
|
29
|
+
jekyll-paginate (~> 1.0)
|
30
|
+
jekyll-sass-converter (~> 1.0)
|
31
|
+
jekyll-watch (~> 1.1)
|
32
|
+
kramdown (~> 1.3)
|
33
|
+
liquid (~> 2.6.1)
|
34
|
+
mercenary (~> 0.3.3)
|
35
|
+
pygments.rb (~> 0.6.0)
|
36
|
+
redcarpet (~> 3.1)
|
37
|
+
safe_yaml (~> 1.0)
|
38
|
+
toml (~> 0.1.0)
|
39
|
+
jekyll-coffeescript (1.0.1)
|
40
|
+
coffee-script (~> 2.2)
|
41
|
+
jekyll-gist (1.2.1)
|
42
|
+
jekyll-paginate (1.1.0)
|
43
|
+
jekyll-sass-converter (1.3.0)
|
44
|
+
sass (~> 3.2)
|
45
|
+
jekyll-watch (1.2.1)
|
46
|
+
listen (~> 2.7)
|
47
|
+
kramdown (1.7.0)
|
48
|
+
liquid (2.6.2)
|
49
|
+
listen (2.10.1)
|
50
|
+
celluloid (~> 0.16.0)
|
51
|
+
rb-fsevent (>= 0.9.3)
|
52
|
+
rb-inotify (>= 0.9)
|
53
|
+
mercenary (0.3.5)
|
54
|
+
parslet (1.5.0)
|
55
|
+
blankslate (~> 2.0)
|
56
|
+
posix-spawn (0.3.11)
|
57
|
+
pygments.rb (0.6.3)
|
58
|
+
posix-spawn (~> 0.3.6)
|
59
|
+
yajl-ruby (~> 1.2.0)
|
60
|
+
rb-fsevent (0.9.5)
|
61
|
+
rb-inotify (0.9.5)
|
62
|
+
ffi (>= 0.5.0)
|
63
|
+
redcarpet (3.3.1)
|
64
|
+
safe_yaml (1.0.4)
|
65
|
+
sass (3.4.14)
|
66
|
+
timers (4.0.1)
|
67
|
+
hitimes
|
68
|
+
toml (0.1.2)
|
69
|
+
parslet (~> 1.5.0)
|
70
|
+
yajl-ruby (1.2.1)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
jekyll-authors!
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
Jekyll Authors
|
2
|
+
==============
|
3
|
+
|
4
|
+
This gem provides a [Jekyll](http://github.com/mojombo/jekyll) generator for
|
5
|
+
author pages, author feeds and a author index.
|
6
|
+
|
7
|
+
Basic Setup
|
8
|
+
-----------
|
9
|
+
Install the gem:
|
10
|
+
|
11
|
+
[sudo] gem install jekyll-authors
|
12
|
+
|
13
|
+
In a plugin file within your Jekyll project's _plugins directory:
|
14
|
+
|
15
|
+
# _plugins/my-plugin.rb
|
16
|
+
require "jekyll-authors"
|
17
|
+
|
18
|
+
Create the following layouts:
|
19
|
+
|
20
|
+
- author_index.html
|
21
|
+
- author_list.html
|
22
|
+
- author_feed.xml
|
23
|
+
|
24
|
+
Bundler Setup
|
25
|
+
-------------
|
26
|
+
Already using bundler to manage gems for your Jekyll project? Then just add
|
27
|
+
|
28
|
+
gem "jekyll-authors"
|
29
|
+
|
30
|
+
to your gemfile and create the following plugin in your projects _plugins
|
31
|
+
directory. I've called mine bundler.rb. This will automatically require all
|
32
|
+
of the gems specified in your Gemfile.
|
33
|
+
|
34
|
+
# _plugins/bundler.rb
|
35
|
+
require "rubygems"
|
36
|
+
require "bundler/setup"
|
37
|
+
Bundler.require(:default)
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "jekyll-authors/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "jekyll-authors"
|
7
|
+
s.version = Jekyll::Authors::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Mauro Otonelli", "Ernesto Tagwerker"]
|
10
|
+
s.email = ["mauro@ombulabs.com", "ernesto@ombulabs.com"]
|
11
|
+
s.homepage = "http://github.com/ombulabs/jekyll-authors"
|
12
|
+
s.summary = %q{Author generators for Jekyll}
|
13
|
+
s.description = %q{Provides an author index page and author atom feeds for Jekyll.}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_runtime_dependency('jekyll', [">= 0.10.0"])
|
21
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Authors
|
3
|
+
class TagIndex < Page
|
4
|
+
def initialize(site, base, dir, tag)
|
5
|
+
@site = site
|
6
|
+
@base = base
|
7
|
+
@dir = dir
|
8
|
+
@name = 'index.html'
|
9
|
+
|
10
|
+
self.process(@name)
|
11
|
+
self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
|
12
|
+
self.data['tag'] = tag
|
13
|
+
|
14
|
+
tag_title_prefix = site.config['tag_title_prefix'] || 'Tag: '
|
15
|
+
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class TagFeed < Page
|
20
|
+
def initialize(site, base, dir, tag)
|
21
|
+
@site = site
|
22
|
+
@base = base
|
23
|
+
@dir = dir
|
24
|
+
@name = 'atom.xml'
|
25
|
+
|
26
|
+
self.process(@name)
|
27
|
+
self.read_yaml(File.join(base, '_layouts'), 'tag_feed.xml')
|
28
|
+
self.data['tag'] = tag
|
29
|
+
|
30
|
+
tag_title_prefix = site.config['tag_title_prefix'] || 'Tag: '
|
31
|
+
self.data['title'] = "#{tag_title_prefix}#{tag}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class TagList < Page
|
36
|
+
def initialize(site, base, dir, tags)
|
37
|
+
@site = site
|
38
|
+
@base = base
|
39
|
+
@dir = dir
|
40
|
+
@name = 'index.html'
|
41
|
+
|
42
|
+
self.process(@name)
|
43
|
+
self.read_yaml(File.join(base, '_layouts'), 'tag_list.html')
|
44
|
+
self.data['tags'] = tags
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class TagGenerator < Generator
|
49
|
+
safe true
|
50
|
+
|
51
|
+
def generate(site)
|
52
|
+
if site.layouts.key? 'tag_index'
|
53
|
+
dir = site.config['tag_dir'] || 'tags'
|
54
|
+
site.tags.keys.each do |tag|
|
55
|
+
write_tag_index(site, File.join(dir, tag.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), tag)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
if site.layouts.key? 'tag_feed'
|
60
|
+
dir = site.config['tag_dir'] || 'tags'
|
61
|
+
site.tags.keys.each do |tag|
|
62
|
+
write_tag_feed(site, File.join(dir, tag.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), tag)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
if site.layouts.key? 'tag_list'
|
67
|
+
dir = site.config['tag_dir'] || 'tags'
|
68
|
+
write_tag_list(site, dir, site.tags.keys.sort)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def write_tag_index(site, dir, tag)
|
73
|
+
index = TagIndex.new(site, site.source, dir, tag)
|
74
|
+
index.render(site.layouts, site.site_payload)
|
75
|
+
index.write(site.dest)
|
76
|
+
site.static_files << index
|
77
|
+
end
|
78
|
+
|
79
|
+
def write_tag_feed(site, dir, tag)
|
80
|
+
index = TagFeed.new(site, site.source, dir, tag)
|
81
|
+
index.render(site.layouts, site.site_payload)
|
82
|
+
index.write(site.dest)
|
83
|
+
site.static_files << index
|
84
|
+
end
|
85
|
+
|
86
|
+
def write_tag_list(site, dir, tags)
|
87
|
+
index = TagList.new(site, site.source, dir, tags)
|
88
|
+
index.render(site.layouts, site.site_payload)
|
89
|
+
index.write(site.dest)
|
90
|
+
site.static_files << index
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Returns a correctly formatted tag url based on site configuration.
|
95
|
+
#
|
96
|
+
# Use without arguments to return the url of the tag list page.
|
97
|
+
# {% tag_url %}
|
98
|
+
#
|
99
|
+
# Use with argument to return the url of a specific catogory page. The
|
100
|
+
# argument can be either a string or a variable in the current context.
|
101
|
+
# {% tag_url tag_name %}
|
102
|
+
# {% tag_url tag_var %}
|
103
|
+
#
|
104
|
+
class TagUrlTag < Liquid::Tag
|
105
|
+
def initialize(tag_name, text, tokens)
|
106
|
+
super
|
107
|
+
@tag = text
|
108
|
+
end
|
109
|
+
|
110
|
+
def render(context)
|
111
|
+
base_url = context.registers[:site].config['base-url'] || '/'
|
112
|
+
tag_dir = context.registers[:site].config['tag_dir'] || 'tags'
|
113
|
+
|
114
|
+
tag = context[@tag] || @tag.strip.tr(' ', '-').downcase
|
115
|
+
tag.empty? ? "#{base_url}#{tag_dir}" : "#{base_url}#{tag_dir}/#{tag}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
Liquid::Template.register_tag('tag_url', Jekyll::Authors::TagUrlTag)
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'jekyll-authors/tags'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Authors
|
5
|
+
class AuthorIndex < Page
|
6
|
+
def initialize(site, base, dir, author)
|
7
|
+
@site = site
|
8
|
+
@base = base
|
9
|
+
@dir = dir
|
10
|
+
@name = 'index.html'
|
11
|
+
|
12
|
+
self.process(@name)
|
13
|
+
self.read_yaml(File.join(base, '_layouts'), 'author_index.html')
|
14
|
+
self.data['author'] = author
|
15
|
+
|
16
|
+
author_title_prefix = site.config['author_title_prefix'] || 'Author: '
|
17
|
+
self.data['title'] = "#{author_title_prefix}#{author}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class AuthorFeed < Page
|
22
|
+
def initialize(site, base, dir, author)
|
23
|
+
@site = site
|
24
|
+
@base = base
|
25
|
+
@dir = dir
|
26
|
+
@name = 'atom.xml'
|
27
|
+
|
28
|
+
self.process(@name)
|
29
|
+
self.read_yaml(File.join(base, '_layouts'), 'author_feed.xml')
|
30
|
+
self.data['author'] = author
|
31
|
+
|
32
|
+
author_title_prefix = site.config['author_title_prefix'] || 'Author: '
|
33
|
+
self.data['title'] = "#{author_title_prefix}#{author}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class AuthorList < Page
|
38
|
+
def initialize(site, base, dir, authors)
|
39
|
+
@site = site
|
40
|
+
@base = base
|
41
|
+
@dir = dir
|
42
|
+
@name = 'index.html'
|
43
|
+
|
44
|
+
self.process(@name)
|
45
|
+
self.read_yaml(File.join(base, '_layouts'), 'author_list.html')
|
46
|
+
self.data['authors'] = authors
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class AuthorGenerator < Generator
|
51
|
+
safe true
|
52
|
+
|
53
|
+
def generate(site)
|
54
|
+
if site.layouts.key? 'author_index'
|
55
|
+
dir = site.config['author_dir'] || 'authors'
|
56
|
+
site.authors.keys.each do |author|
|
57
|
+
write_author_index(site, File.join(dir, author.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), author)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
if site.layouts.key? 'author_feed'
|
62
|
+
dir = site.config['author_dir'] || 'authors'
|
63
|
+
site.authors.keys.each do |author|
|
64
|
+
write_author_feed(site, File.join(dir, author.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), author)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if site.layouts.key? 'author_list'
|
69
|
+
dir = site.config['author_dir'] || 'authors'
|
70
|
+
write_author_list(site, dir, site.authors.keys.sort)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def write_author_index(site, dir, author)
|
75
|
+
index = CategoryIndex.new(site, site.source, dir, author)
|
76
|
+
index.render(site.layouts, site.site_payload)
|
77
|
+
index.write(site.dest)
|
78
|
+
site.static_files << index
|
79
|
+
end
|
80
|
+
|
81
|
+
def write_author_feed(site, dir, author)
|
82
|
+
index = AuthorFeed.new(site, site.source, dir, author)
|
83
|
+
index.render(site.layouts, site.site_payload)
|
84
|
+
index.write(site.dest)
|
85
|
+
site.static_files << index
|
86
|
+
end
|
87
|
+
|
88
|
+
def write_author_list(site, dir, authors)
|
89
|
+
index = AuthorList.new(site, site.source, dir, authors)
|
90
|
+
index.render(site.layouts, site.site_payload)
|
91
|
+
index.write(site.dest)
|
92
|
+
site.static_files << index
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns a correctly formatted author url based on site configuration.
|
97
|
+
#
|
98
|
+
# Use without arguments to return the url of the author list page.
|
99
|
+
# {% author_url %}
|
100
|
+
#
|
101
|
+
# Use with argument to return the url of a specific catogory page. The
|
102
|
+
# argument can be either a string or a variable in the current context.
|
103
|
+
# {% author_url author_name %}
|
104
|
+
# {% author_url author_var %}
|
105
|
+
#
|
106
|
+
class AuthorUrlTag < Liquid::Tag
|
107
|
+
def initialize(tag_name, text, tokens)
|
108
|
+
super
|
109
|
+
@author = text
|
110
|
+
end
|
111
|
+
|
112
|
+
def render(context)
|
113
|
+
base_url = context.registers[:site].config['base-url'] || '/'
|
114
|
+
author_dir = context.registers[:site].config['author_dir'] || 'authors'
|
115
|
+
|
116
|
+
author = context[@author] || @author.strip.tr(' ', '-').downcase
|
117
|
+
author.empty? ? "#{base_url}#{author_dir}" : "#{base_url}#{author_dir}/#{author}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
Liquid::Template.register_tag('author_url', Jekyll::Authors::AuthorUrlTag)
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-authors
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mauro Otonelli
|
8
|
+
- Ernesto Tagwerker
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jekyll
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.10.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.10.0
|
28
|
+
description: Provides an author index page and author atom feeds for Jekyll.
|
29
|
+
email:
|
30
|
+
- mauro@ombulabs.com
|
31
|
+
- ernesto@ombulabs.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- jekyll-authors.gemspec
|
42
|
+
- lib/jekyll-authors.rb
|
43
|
+
- lib/jekyll-authors/tags.rb
|
44
|
+
- lib/jekyll-authors/version.rb
|
45
|
+
homepage: http://github.com/ombulabs/jekyll-authors
|
46
|
+
licenses: []
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.2.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Author generators for Jekyll
|
68
|
+
test_files: []
|