Merge branch 'master' into changelist_page

This commit is contained in:
zachgersh 2013-05-12 08:20:03 -07:00
commit 94b5f22cfa
18 changed files with 171 additions and 15 deletions

View File

@ -1,19 +1,37 @@
## HEAD ## HEAD
### Major Enhancements ### Major Enhancements
### Minor Enhancements ### Minor Enhancements
### Bug Fixes
### Site Enhancements
* Add docs for gist tag (#1072)
### Development Fixes
## 1.0.2 / 2013-05-12
### Major Enhancements
* Add `jekyll doctor` command to check site for any known compatibility problems (#1081)
* Backwards-compatibilize relative permalinks (#1081)
### Minor Enhancements
* Add a `data-lang="<lang>"` attribute to Redcarpet code blocks (#1066)
* Deprecate old config `server_port`, match to `port` if `port` isn't set (#1084)
* Update pygments.rb version to 0.5.0 (#1061) * Update pygments.rb version to 0.5.0 (#1061)
* Update Kramdown version to 1.0.2 (#1067) * Update Kramdown version to 1.0.2 (#1067)
### Bug Fixes ### Bug Fixes
* Fix issue when categories are numbers (#1078)
* Catching that Redcarpet gem isn't installed (#1059) * Catching that Redcarpet gem isn't installed (#1059)
### Site Enhancements ### Site Enhancements
* Add documentation about `relative_permalinks` (#1081)
* Remove pygments-installation instructions, as pygments.rb is bundled with it (#1079) * Remove pygments-installation instructions, as pygments.rb is bundled with it (#1079)
* Move pages to be Pages for realz (#985) * Move pages to be Pages for realz (#985)
* Updated links to Liquid documentation (#1073) * Updated links to Liquid documentation (#1073)
### Development Fixes
## 1.0.1 / 2013-05-08 ## 1.0.1 / 2013-05-08
### Minor Enhancements ### Minor Enhancements

View File

@ -86,6 +86,20 @@ command :serve do |c|
end end
alias_command :server, :serve alias_command :server, :serve
command :doctor do |c|
c.syntax = 'jekyll doctor'
c.description = 'Search site and print specific deprecation warnings'
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.action do |args, options|
options = normalize_options(options.__hash__)
options = Jekyll.configuration(options)
Jekyll::Commands::Doctor.process(options)
end
end
alias_command :hyde, :doctor
command :import do |c| command :import do |c|
c.syntax = 'jekyll import <platform> [options]' c.syntax = 'jekyll import <platform> [options]'
c.description = 'Import your old blog to Jekyll' c.description = 'Import your old blog to Jekyll'

View File

@ -4,9 +4,9 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5' s.rubygems_version = '1.3.5'
s.name = 'jekyll' s.name = 'jekyll'
s.version = '1.0.1' s.version = '1.0.2'
s.license = 'MIT' s.license = 'MIT'
s.date = '2013-05-08' s.date = '2013-05-12'
s.rubyforge_project = 'jekyll' s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator." s.summary = "A simple, blog aware, static site generator."
@ -71,6 +71,7 @@ Gem::Specification.new do |s|
lib/jekyll.rb lib/jekyll.rb
lib/jekyll/command.rb lib/jekyll/command.rb
lib/jekyll/commands/build.rb lib/jekyll/commands/build.rb
lib/jekyll/commands/doctor.rb
lib/jekyll/commands/new.rb lib/jekyll/commands/new.rb
lib/jekyll/commands/serve.rb lib/jekyll/commands/serve.rb
lib/jekyll/configuration.rb lib/jekyll/configuration.rb
@ -204,6 +205,7 @@ Gem::Specification.new do |s|
test/source/_posts/2013-01-12-no-layout.textile test/source/_posts/2013-01-12-no-layout.textile
test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep
test/source/_posts/2013-04-11-custom-excerpt.markdown test/source/_posts/2013-04-11-custom-excerpt.markdown
test/source/_posts/2013-05-10-number-category.textile
test/source/_posts/es/2008-11-21-nested.textile test/source/_posts/es/2008-11-21-nested.textile
test/source/about.html test/source/about.html
test/source/category/_posts/2008-9-23-categories.textile test/source/category/_posts/2008-9-23-categories.textile

View File

@ -56,7 +56,7 @@ require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll module Jekyll
VERSION = '1.0.1' VERSION = '1.0.2'
# Public: Generate a Jekyll configuration Hash by merging the default # Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top. # options with anything in _config.yml, and adding the given options on top.

View File

@ -0,0 +1,29 @@
module Jekyll
module Commands
class Doctor < Command
class << self
def process(options)
site = Jekyll::Site.new(options)
site.read
unless deprecated_relative_permalinks(site)
Jekyll::Logger.info "Your test results", "are in. Everything looks fine."
end
end
def deprecated_relative_permalinks(site)
contains_deprecated_pages = false
site.pages.each do |page|
if page.uses_relative_permalinks
Jekyll::Logger.warn "Deprecation:", "'#{page.path}' uses relative" +
" permalinks which will be deprecated in" +
" Jekyll v1.1 and beyond."
contains_deprecated_pages = true
end
end
contains_deprecated_pages
end
end
end
end
end

View File

@ -19,7 +19,10 @@ module Jekyll
'limit_posts' => 0, 'limit_posts' => 0,
'lsi' => false, 'lsi' => false,
'future' => true, # remove and make true just default 'future' => true, # remove and make true just default
'pygments' => true, # remove and make true just default 'pygments' => true,
'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 1.1 hits
'markdown' => 'maruku', 'markdown' => 'maruku',
'permalink' => 'date', 'permalink' => 'date',
@ -164,6 +167,15 @@ module Jekyll
config.delete('server') config.delete('server')
end end
if config.has_key? 'server_port'
Jekyll::Logger.warn "Deprecation:", "The 'server_port' configuration option" +
" has been renamed to 'port'. Please update your config" +
" file accordingly."
# copy but don't overwrite:
config['port'] = config['server_port'] unless config.has_key?('port')
config.delete('server_port')
end
config config
end end

View File

@ -5,7 +5,7 @@ module Jekyll
module CommonMethods module CommonMethods
def add_code_tags(code, lang) def add_code_tags(code, lang)
code = code.sub(/<pre>/, "<pre><code class=\"#{lang} language-#{lang}\">") code = code.sub(/<pre>/, "<pre><code class=\"#{lang} language-#{lang}\" data-lang=\"#{lang}\">")
code = code.sub(/<\/pre>/,"</code></pre>") code = code.sub(/<\/pre>/,"</code></pre>")
end end
end end

View File

@ -64,7 +64,11 @@ module Jekyll
return @url if @url return @url if @url
url = if permalink url = if permalink
if site.config['relative_permalinks']
File.join(@dir, permalink)
else
permalink permalink
end
else else
{ {
"path" => @dir, "path" => @dir,
@ -114,7 +118,14 @@ module Jekyll
self.data.deep_merge({ self.data.deep_merge({
"url" => self.url, "url" => self.url,
"content" => self.content, "content" => self.content,
"path" => self.data['path'] || File.join(@dir, @name).sub(/\A\//, '') }) "path" => self.data['path'] || path })
end
# The path to the source file
#
# Returns the path to the source file
def path
File.join(@dir, @name).sub(/\A\//, '')
end end
# Obtain destination path. # Obtain destination path.
@ -144,5 +155,9 @@ module Jekyll
def index? def index?
basename == 'index' basename == 'index'
end end
def uses_relative_permalinks
permalink && @dir != "" && site.config['relative_permalinks']
end
end end
end end

View File

@ -76,7 +76,7 @@ module Jekyll
def populate_categories def populate_categories
if self.categories.empty? if self.categories.empty?
self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase} self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase}
end end
self.categories.flatten! self.categories.flatten!
end end

View File

@ -231,6 +231,7 @@ module Jekyll
end end
self.pages.each do |page| self.pages.each do |page|
relative_permalinks_deprecation_method if page.uses_relative_permalinks
page.render(self.layouts, payload) page.render(self.layouts, payload)
end end
@ -418,5 +419,18 @@ module Jekyll
post.categories.each { |c| self.categories[c] << post } post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post } post.tags.each { |c| self.tags[c] << post }
end end
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && !@deprecated_relative_permalinks
$stderr.puts # Places newline after "Generating..."
Jekyll::Logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
" in subfolders must be relative to the" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
$stderr.print Jekyll::Logger.formatted_topic("") + "..." # for "done."
@deprecated_relative_permalinks = true
end
end
end end
end end

View File

@ -253,6 +253,8 @@ show_drafts: nil
limit_posts: 0 limit_posts: 0
pygments: true pygments: true
relative_permalinks: true
permalink: date permalink: date
paginate_path: 'page:num' paginate_path: 'page:num'

View File

@ -234,3 +234,21 @@ You can also use this tag to create a link to a post in Markdown as follows:
[Name of Link]({% post_url 2010-07-21-name-of-post %}) [Name of Link]({% post_url 2010-07-21-name-of-post %})
{% endraw %} {% endraw %}
{% endhighlight %} {% endhighlight %}
### Gist
Use the `gist` tag to easily embed a GitHub Gist onto your site:
{% highlight text %}
{% raw %}
{% gist 5555251 %}
{% endraw %}
{% endhighlight %}
You may also optionally specify the filename in the gist to display:
{% highlight text %}
{% raw %}
{% gist 5555251 result.md %}
{% endraw %}
{% endhighlight %}

View File

@ -33,6 +33,25 @@ rebuild each time a file changes, just add the `--watch` flag at the end.
or `jekyll build`.</p> or `jekyll build`.</p>
</div> </div>
### Absolute Permalinks
In Jekyll v1.0, we introduced absolute permalinks for pages in subdirectories.
Until v1.1, it is **opt-in**. Starting with v1.1, however, absolute permalinks
will become **opt-out**, meaning Jekyll will default to using absolute permalinks
instead of relative permalinks.
* To use absolute permalinks, set `relative_permalinks: true` in your configuration file.
* To continue using relative permalinks, set `relative_permalinks: false` in your configuration file.
<div class="note warning" id="absolute-permalinks-warning">
<h5 markdown="1">Absolute permalinks will be default in v1.1 and on</h5>
<p markdown="1">
Starting with Jekyll v1.1.0, `relative_permalinks` will default to `false`,
meaning all pages will be built using the absolute permalink behaviour.
The switch will still exist until v2.0.
</p>
</div>
### Custom Config File ### Custom Config File
Rather than passing individual flags via the command line, you can now pass an Rather than passing individual flags via the command line, you can now pass an

View File

@ -0,0 +1,7 @@
---
layout: default
title: Number Category in YAML
category: 2013
---
Please make me pass

View File

@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end end
should "ensure post count is as expected" do should "ensure post count is as expected" do
assert_equal 33, @site.posts.size assert_equal 34, @site.posts.size
end end
should "insert site.posts into the index" do should "insert site.posts into the index" do

View File

@ -423,6 +423,12 @@ class TestPost < Test::Unit::TestCase
assert_equal [], post.categories assert_equal [], post.categories
end end
should "recognize number category in yaml" do
post = setup_post("2013-05-10-number-category.textile")
assert post.categories.include?('2013')
assert !post.categories.include?(2013)
end
should "recognize tag in yaml" do should "recognize tag in yaml" do
post = setup_post("2009-05-18-tag.textile") post = setup_post("2009-05-18-tag.textile")
assert post.tags.include?('code') assert post.tags.include?('code')

View File

@ -32,7 +32,7 @@ class TestRedcarpet < Test::Unit::TestCase
end end
should "render fenced code blocks with syntax highlighting" do should "render fenced code blocks with syntax highlighting" do
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">&quot;Hello world&quot;</span>\n</code></pre></div>", @markdown.convert( assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">&quot;Hello world&quot;</span>\n</code></pre></div>", @markdown.convert(
<<-EOS <<-EOS
```ruby ```ruby
puts "Hello world" puts "Hello world"
@ -48,7 +48,7 @@ puts "Hello world"
end end
should "render fenced code blocks without syntax highlighting" do should "render fenced code blocks without syntax highlighting" do
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\">puts &quot;Hello world&quot;\n</code></pre></div>", @markdown.convert( assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\">puts &quot;Hello world&quot;\n</code></pre></div>", @markdown.convert(
<<-EOS <<-EOS
```ruby ```ruby
puts "Hello world" puts "Hello world"

View File

@ -172,7 +172,7 @@ class TestSite < Test::Unit::TestCase
posts = Dir[source_dir("**", "_posts", "**", "*")] posts = Dir[source_dir("**", "_posts", "**", "*")]
posts.delete_if { |post| File.directory?(post) && !Post.valid?(post) } posts.delete_if { |post| File.directory?(post) && !Post.valid?(post) }
categories = %w(bar baz category foo z_category publish_test win).sort categories = %w(2013 bar baz category foo z_category publish_test win).sort
assert_equal posts.size - @num_invalid_posts, @site.posts.size assert_equal posts.size - @num_invalid_posts, @site.posts.size
assert_equal categories, @site.categories.keys.sort assert_equal categories, @site.categories.keys.sort