mattmatt-jekyll 0.4.3 → 0.4.4

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 3
4
+ :patch: 4
data/lib/jekyll/post.rb CHANGED
@@ -45,6 +45,14 @@ module Jekyll
45
45
  else
46
46
  self.published = true
47
47
  end
48
+
49
+ self.data['topics'] = if self.topics.empty?
50
+ if self.data.has_key?('topic')
51
+ self.topics << self.data['topic']
52
+ elsif self.data.has_key?('topics')
53
+ self.topics = (self.data['topics'] || "").split
54
+ end
55
+ end
48
56
 
49
57
  self.data['categories'] = if self.categories.empty?
50
58
  if self.data.has_key?('category')
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Categories in YAML
4
+ topics:
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Categories in YAML
4
+ topic: foo
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Categories in YAML
4
+ topics: foo bar
5
+ ---
6
+
7
+ Best *post* ever
data/test/test_post.rb CHANGED
@@ -100,6 +100,25 @@ class TestPost < Test::Unit::TestCase
100
100
  assert p.categories.empty?
101
101
  assert p.data['categories'].empty?
102
102
  end
103
+
104
+ def test_yaml_topic
105
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-topic.textile")
106
+ assert p.topics.include?('foo')
107
+ assert p.data['topics'].include?('foo')
108
+ end
109
+
110
+ def test_yaml_topics
111
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-topics.textile")
112
+ assert p.topics.include?('foo')
113
+ assert p.topics.include?('bar')
114
+ assert p.data['topics'].include?('foo')
115
+ end
116
+
117
+ def test_empty_yaml_topics
118
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-no-topics.textile")
119
+ assert p.topics.empty?
120
+ assert p.data['topics'].empty?
121
+ end
103
122
 
104
123
  def test_render
105
124
  p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattmatt-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -122,6 +122,9 @@ files:
122
122
  - test/dest/2009/01
123
123
  - test/dest/2009/01/27
124
124
  - test/dest/2009/01/27/no-categories.html
125
+ - test/dest/2009/01/27/no-topics.html
126
+ - test/dest/2009/01/27/topic.html
127
+ - test/dest/2009/01/27/topics.html
125
128
  - test/dest/_posts
126
129
  - test/dest/_posts/2008-02-02-not-published.html
127
130
  - test/dest/_posts/2008-02-02-published.html
@@ -132,6 +135,9 @@ files:
132
135
  - test/dest/_posts/2009-01-27-categories.html
133
136
  - test/dest/_posts/2009-01-27-category.html
134
137
  - test/dest/_posts/2009-01-27-no-categories.html
138
+ - test/dest/_posts/2009-01-27-no-topics.html
139
+ - test/dest/_posts/2009-01-27-topic.html
140
+ - test/dest/_posts/2009-01-27-topics.html
135
141
  - test/dest/category
136
142
  - test/dest/category/2008
137
143
  - test/dest/category/2008/09
@@ -191,6 +197,9 @@ files:
191
197
  - test/source/_posts/2009-01-27-categories.textile
192
198
  - test/source/_posts/2009-01-27-category.textile
193
199
  - test/source/_posts/2009-01-27-no-categories.textile
200
+ - test/source/_posts/2009-01-27-no-topics.textile
201
+ - test/source/_posts/2009-01-27-topic.textile
202
+ - test/source/_posts/2009-01-27-topics.textile
194
203
  - test/source/category
195
204
  - test/source/category/_posts
196
205
  - test/source/category/_posts/2008-9-23-categories.textile