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'
|
||||
|
||||
Cucumber::Rake::Task.new(:features) do |t|
|
||||
t.cucumber_opts = "--format pretty"
|
||||
t.cucumber_opts = "--format progress"
|
||||
end
|
||||
rescue LoadError
|
||||
desc 'Cucumber rake task not available'
|
||||
|
|
|
@ -105,19 +105,6 @@ Feature: Post data
|
|||
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"
|
||||
|
||||
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
|
||||
Given I have a _posts directory
|
||||
And I have an "index.html" file that contains "Published!"
|
||||
|
|
|
@ -18,7 +18,7 @@ module Jekyll
|
|||
name =~ MATCHER
|
||||
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
|
||||
|
||||
def categories
|
||||
|
@ -38,10 +38,6 @@ module Jekyll
|
|||
@name = name
|
||||
|
||||
self.categories = dir.split('/').reject { |x| x.empty? }
|
||||
|
||||
parts = name.split('/')
|
||||
self.topics = parts.size > 1 ? parts[0..-2] : []
|
||||
|
||||
self.process(name)
|
||||
self.read_yaml(@base, name)
|
||||
|
||||
|
@ -209,7 +205,6 @@ module Jekyll
|
|||
"url" => self.url,
|
||||
"date" => self.date,
|
||||
"id" => self.id,
|
||||
"topics" => self.topics,
|
||||
"categories" => self.categories,
|
||||
"next" => self.next,
|
||||
"previous" => self.previous,
|
||||
|
|
|
@ -214,15 +214,12 @@ module Jekyll
|
|||
#
|
||||
# Returns {"site" => {"time" => <Time>,
|
||||
# "posts" => [<Post>],
|
||||
# "categories" => [<Post>],
|
||||
# "topics" => [<Post>] }}
|
||||
# "categories" => [<Post>]}
|
||||
def site_payload
|
||||
{"site" => {
|
||||
"time" => Time.now,
|
||||
"posts" => self.posts.sort { |a,b| b <=> a },
|
||||
"categories" => post_attr_hash('categories'),
|
||||
"topics" => post_attr_hash('topics')
|
||||
}}
|
||||
"time" => Time.now,
|
||||
"posts" => self.posts.sort { |a,b| b <=> a },
|
||||
"categories" => post_attr_hash('categories')}}
|
||||
end
|
||||
|
||||
# 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")
|
||||
end
|
||||
|
||||
|
||||
context "processing posts" do
|
||||
setup do
|
||||
@post = Post.allocate
|
||||
|
@ -262,7 +261,6 @@ class TestPost < Test::Unit::TestCase
|
|||
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')
|
||||
assert_equal ['foo'], post.categories
|
||||
assert_equal ['bar'], post.topics
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue