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 CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.0 [2011-03-10]
2
+
3
+ * Added support for pretty tag page URLs.
4
+ * Some bugs fixed.
5
+
1
6
  == 0.1.2 [2011-01-31]
2
7
 
3
8
  * Nothing to do when there are no tags.
@@ -5,8 +5,8 @@ module Jekyll
5
5
  module Version
6
6
 
7
7
  MAJOR = 0
8
- MINOR = 1
9
- TINY = 2
8
+ MINOR = 2
9
+ TINY = 0
10
10
 
11
11
  class << self
12
12
 
@@ -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
- @tag_page_dir = site.config['tag_page_dir'] || DEFAULT_TAG_PAGE_DIR
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
- generate_tag_pages(site) if @tag_page_layout
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, @tag_page_dir, tag, posts.sort.reverse)
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, dir), { :class => "set-#{set}" })
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, dir = Tagger::DEFAULT_TAG_PAGE_DIR)
86
- "/#{dir}/#{ERB::Util.u(tag)}.html"
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: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
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-01-31 00:00:00 +01:00
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
- - --line-numbers
59
- - --title
60
- - jekyll-tagging Application documentation (v0.1.2)
61
- - --inline-source
58
+ - --all
62
59
  - --charset
63
60
  - UTF-8
64
- - --all
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.4.2
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.