diff --git a/History.markdown b/History.markdown
index 10fb8678..8dbe1ccf 100644
--- a/History.markdown
+++ b/History.markdown
@@ -1,19 +1,37 @@
## HEAD
### Major 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=""` 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 Kramdown version to 1.0.2 (#1067)
### Bug Fixes
+ * Fix issue when categories are numbers (#1078)
* Catching that Redcarpet gem isn't installed (#1059)
### Site Enhancements
+ * Add documentation about `relative_permalinks` (#1081)
* Remove pygments-installation instructions, as pygments.rb is bundled with it (#1079)
* Move pages to be Pages for realz (#985)
* Updated links to Liquid documentation (#1073)
-### Development Fixes
-
## 1.0.1 / 2013-05-08
### Minor Enhancements
diff --git a/bin/jekyll b/bin/jekyll
index 6d3767e6..2e631bbb 100755
--- a/bin/jekyll
+++ b/bin/jekyll
@@ -86,6 +86,20 @@ command :serve do |c|
end
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|
c.syntax = 'jekyll import [options]'
c.description = 'Import your old blog to Jekyll'
diff --git a/jekyll.gemspec b/jekyll.gemspec
index a82c630a..08274bf3 100644
--- a/jekyll.gemspec
+++ b/jekyll.gemspec
@@ -4,9 +4,9 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'
s.name = 'jekyll'
- s.version = '1.0.1'
+ s.version = '1.0.2'
s.license = 'MIT'
- s.date = '2013-05-08'
+ s.date = '2013-05-12'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@@ -71,6 +71,7 @@ Gem::Specification.new do |s|
lib/jekyll.rb
lib/jekyll/command.rb
lib/jekyll/commands/build.rb
+ lib/jekyll/commands/doctor.rb
lib/jekyll/commands/new.rb
lib/jekyll/commands/serve.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-03-19-not-a-post.markdown/.gitkeep
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/about.html
test/source/category/_posts/2008-9-23-categories.textile
diff --git a/lib/jekyll.rb b/lib/jekyll.rb
index 4f3bc1cc..d909373b 100644
--- a/lib/jekyll.rb
+++ b/lib/jekyll.rb
@@ -56,7 +56,7 @@ require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
- VERSION = '1.0.1'
+ VERSION = '1.0.2'
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.
diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb
new file mode 100644
index 00000000..1819e0c7
--- /dev/null
+++ b/lib/jekyll/commands/doctor.rb
@@ -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
diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb
index d6856bb1..0db188d3 100644
--- a/lib/jekyll/configuration.rb
+++ b/lib/jekyll/configuration.rb
@@ -19,7 +19,10 @@ module Jekyll
'limit_posts' => 0,
'lsi' => false,
'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',
'permalink' => 'date',
@@ -164,6 +167,15 @@ module Jekyll
config.delete('server')
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
end
diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb
index 48be65cc..9af80571 100644
--- a/lib/jekyll/converters/markdown/redcarpet_parser.rb
+++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb
@@ -5,7 +5,7 @@ module Jekyll
module CommonMethods
def add_code_tags(code, lang)
- code = code.sub(//, "")
+ code = code.sub(//, "")
code = code.sub(/<\/pre>/,"
")
end
end
diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb
index 730af13f..ef7c4d3a 100644
--- a/lib/jekyll/page.rb
+++ b/lib/jekyll/page.rb
@@ -64,7 +64,11 @@ module Jekyll
return @url if @url
url = if permalink
- permalink
+ if site.config['relative_permalinks']
+ File.join(@dir, permalink)
+ else
+ permalink
+ end
else
{
"path" => @dir,
@@ -114,7 +118,14 @@ module Jekyll
self.data.deep_merge({
"url" => self.url,
"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
# Obtain destination path.
@@ -144,5 +155,9 @@ module Jekyll
def index?
basename == 'index'
end
+
+ def uses_relative_permalinks
+ permalink && @dir != "" && site.config['relative_permalinks']
+ end
end
end
diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb
index 571d854d..9d10a5cb 100644
--- a/lib/jekyll/post.rb
+++ b/lib/jekyll/post.rb
@@ -76,7 +76,7 @@ module Jekyll
def populate_categories
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
self.categories.flatten!
end
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index d8a36e1b..16ccd7e9 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -231,6 +231,7 @@ module Jekyll
end
self.pages.each do |page|
+ relative_permalinks_deprecation_method if page.uses_relative_permalinks
page.render(self.layouts, payload)
end
@@ -418,5 +419,18 @@ module Jekyll
post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post }
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
diff --git a/site/docs/configuration.md b/site/docs/configuration.md
index d8da48b4..ffdbf6ef 100644
--- a/site/docs/configuration.md
+++ b/site/docs/configuration.md
@@ -253,6 +253,8 @@ show_drafts: nil
limit_posts: 0
pygments: true
+relative_permalinks: true
+
permalink: date
paginate_path: 'page:num'
diff --git a/site/docs/templates.md b/site/docs/templates.md
index 1c4d2396..64cbdb2e 100644
--- a/site/docs/templates.md
+++ b/site/docs/templates.md
@@ -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 %})
{% endraw %}
{% 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 %}
diff --git a/site/docs/upgrading.md b/site/docs/upgrading.md
index 6c5b42d2..cea5a923 100644
--- a/site/docs/upgrading.md
+++ b/site/docs/upgrading.md
@@ -33,6 +33,25 @@ rebuild each time a file changes, just add the `--watch` flag at the end.
or `jekyll build`.
+### 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.
+
+
+
Absolute permalinks will be default in v1.1 and on
+
+ 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.
+
+
+
### Custom Config File
Rather than passing individual flags via the command line, you can now pass an
diff --git a/test/source/_posts/2013-05-10-number-category.textile b/test/source/_posts/2013-05-10-number-category.textile
new file mode 100644
index 00000000..1a490a88
--- /dev/null
+++ b/test/source/_posts/2013-05-10-number-category.textile
@@ -0,0 +1,7 @@
+---
+layout: default
+title: Number Category in YAML
+category: 2013
+---
+
+Please make me pass
\ No newline at end of file
diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb
index cb8b5486..35c451c5 100644
--- a/test/test_generated_site.rb
+++ b/test/test_generated_site.rb
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end
should "ensure post count is as expected" do
- assert_equal 33, @site.posts.size
+ assert_equal 34, @site.posts.size
end
should "insert site.posts into the index" do
diff --git a/test/test_post.rb b/test/test_post.rb
index b28af071..9ea972a8 100644
--- a/test/test_post.rb
+++ b/test/test_post.rb
@@ -422,6 +422,12 @@ class TestPost < Test::Unit::TestCase
post = setup_post("2009-01-27-empty-categories.textile")
assert_equal [], post.categories
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
post = setup_post("2009-05-18-tag.textile")
diff --git a/test/test_redcarpet.rb b/test/test_redcarpet.rb
index ce4cb826..c6e8b922 100644
--- a/test/test_redcarpet.rb
+++ b/test/test_redcarpet.rb
@@ -30,9 +30,9 @@ class TestRedcarpet < Test::Unit::TestCase
setup do
@markdown = Converters::Markdown.new @config.merge({ 'pygments' => true })
end
-
+
should "render fenced code blocks with syntax highlighting" do
- assert_equal "", @markdown.convert(
+ assert_equal "", @markdown.convert(
<<-EOS
```ruby
puts "Hello world"
@@ -48,7 +48,7 @@ puts "Hello world"
end
should "render fenced code blocks without syntax highlighting" do
- assert_equal "", @markdown.convert(
+ assert_equal "", @markdown.convert(
<<-EOS
```ruby
puts "Hello world"
diff --git a/test/test_site.rb b/test/test_site.rb
index 37fec83f..4e46ba7f 100644
--- a/test/test_site.rb
+++ b/test/test_site.rb
@@ -172,7 +172,7 @@ class TestSite < Test::Unit::TestCase
posts = Dir[source_dir("**", "_posts", "**", "*")]
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 categories, @site.categories.keys.sort