jekyll-tagging 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/lib/jekyll/tagging/version.rb +2 -2
- data/lib/jekyll/tagging.rb +20 -11
- metadata +12 -11
data/ChangeLog
CHANGED
data/lib/jekyll/tagging.rb
CHANGED
@@ -7,13 +7,24 @@ module Jekyll
|
|
7
7
|
|
8
8
|
safe true
|
9
9
|
|
10
|
-
DEFAULT_TAG_PAGE_DIR = 'tag'
|
11
|
-
|
12
10
|
def generate(site)
|
13
|
-
|
11
|
+
unless Tagger.const_defined?(:TAG_PAGE_DIR)
|
12
|
+
Tagger.const_set('TAG_PAGE_DIR', site.config['tag_page_dir'] || 'tag')
|
13
|
+
end
|
14
|
+
|
14
15
|
@tag_page_layout = site.config['tag_page_layout']
|
15
16
|
|
16
|
-
|
17
|
+
unless Jekyll::Filters.const_defined?(:PRETTY_URL)
|
18
|
+
Jekyll::Filters.const_set('PRETTY_URL', site.permalink_style == :pretty)
|
19
|
+
end
|
20
|
+
|
21
|
+
if @tag_page_layout
|
22
|
+
generate_tag_pages(site)
|
23
|
+
else
|
24
|
+
$stderr.puts 'WARNING: You have to define a tag_page_layout in ' +
|
25
|
+
'configuration file.'
|
26
|
+
end
|
27
|
+
|
17
28
|
site.config.update({ 'tag_data' => calculate_tag_cloud(site) })
|
18
29
|
end
|
19
30
|
|
@@ -22,7 +33,7 @@ module Jekyll
|
|
22
33
|
# to use this.
|
23
34
|
def generate_tag_pages(site)
|
24
35
|
site.tags.each { |tag, posts|
|
25
|
-
site.pages << new_tag_page(site, site.source,
|
36
|
+
site.pages << new_tag_page(site, site.source, TAG_PAGE_DIR, tag, posts.sort.reverse)
|
26
37
|
}
|
27
38
|
end
|
28
39
|
|
@@ -68,10 +79,8 @@ module Jekyll
|
|
68
79
|
module Filters
|
69
80
|
|
70
81
|
def tag_cloud(site)
|
71
|
-
dir = site['tag_page_dir']
|
72
|
-
|
73
82
|
site['tag_data'].map { |tag, set|
|
74
|
-
tag_link(tag, tag_url(tag
|
83
|
+
tag_link(tag, tag_url(tag), { :class => "set-#{set}" })
|
75
84
|
}.join(' ')
|
76
85
|
end
|
77
86
|
|
@@ -82,12 +91,12 @@ module Jekyll
|
|
82
91
|
%Q{<a href="#{url}"#{html_opts}>#{tag}</a>}
|
83
92
|
end
|
84
93
|
|
85
|
-
def tag_url(tag
|
86
|
-
"/#{
|
94
|
+
def tag_url(tag)
|
95
|
+
"/#{Tagger::TAG_PAGE_DIR}/#{ERB::Util.u(tag)}#{'.html' unless PRETTY_URL}"
|
87
96
|
end
|
88
97
|
|
89
98
|
def tags(obj)
|
90
|
-
tags = obj['tags'][0].is_a?(Array) ? obj['tags'].map{ |t| t[0]} : obj['tags']
|
99
|
+
tags = obj['tags'][0].is_a?(Array) ? obj['tags'].map{ |t| t[0] } : obj['tags']
|
91
100
|
tags.map { |t| tag_link(t, tag_url(t)) if t.is_a?(String) }.compact.join(', ')
|
92
101
|
end
|
93
102
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tagging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Arne Eilermann
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-03-10 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -47,21 +47,22 @@ files:
|
|
47
47
|
- lib/jekyll/tagging/version.rb
|
48
48
|
- lib/jekyll/tagging.rb
|
49
49
|
- ChangeLog
|
50
|
-
- README.rdoc
|
51
50
|
- Rakefile
|
51
|
+
- README.rdoc
|
52
52
|
has_rdoc: true
|
53
53
|
homepage: http://github.com/pattex/jekyll-tagging
|
54
54
|
licenses: []
|
55
55
|
|
56
56
|
post_install_message:
|
57
57
|
rdoc_options:
|
58
|
-
- --
|
59
|
-
- --title
|
60
|
-
- jekyll-tagging Application documentation (v0.1.2)
|
61
|
-
- --inline-source
|
58
|
+
- --all
|
62
59
|
- --charset
|
63
60
|
- UTF-8
|
64
|
-
- --
|
61
|
+
- --main
|
62
|
+
- ChangeLog
|
63
|
+
- --title
|
64
|
+
- jekyll-tagging Application documentation (v0.2.0)
|
65
|
+
- --line-numbers
|
65
66
|
require_paths:
|
66
67
|
- lib
|
67
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
86
|
requirements: []
|
86
87
|
|
87
88
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
89
|
+
rubygems_version: 1.5.2
|
89
90
|
signing_key:
|
90
91
|
specification_version: 3
|
91
92
|
summary: Jekyll plugin to automatically generate a tag cloud and tag pages.
|