dimples 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5c65d03c199955ae095e192c3c8346b89bd58ed
4
- data.tar.gz: 8ad9c5458cea55b0db90612d80d49e23d7adc6be
3
+ metadata.gz: 2cee8ecb479f503e8ece058309263c9e2938cd43
4
+ data.tar.gz: 91394c39524a45ba5799c84ba19a206cb9cb43f0
5
5
  SHA512:
6
- metadata.gz: 409da9ce05cb4917ab8a63d4a60df7a89ad83ef884953593f1891f66938f77f386589d8d51d73346e04cddd8da5fefe0c347e54e40f077a8917d5714cd38994d
7
- data.tar.gz: f8c53a1fa44dc0f75365a52edf8fa38e178fe52434455fece6adf4932542efc37b6d81a4e3fc0837bd30ce8383a061f4b9fb47afbf76af1f2bec82c79f499e2a
6
+ metadata.gz: 2571e6458603880d8d1dd9f05f86ccfe6ce8197a1a15402dd6b2312581b3543d3e3a2c377fd43687597b6ee6555e9bf7aeb0997a347924341b33a9ca601aecc5
7
+ data.tar.gz: 10a1c214aab4f4bef3c1f2c29afee61897d27aca18c1abc44f16a2f9778d2f10b9c89ed22dcc9d9c63a5c1164102ff208174b666e9d48b1704c2fdbdfaa56af2
data/lib/dimples.rb CHANGED
@@ -11,7 +11,6 @@ require 'dimples/writeable'
11
11
  require 'dimples/renderable'
12
12
 
13
13
  require 'dimples/configuration'
14
- require 'dimples/category'
15
14
  require 'dimples/page'
16
15
  require 'dimples/post'
17
16
  require 'dimples/site'
@@ -68,8 +68,7 @@ module Dimples
68
68
  'day' => '%Y-%m-%d',
69
69
  },
70
70
 
71
- 'categories' => [
72
- ]
71
+ 'category_names' => {}
73
72
  }
74
73
  end
75
74
  end
data/lib/dimples/post.rb CHANGED
@@ -44,28 +44,12 @@ module Dimples
44
44
  @day = @date.strftime('%d')
45
45
 
46
46
  @contents = read_with_yaml(path)
47
-
48
47
  end
49
48
 
50
49
  def contents
51
50
  @contents
52
51
  end
53
52
 
54
- def categories=(slugs)
55
- @categories = {}
56
-
57
- slugs.each do |slug|
58
- @site.categories[slug] ||= Dimples::Category.new(slug)
59
- @site.categories[slug].posts << self
60
-
61
- @categories[slug] ||= @site.categories[slug]
62
- end
63
- end
64
-
65
- def categories
66
- @categories
67
- end
68
-
69
53
  def output_file_path(parent_path)
70
54
  parts = [parent_path]
71
55
 
data/lib/dimples/site.rb CHANGED
@@ -45,7 +45,6 @@ module Dimples
45
45
  @generation_options.merge!(options)
46
46
 
47
47
  prepare_site
48
- prepare_categories
49
48
  scan_files
50
49
  generate_files
51
50
  copy_assets
@@ -67,12 +66,6 @@ module Dimples
67
66
  end
68
67
  end
69
68
 
70
- def prepare_categories
71
- @config["categories"].each do |category|
72
- @categories[category["slug"]] = Dimples::Category.new(category["slug"], category["name"])
73
- end
74
- end
75
-
76
69
  def scan_files
77
70
  scan_templates
78
71
  scan_pages
@@ -97,6 +90,10 @@ module Dimples
97
90
  post = @post_class.new(self, path)
98
91
  next if !@generation_options[:include_drafts] && post.draft
99
92
 
93
+ post.categories.each do |slug|
94
+ (@categories[slug] ||= []) << post
95
+ end
96
+
100
97
  %w[year month day].each do |date_type|
101
98
  if @config['generation']["#{date_type}_archives"]
102
99
 
@@ -143,8 +140,9 @@ module Dimples
143
140
  end
144
141
 
145
142
  def generate_categories
146
- @categories.each_value do |category|
147
- paginate(posts: category.posts, title: category.name, paths: [@output_paths[:categories], category.slug], layout: @config['layouts']['category'])
143
+ @categories.each do |slug, posts|
144
+ category_name = @config['category_names'][slug] || slug.capitalize
145
+ paginate(posts: posts, title: category_name, paths: [@output_paths[:categories], slug], layout: @config['layouts']['category'])
148
146
  end
149
147
  end
150
148
 
@@ -181,8 +179,8 @@ module Dimples
181
179
  end
182
180
 
183
181
  def generate_category_feeds
184
- @categories.each_value do |category|
185
- generate_feed(File.join(@output_paths[:categories], category.slug), {posts: category.posts[0..@config['pagination']['per_page'] - 1], category: category.slug})
182
+ @categories.each do |slug, posts|
183
+ generate_feed(File.join(@output_paths[:categories], slug), {posts: posts[0..@config['pagination']['per_page'] - 1], category: slug})
186
184
  end
187
185
  end
188
186
 
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -102,7 +102,6 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - lib/dimples.rb
105
- - lib/dimples/category.rb
106
105
  - lib/dimples/configuration.rb
107
106
  - lib/dimples/errors.rb
108
107
  - lib/dimples/frontable.rb
@@ -1,16 +0,0 @@
1
- module Dimples
2
- class Category
3
- include Frontable
4
-
5
- attr_accessor :slug
6
- attr_accessor :name
7
- attr_accessor :posts
8
-
9
- def initialize(slug, name = nil)
10
- @slug = slug
11
- @name = name || @slug.capitalize
12
-
13
- @posts = []
14
- end
15
- end
16
- end