jekyll-tagging 0.4.0 → 0.5.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03a01587a551adf47669ffa68399c99d4ee65cbc
4
+ data.tar.gz: 5ddd9144261b001c6dea775314705c6028170153
5
+ SHA512:
6
+ metadata.gz: 240e4046229f6b1faad342901a3306f07fa88e1b496adb6b75931476f24ac0199505b11397f1534511edd4d05668c55ff52f9e458fb1ea9e564e1c7b42da12c1
7
+ data.tar.gz: 39b7db326f9cf5e0896e8055a03a8681c7da75958e4363e98888b7efaadfd7fcf30183fbfebb05625f88184aabdcda9509abda6d74c5cf8e010eda8e7bbf6c13
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.5.0 [2013-06-06]
2
+
3
+ * Added rel="tag" to posts' tag links. (Brandon Hicks)
4
+ * Added support for ignored tags. (Zee Spencer)
5
+
1
6
  == 0.4.0 [2012-10-22]
2
7
 
3
8
  * Heavy refactoring to better support monkey patching.
@@ -25,10 +25,13 @@ You can optionally define a per tag Atom/RSS feed. In your <tt>_config.yml</tt>
25
25
 
26
26
  tag_feed_layout: tag_feed
27
27
  tag_feed_dir: tag
28
-
28
+
29
29
  (<tt>tag_page_dir</tt> and <tt>tag_feed_dir</tt> can have the same value.)
30
30
 
31
31
 
32
+ === Ignoring tags
33
+
34
+ Sometimes you don't want tag pages generated for certain pages. That's ok! Just add <tt>ignored_tags: [tags,to,ignore]</tt> to your <tt>_config.yml</tt>
32
35
  === Example tag page layout
33
36
 
34
37
  ---
@@ -44,15 +47,15 @@ You can optionally define a per tag Atom/RSS feed. In your <tt>_config.yml</tt>
44
47
  <div id="tag-cloud">
45
48
  {{ site | tag_cloud }}
46
49
  </div>
47
-
48
-
50
+
51
+
49
52
  === Example layout of an Atom feed
50
53
 
51
54
  ---
52
55
  layout: nil
53
56
  ---
54
57
  <?xml version="1.0" encoding="utf-8"?>
55
- <feed xmlns="http://www.w3.org/2005/Atom">
58
+ <feed xmlns="http://www.w3.org/2005/Atom">
56
59
  <title>Your Title - {{ page.tag }}</title>
57
60
  <link href="http://example.com{{ page.url }}" rel="self"/>
58
61
  <link href="http://example.com/tag/{{ page.tag }}.html"/>
@@ -26,7 +26,7 @@ module Jekyll
26
26
  # A <tt>tag_page_layout</tt> have to be defined in your <tt>_config.yml</tt>
27
27
  # to use this.
28
28
  def generate_tag_pages
29
- site.tags.each { |tag, posts| new_tag(tag, posts) }
29
+ active_tags.each { |tag, posts| new_tag(tag, posts) }
30
30
  end
31
31
 
32
32
  def new_tag(tag, posts)
@@ -56,15 +56,21 @@ module Jekyll
56
56
  def calculate_tag_cloud(num = 5)
57
57
  range = 0
58
58
 
59
- tags = site.tags.map { |tag, posts|
59
+ tags = active_tags.map { |tag, posts|
60
60
  [tag.to_s, range < (size = posts.size) ? range = size : size]
61
61
  }
62
62
 
63
+
63
64
  range = 1..range
64
65
 
65
66
  tags.sort!.map! { |tag, size| [tag, range.quantile(size, num)] }
66
67
  end
67
68
 
69
+ def active_tags
70
+ return site.tags unless site.config["ignored_tags"]
71
+ site.tags.reject { |t| site.config["ignored_tags"].include? t[0] }
72
+ end
73
+
68
74
  end
69
75
 
70
76
  class TagPage < Page
@@ -87,7 +93,7 @@ module Jekyll
87
93
  module Filters
88
94
 
89
95
  def tag_cloud(site)
90
- site['tag_data'].map { |tag, set|
96
+ active_tag_data.map { |tag, set|
91
97
  tag_link(tag, tag_url(tag), :class => "set-#{set}")
92
98
  }.join(' ')
93
99
  end
@@ -105,10 +111,14 @@ module Jekyll
105
111
  def tags(obj)
106
112
  tags = obj['tags'].dup
107
113
  tags.map! { |t| t.first } if tags.first.is_a?(Array)
108
- tags.map! { |t| tag_link(t, tag_url(t)) if t.is_a?(String) }.compact!
114
+ tags.map! { |t| tag_link(t, tag_url(t), :rel => 'tag') if t.is_a?(String) }.compact!
109
115
  tags.join(', ')
110
116
  end
111
117
 
118
+ def active_tag_data(site = Tagger.site)
119
+ return site.config['tag_data'] unless site.config["ignored_tags"]
120
+ site.config["tag_data"].reject { |tag, set| site.config["ignored_tags"].include? tag }
121
+ end
112
122
  end
113
123
 
114
124
  end
@@ -5,7 +5,7 @@ module Jekyll
5
5
  module Version
6
6
 
7
7
  MAJOR = 0
8
- MINOR = 4
8
+ MINOR = 5
9
9
  TINY = 0
10
10
 
11
11
  class << self
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-tagging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Arne Eilermann
@@ -10,22 +9,20 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-10-22 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: ruby-nuggets
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  description: Jekyll plugin to automatically generate a tag cloud and tag pages.
@@ -39,11 +36,12 @@ extra_rdoc_files:
39
36
  files:
40
37
  - lib/jekyll/tagging.rb
41
38
  - lib/jekyll/tagging/version.rb
42
- - README.rdoc
43
39
  - ChangeLog
40
+ - README.rdoc
44
41
  - Rakefile
45
42
  homepage: http://github.com/pattex/jekyll-tagging
46
43
  licenses: []
44
+ metadata: {}
47
45
  post_install_message:
48
46
  rdoc_options:
49
47
  - --charset
@@ -51,27 +49,25 @@ rdoc_options:
51
49
  - --line-numbers
52
50
  - --all
53
51
  - --title
54
- - jekyll-tagging Application documentation (v0.4.0)
52
+ - jekyll-tagging Application documentation (v0.5.0)
55
53
  - --main
56
54
  - ChangeLog
57
55
  require_paths:
58
56
  - lib
59
57
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
58
  requirements:
62
- - - ! '>='
59
+ - - '>='
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
62
  required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
63
  requirements:
68
- - - ! '>='
64
+ - - '>='
69
65
  - !ruby/object:Gem::Version
70
66
  version: '0'
71
67
  requirements: []
72
68
  rubyforge_project:
73
- rubygems_version: 1.8.24
69
+ rubygems_version: 2.0.3
74
70
  signing_key:
75
- specification_version: 3
71
+ specification_version: 4
76
72
  summary: Jekyll plugin to automatically generate a tag cloud and tag pages.
77
73
  test_files: []