Removing topics for good
This commit is contained in:
parent
285f0aa327
commit
921aee23d3
2
Rakefile
2
Rakefile
|
@ -81,7 +81,7 @@ begin
|
||||||
require 'cucumber/rake/task'
|
require 'cucumber/rake/task'
|
||||||
|
|
||||||
Cucumber::Rake::Task.new(:features) do |t|
|
Cucumber::Rake::Task.new(:features) do |t|
|
||||||
t.cucumber_opts = "--format pretty"
|
t.cucumber_opts = "--format progress"
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
desc 'Cucumber rake task not available'
|
desc 'Cucumber rake task not available'
|
||||||
|
|
|
@ -105,19 +105,6 @@ Feature: Post data
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html"
|
||||||
|
|
||||||
Scenario: Use post.topics variable
|
|
||||||
Given I have a _posts directory
|
|
||||||
And I have a _posts/movies directory
|
|
||||||
And I have a _posts/movies/scifi directory
|
|
||||||
And I have a _layouts directory
|
|
||||||
And I have the following post under "movies/scifi":
|
|
||||||
| title | date | layout | content |
|
|
||||||
| Star Wars | 3/27/2009 | simple | Luke, I am your father. |
|
|
||||||
And I have a simple layout that contains "Post topics: {{ site.posts.first.topics | array_to_sentence_string }}"
|
|
||||||
When I run jekyll
|
|
||||||
Then the _site directory should exist
|
|
||||||
And I should see "Post topics: movies and scifi" in "_site/2009/03/27/star-wars.html"
|
|
||||||
|
|
||||||
Scenario: Disable a post from being published
|
Scenario: Disable a post from being published
|
||||||
Given I have a _posts directory
|
Given I have a _posts directory
|
||||||
And I have an "index.html" file that contains "Published!"
|
And I have an "index.html" file that contains "Published!"
|
||||||
|
|
|
@ -18,7 +18,7 @@ module Jekyll
|
||||||
name =~ MATCHER
|
name =~ MATCHER
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :site, :date, :slug, :ext, :topics, :published, :data, :content, :output
|
attr_accessor :site, :date, :slug, :ext, :published, :data, :content, :output
|
||||||
attr_writer :categories
|
attr_writer :categories
|
||||||
|
|
||||||
def categories
|
def categories
|
||||||
|
@ -38,10 +38,6 @@ module Jekyll
|
||||||
@name = name
|
@name = name
|
||||||
|
|
||||||
self.categories = dir.split('/').reject { |x| x.empty? }
|
self.categories = dir.split('/').reject { |x| x.empty? }
|
||||||
|
|
||||||
parts = name.split('/')
|
|
||||||
self.topics = parts.size > 1 ? parts[0..-2] : []
|
|
||||||
|
|
||||||
self.process(name)
|
self.process(name)
|
||||||
self.read_yaml(@base, name)
|
self.read_yaml(@base, name)
|
||||||
|
|
||||||
|
@ -209,7 +205,6 @@ module Jekyll
|
||||||
"url" => self.url,
|
"url" => self.url,
|
||||||
"date" => self.date,
|
"date" => self.date,
|
||||||
"id" => self.id,
|
"id" => self.id,
|
||||||
"topics" => self.topics,
|
|
||||||
"categories" => self.categories,
|
"categories" => self.categories,
|
||||||
"next" => self.next,
|
"next" => self.next,
|
||||||
"previous" => self.previous,
|
"previous" => self.previous,
|
||||||
|
|
|
@ -214,15 +214,12 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns {"site" => {"time" => <Time>,
|
# Returns {"site" => {"time" => <Time>,
|
||||||
# "posts" => [<Post>],
|
# "posts" => [<Post>],
|
||||||
# "categories" => [<Post>],
|
# "categories" => [<Post>]}
|
||||||
# "topics" => [<Post>] }}
|
|
||||||
def site_payload
|
def site_payload
|
||||||
{"site" => {
|
{"site" => {
|
||||||
"time" => Time.now,
|
"time" => Time.now,
|
||||||
"posts" => self.posts.sort { |a,b| b <=> a },
|
"posts" => self.posts.sort { |a,b| b <=> a },
|
||||||
"categories" => post_attr_hash('categories'),
|
"categories" => post_attr_hash('categories')}}
|
||||||
"topics" => post_attr_hash('topics')
|
|
||||||
}}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Filter out any files/directories that are hidden or backup files (start
|
# Filter out any files/directories that are hidden or backup files (start
|
||||||
|
|
|
@ -25,7 +25,6 @@ class TestPost < Test::Unit::TestCase
|
||||||
assert !Post.valid?("blah")
|
assert !Post.valid?("blah")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context "processing posts" do
|
context "processing posts" do
|
||||||
setup do
|
setup do
|
||||||
@post = Post.allocate
|
@post = Post.allocate
|
||||||
|
@ -262,7 +261,6 @@ class TestPost < Test::Unit::TestCase
|
||||||
should "generate categories and topics" do
|
should "generate categories and topics" do
|
||||||
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
||||||
assert_equal ['foo'], post.categories
|
assert_equal ['foo'], post.categories
|
||||||
assert_equal ['bar'], post.topics
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue