mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
35 Commits
debug-7328
...
v0.4.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d41549c9ef | ||
|
|
586898d824 | ||
|
|
999ec1bf2b | ||
|
|
85f3ba2088 | ||
|
|
5eea9d9827 | ||
|
|
89d98211b1 | ||
|
|
89330140d9 | ||
|
|
4d6f36e97b | ||
|
|
e11f403aab | ||
|
|
dba797da04 | ||
|
|
d8f9a80dbb | ||
|
|
28c3a3836d | ||
|
|
8efff3f99a | ||
|
|
d134fbf5ac | ||
|
|
71a6f8a288 | ||
|
|
ae7eb14ae4 | ||
|
|
8fc41d867a | ||
|
|
3df209d8d6 | ||
|
|
1eafe90852 | ||
|
|
b70cfc734a | ||
|
|
9ee5a36d75 | ||
|
|
fe71d2b783 | ||
|
|
eac6b03086 | ||
|
|
f682c8ffa4 | ||
|
|
9478f1bb5e | ||
|
|
7e178fff10 | ||
|
|
4a97573465 | ||
|
|
eb60603f51 | ||
|
|
698192122d | ||
|
|
a8266e3397 | ||
|
|
4761d54b93 | ||
|
|
512e515d15 | ||
|
|
e53ac7a16c | ||
|
|
36466f13b8 | ||
|
|
d595cd7ee9 |
@@ -1,4 +1,4 @@
|
||||
h1. Jekyll
|
||||
h1. Jekyll LOL
|
||||
|
||||
Jekyll is a simple, blog aware, static site generator. It takes a template
|
||||
directory (representing the raw form of a website), runs it through Textile or
|
||||
@@ -7,6 +7,8 @@ suitable for serving with Apache or your favorite web server. Visit
|
||||
"http://tom.preston-werner.com":http://tom.preston-werner.com to see an
|
||||
example of a Jekyll generated blog.
|
||||
|
||||
Some more changes...
|
||||
|
||||
To understand how this all works, open up my
|
||||
"TPW":http://github.com/mojombo/tpw repo in a new browser window. I'll be
|
||||
referencing the code there.
|
||||
@@ -136,6 +138,11 @@ compilation), you must install it (gem install rdiscount) and then you can
|
||||
have it used instead:
|
||||
|
||||
$ jekyll --rdiscount
|
||||
|
||||
As another alternative, just because to make it a hat trick, you can also
|
||||
use BlueCloth (gem install bluecloth).
|
||||
|
||||
$ jekyll --bluecloth
|
||||
|
||||
When previewing complex sites locally, simply opening the site in a web
|
||||
browser (using file://) can cause problems with links that are relative to
|
||||
@@ -152,6 +159,8 @@ the filename is used. For example, with the permalink style set to 'none' the
|
||||
file '2009-01-01-happy-new-year.markdown' will have a permalink like
|
||||
'http://yoursite.com/happy-new-year.html'. The date of the post will still be
|
||||
read from the filename (and is required!) to be used elsewhere in Jekyll.
|
||||
Also supported is the permalink format shortdate, which will use the YYYY/M/D
|
||||
for days and months < 10.
|
||||
Example usage:
|
||||
|
||||
$ jekyll --permalink none
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -12,12 +12,14 @@ begin
|
||||
s.description = "Jekyll is a simple, blog aware, static site generator."
|
||||
s.authors = ["Tom Preston-Werner"]
|
||||
s.rubyforge_project = "jekyll"
|
||||
s.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
|
||||
s.add_dependency('RedCloth', '>= 4.0.4')
|
||||
s.add_dependency('liquid', '>= 1.9.0')
|
||||
s.add_dependency('classifier', '>= 1.3.1')
|
||||
s.add_dependency('maruku', '>= 0.5.9')
|
||||
s.add_dependency('directory_watcher', '>= 1.1.1')
|
||||
s.add_dependency('open4', '>= 0.9.6')
|
||||
s.executables = "jekyll"
|
||||
end
|
||||
rescue LoadError
|
||||
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
||||
|
||||
6
TODO
6
TODO
@@ -1,3 +1,3 @@
|
||||
[ ] Easier configuration of Maruka and blahtex directories [mdreid]
|
||||
[ ] Accurate "related posts" calculator
|
||||
[ ] Autobuild
|
||||
[x] Easier configuration of Maruka and blahtex directories [mdreid]
|
||||
[x] Accurate "related posts" calculator
|
||||
[x] Autobuild
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
:minor: 4
|
||||
:patch: 1
|
||||
:major: 0
|
||||
:minor: 4
|
||||
:patch: 5
|
||||
|
||||
10
bin/jekyll
10
bin/jekyll
@@ -47,6 +47,16 @@ opts = OptionParser.new do |opts|
|
||||
puts 'You must have the rdiscount gem installed first'
|
||||
end
|
||||
end
|
||||
|
||||
opts.on("--bluecloth", "Use bluecloth gem for Markdown") do
|
||||
begin
|
||||
require 'bluecloth'
|
||||
Jekyll.markdown_proc = Proc.new { |x| BlueCloth.new(x).to_html }
|
||||
puts 'Using BlueCloth for Markdown'
|
||||
rescue LoadError
|
||||
puts 'You must have the BlueCloth gem installed first'
|
||||
end
|
||||
end
|
||||
|
||||
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
|
||||
Jekyll.permalink_style = (style || 'date').to_sym
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{jekyll}
|
||||
s.version = "0.4.1"
|
||||
s.version = "0.4.5"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Tom Preston-Werner"]
|
||||
s.date = %q{2009-02-10}
|
||||
s.date = %q{2009-03-08}
|
||||
s.default_executable = %q{jekyll}
|
||||
s.description = %q{Jekyll is a simple, blog aware, static site generator.}
|
||||
s.email = %q{tom@mojombo.com}
|
||||
s.executables = ["jekyll"]
|
||||
s.files = ["History.txt", "README.textile", "VERSION.yml", "bin/jekyll", "lib/jekyll", "lib/jekyll/albino.rb", "lib/jekyll/converters", "lib/jekyll/converters/csv.rb", "lib/jekyll/converters/mephisto.rb", "lib/jekyll/converters/mt.rb", "lib/jekyll/converters/textpattern.rb", "lib/jekyll/converters/typo.rb", "lib/jekyll/converters/wordpress.rb", "lib/jekyll/convertible.rb", "lib/jekyll/core_ext.rb", "lib/jekyll/filters.rb", "lib/jekyll/layout.rb", "lib/jekyll/page.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", "lib/jekyll/tags", "lib/jekyll/tags/highlight.rb", "lib/jekyll/tags/include.rb", "lib/jekyll.rb", "test/dest", "test/dest/2008", "test/dest/2008/10", "test/dest/2008/10/18", "test/dest/2008/10/18/foo-bar.html", "test/dest/2008/11", "test/dest/2008/11/21", "test/dest/2008/11/21/complex.html", "test/dest/2008/12", "test/dest/2008/12/13", "test/dest/2008/12/13/include.html", "test/dest/_posts", "test/dest/_posts/2008-10-18-foo-bar.html", "test/dest/_posts/2008-11-21-complex.html", "test/dest/_posts/2008-12-03-permalinked-post.html", "test/dest/_posts/2008-12-13-include.html", "test/dest/category", "test/dest/category/2008", "test/dest/category/2008/09", "test/dest/category/2008/09/23", "test/dest/category/2008/09/23/categories.html", "test/dest/category/_posts", "test/dest/category/_posts/2008-9-23-categories.html", "test/dest/css", "test/dest/css/screen.css", "test/dest/foo", "test/dest/foo/2008", "test/dest/foo/2008/12", "test/dest/foo/2008/12/12", "test/dest/foo/2008/12/12/topical-post.html", "test/dest/foo/_posts", "test/dest/foo/_posts/bar", "test/dest/foo/_posts/bar/2008-12-12-topical-post.html", "test/dest/index.html", "test/dest/my_category", "test/dest/my_category/permalinked-post", "test/dest/z_category", "test/dest/z_category/2008", "test/dest/z_category/2008/09", "test/dest/z_category/2008/09/23", "test/dest/z_category/2008/09/23/categories.html", "test/dest/z_category/_posts", "test/dest/z_category/_posts/2008-9-23-categories.html", "test/helper.rb", "test/source", "test/source/_includes", "test/source/_includes/sig.markdown", "test/source/_layouts", "test/source/_layouts/default.html", "test/source/_layouts/simple.html", "test/source/_posts", "test/source/_posts/2008-10-18-foo-bar.textile", "test/source/_posts/2008-11-21-complex.textile", "test/source/_posts/2008-12-03-permalinked-post.textile", "test/source/_posts/2008-12-13-include.markdown", "test/source/category", "test/source/category/_posts", "test/source/category/_posts/2008-9-23-categories.textile", "test/source/css", "test/source/css/screen.css", "test/source/foo", "test/source/foo/_posts", "test/source/foo/_posts/bar", "test/source/foo/_posts/bar/2008-12-12-topical-post.textile", "test/source/index.html", "test/source/z_category", "test/source/z_category/_posts", "test/source/z_category/_posts/2008-9-23-categories.textile", "test/suite.rb", "test/test_filters.rb", "test/test_generated_site.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb", "test/test_tags.rb"]
|
||||
s.files = ["History.txt", "Rakefile", "README.textile", "TODO", "VERSION.yml", "bin/jekyll", "lib/jekyll", "lib/jekyll/albino.rb", "lib/jekyll/converters", "lib/jekyll/converters/csv.rb", "lib/jekyll/converters/mephisto.rb", "lib/jekyll/converters/mt.rb", "lib/jekyll/converters/textpattern.rb", "lib/jekyll/converters/typo.rb", "lib/jekyll/converters/wordpress.rb", "lib/jekyll/convertible.rb", "lib/jekyll/core_ext.rb", "lib/jekyll/filters.rb", "lib/jekyll/layout.rb", "lib/jekyll/page.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", "lib/jekyll/tags", "lib/jekyll/tags/highlight.rb", "lib/jekyll/tags/include.rb", "lib/jekyll.rb", "test/dest", "test/dest/2008", "test/dest/2008/10", "test/dest/2008/10/18", "test/dest/2008/10/18/foo-bar.html", "test/dest/2008/11", "test/dest/2008/11/21", "test/dest/2008/11/21/complex.html", "test/dest/2008/12", "test/dest/2008/12/13", "test/dest/2008/12/13/include.html", "test/dest/2009", "test/dest/2009/01", "test/dest/2009/01/27", "test/dest/2009/01/27/no-categories.html", "test/dest/2009/01/27/no-topics.html", "test/dest/2009/01/27/topic.html", "test/dest/2009/01/27/topics.html", "test/dest/_posts", "test/dest/_posts/2008-02-02-not-published.html", "test/dest/_posts/2008-02-02-published.html", "test/dest/_posts/2008-10-18-foo-bar.html", "test/dest/_posts/2008-11-21-complex.html", "test/dest/_posts/2008-12-03-permalinked-post.html", "test/dest/_posts/2008-12-13-include.html", "test/dest/_posts/2009-01-27-categories.html", "test/dest/_posts/2009-01-27-category.html", "test/dest/_posts/2009-01-27-no-categories.html", "test/dest/_posts/2009-01-27-no-topics.html", "test/dest/_posts/2009-01-27-topic.html", "test/dest/_posts/2009-01-27-topics.html", "test/dest/category", "test/dest/category/2008", "test/dest/category/2008/09", "test/dest/category/2008/09/23", "test/dest/category/2008/09/23/categories.html", "test/dest/category/_posts", "test/dest/category/_posts/2008-9-23-categories.html", "test/dest/css", "test/dest/css/screen.css", "test/dest/foo", "test/dest/foo/2008", "test/dest/foo/2008/12", "test/dest/foo/2008/12/12", "test/dest/foo/2008/12/12/topical-post.html", "test/dest/foo/2009", "test/dest/foo/2009/01", "test/dest/foo/2009/01/27", "test/dest/foo/2009/01/27/category.html", "test/dest/foo/_posts", "test/dest/foo/_posts/bar", "test/dest/foo/_posts/bar/2008-12-12-topical-post.html", "test/dest/foo/bar", "test/dest/foo/bar/baz", "test/dest/foo/bar/baz/2009", "test/dest/foo/bar/baz/2009/01", "test/dest/foo/bar/baz/2009/01/27", "test/dest/foo/bar/baz/2009/01/27/categories.html", "test/dest/index.html", "test/dest/my_category", "test/dest/my_category/permalinked-post", "test/dest/publish_test", "test/dest/publish_test/2008", "test/dest/publish_test/2008/02", "test/dest/publish_test/2008/02/02", "test/dest/publish_test/2008/02/02/published.html", "test/dest/z_category", "test/dest/z_category/2008", "test/dest/z_category/2008/09", "test/dest/z_category/2008/09/23", "test/dest/z_category/2008/09/23/categories.html", "test/dest/z_category/_posts", "test/dest/z_category/_posts/2008-9-23-categories.html", "test/helper.rb", "test/source", "test/source/_includes", "test/source/_includes/sig.markdown", "test/source/_layouts", "test/source/_layouts/default.html", "test/source/_layouts/simple.html", "test/source/_posts", "test/source/_posts/2008-02-02-not-published.textile", "test/source/_posts/2008-02-02-published.textile", "test/source/_posts/2008-10-18-foo-bar.textile", "test/source/_posts/2008-11-21-complex.textile", "test/source/_posts/2008-12-03-permalinked-post.textile", "test/source/_posts/2008-12-13-include.markdown", "test/source/_posts/2009-01-27-categories.textile", "test/source/_posts/2009-01-27-category.textile", "test/source/_posts/2009-01-27-no-categories.textile", "test/source/_posts/2009-01-27-no-topics.textile", "test/source/_posts/2009-01-27-topic.textile", "test/source/_posts/2009-01-27-topics.textile", "test/source/category", "test/source/category/_posts", "test/source/category/_posts/2008-9-23-categories.textile", "test/source/css", "test/source/css/screen.css", "test/source/foo", "test/source/foo/_posts", "test/source/foo/_posts/bar", "test/source/foo/_posts/bar/2008-12-12-topical-post.textile", "test/source/index.html", "test/source/z_category", "test/source/z_category/_posts", "test/source/z_category/_posts/2008-9-23-categories.textile", "test/suite.rb", "test/test_filters.rb", "test/test_generated_site.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb", "test/test_tags.rb"]
|
||||
s.has_rdoc = true
|
||||
s.homepage = %q{http://github.com/mojombo/jekyll}
|
||||
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
||||
s.require_paths = ["lib"]
|
||||
s.rubyforge_project = %q{jekyll}
|
||||
s.rubygems_version = %q{1.3.0}
|
||||
s.rubygems_version = %q{1.3.1}
|
||||
s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
|
||||
@@ -20,6 +20,7 @@ module Jekyll
|
||||
|
||||
attr_accessor :date, :slug, :ext, :categories, :topics, :published
|
||||
attr_accessor :data, :content, :output
|
||||
attr_accessor :previous, :next
|
||||
|
||||
# Initialize this Post instance.
|
||||
# +base+ is the String path to the dir containing the post file
|
||||
@@ -44,12 +45,20 @@ module Jekyll
|
||||
else
|
||||
self.published = true
|
||||
end
|
||||
|
||||
self.data['topics'] = if self.topics.empty?
|
||||
if self.data.has_key?('topic')
|
||||
self.topics << self.data['topic']
|
||||
elsif self.data.has_key?('topics')
|
||||
self.topics = (self.data['topics'] || "").split
|
||||
end
|
||||
end
|
||||
|
||||
if self.categories.empty?
|
||||
self.data['categories'] = if self.categories.empty?
|
||||
if self.data.has_key?('category')
|
||||
self.categories << self.data['category']
|
||||
elsif self.data.has_key?('categories')
|
||||
self.categories = self.data['categories'].split
|
||||
self.categories = (self.data['categories'] || "").split
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -83,8 +92,11 @@ module Jekyll
|
||||
permalink.to_s.split("/")[0..-2].join("/") + '/'
|
||||
else
|
||||
prefix = self.categories.empty? ? '' : '/' + self.categories.join('/')
|
||||
if Jekyll.permalink_style == :date
|
||||
case Jekyll.permalink_style
|
||||
when :date
|
||||
prefix + date.strftime("/%Y/%m/%d/")
|
||||
when :shortdate
|
||||
prefix + "/#{date.year}/#{date.month}/#{date.day}/"
|
||||
else
|
||||
prefix + '/'
|
||||
end
|
||||
@@ -148,7 +160,9 @@ module Jekyll
|
||||
payload =
|
||||
{
|
||||
"site" => { "related_posts" => related_posts(site_payload["site"]["posts"]) },
|
||||
"page" => self.to_liquid
|
||||
"page" => self.to_liquid,
|
||||
"previous" => self.previous,
|
||||
"next" => self.next
|
||||
}
|
||||
payload = payload.deep_merge(site_payload)
|
||||
|
||||
|
||||
@@ -70,13 +70,16 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.posts.sort!
|
||||
|
||||
# second pass renders each post now that full site payload is available
|
||||
self.posts.each do |post|
|
||||
self.posts.each_with_index do |post, idx|
|
||||
post.previous = posts[idx - 1] unless idx - 1 < 0
|
||||
post.next = posts[idx + 1] unless idx + 1 >= posts.size
|
||||
post.render(self.layouts, site_payload)
|
||||
end
|
||||
|
||||
self.posts.sort!
|
||||
self.categories.values.map { |cats| cats.sort! { |a, b| b <=> a} }
|
||||
rescue Errno::ENOENT => e
|
||||
# ignore missing layout dir
|
||||
|
||||
7
test/source/_posts/2009-01-27-no-categories.textile
Normal file
7
test/source/_posts/2009-01-27-no-categories.textile
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Categories in YAML
|
||||
categories:
|
||||
---
|
||||
|
||||
Best *post* ever
|
||||
7
test/source/_posts/2009-01-27-no-topics.textile
Normal file
7
test/source/_posts/2009-01-27-no-topics.textile
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Categories in YAML
|
||||
topics:
|
||||
---
|
||||
|
||||
Best *post* ever
|
||||
7
test/source/_posts/2009-01-27-topic.textile
Normal file
7
test/source/_posts/2009-01-27-topic.textile
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Categories in YAML
|
||||
topic: foo
|
||||
---
|
||||
|
||||
Best *post* ever
|
||||
7
test/source/_posts/2009-01-27-topics.textile
Normal file
7
test/source/_posts/2009-01-27-topics.textile
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
layout: default
|
||||
title: Categories in YAML
|
||||
topics: foo bar
|
||||
---
|
||||
|
||||
Best *post* ever
|
||||
@@ -84,6 +84,7 @@ class TestPost < Test::Unit::TestCase
|
||||
def test_yaml_category
|
||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-category.textile")
|
||||
assert p.categories.include?('foo')
|
||||
assert p.data['categories'].include?('foo')
|
||||
end
|
||||
|
||||
def test_yaml_categories
|
||||
@@ -91,6 +92,32 @@ class TestPost < Test::Unit::TestCase
|
||||
assert p.categories.include?('foo')
|
||||
assert p.categories.include?('bar')
|
||||
assert p.categories.include?('baz')
|
||||
assert p.data['categories'].include?('foo')
|
||||
end
|
||||
|
||||
def test_empty_yaml_categories
|
||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-no-categories.textile")
|
||||
assert p.categories.empty?
|
||||
assert p.data['categories'].empty?
|
||||
end
|
||||
|
||||
def test_yaml_topic
|
||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-topic.textile")
|
||||
assert p.topics.include?('foo')
|
||||
assert p.data['topics'].include?('foo')
|
||||
end
|
||||
|
||||
def test_yaml_topics
|
||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-topics.textile")
|
||||
assert p.topics.include?('foo')
|
||||
assert p.topics.include?('bar')
|
||||
assert p.data['topics'].include?('foo')
|
||||
end
|
||||
|
||||
def test_empty_yaml_topics
|
||||
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-no-topics.textile")
|
||||
assert p.topics.empty?
|
||||
assert p.data['topics'].empty?
|
||||
end
|
||||
|
||||
def test_render
|
||||
@@ -132,4 +159,13 @@ class TestPost < Test::Unit::TestCase
|
||||
|
||||
assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", p.output
|
||||
end
|
||||
|
||||
def test_dir_with_short_date_permalink_type
|
||||
Jekyll.permalink_style = :shortdate
|
||||
p = Post.allocate
|
||||
p.process("2008-02-03-permalinked-post.textile")
|
||||
p.categories = []
|
||||
assert_equal "/2008/2/3/", p.dir
|
||||
Jekyll.permalink_style = :date
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user