From 50236be19c7ec4a47fe501f1f63edcd17f4927f4 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Sat, 7 Sep 2013 23:06:51 +0200
Subject: [PATCH 001/146] Fix 1.2.0 release post title
---
site/_posts/2013-09-06-jekyll-1-2-0-released.markdown | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown b/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
index cb0b88824..30c1157ac 100644
--- a/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
+++ b/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
@@ -1,6 +1,6 @@
---
layout: news_item
-title: "Jekyll 1.2 Released"
+title: "Jekyll 1.2.0 Released"
date: "2013-09-06 22:02:41 -0400"
author: parkr
version: 1.2.0
From 421e58ad590d5964bceac90dcd5712acdf1fc394 Mon Sep 17 00:00:00 2001
From: Ishibashi Hideto
Date: Tue, 10 Sep 2013 23:12:15 +0900
Subject: [PATCH 002/146] =?UTF-8?q?a=20patch=20for=20the=20issue:=20[Liqui?=
=?UTF-8?q?d=20doesn't=20render=20my=20partial=20=C2=B7=20Issue=20#1519=20?=
=?UTF-8?q?=C2=B7=20mojombo/jekyll](https://github.com/mojombo/jekyll/issu?=
=?UTF-8?q?es/1519)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/jekyll/tags/include.rb | 4 ++++
test/test_tags.rb | 17 +++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index d98df06f8..0184a6a4b 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -80,6 +80,10 @@ eos
return "The included file '_includes/#{@file}' should not be a symlink"
end
end
+
+ def blank?
+ false
+ end
end
end
end
diff --git a/test/test_tags.rb b/test/test_tags.rb
index d09928736..5e25c1db2 100644
--- a/test/test_tags.rb
+++ b/test/test_tags.rb
@@ -436,5 +436,22 @@ CONTENT
assert_match "", @result
end
end
+
+ context "without parameters within if statement" do
+ setup do
+ content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
+ end
+
+ should "include file with empty parameters within if statement" do
+ assert_match "", @result
+ end
+ end
end
end
From 0afe79d1cbdf29121634efc922cc430b3227634a Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Wed, 11 Sep 2013 18:00:28 +0200
Subject: [PATCH 003/146] mute LSI output in tests
---
test/test_related_posts.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/test_related_posts.rb b/test/test_related_posts.rb
index 6111a2242..27529bb3f 100644
--- a/test/test_related_posts.rb
+++ b/test/test_related_posts.rb
@@ -29,6 +29,7 @@ class TestRelatedPosts < Test::Unit::TestCase
'destination' => dest_dir,
'lsi' => true})
end
+ any_instance_of(Jekyll::RelatedPosts, :display => nil)
@site = Site.new(Jekyll.configuration)
end
From 3e936e8b756622f077858cf7e4f7029e6e687804 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Wed, 11 Sep 2013 19:15:47 -0400
Subject: [PATCH 004/146] Update site/docs/history.md as per #1512.
---
site/docs/history.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/site/docs/history.md b/site/docs/history.md
index 195119a36..6c4653fed 100644
--- a/site/docs/history.md
+++ b/site/docs/history.md
@@ -15,7 +15,7 @@ prev_section: contributing
- Catch and fix invalid `paginate` values ([#1390]({{ site.repository }}/issues/1390))
- Remove superfluous `div.container` from the default html template for
`jekyll new` ([#1315]({{ site.repository }}/issues/1315))
-- Add -D short-form switch for the drafts option ([#1394]({{ site.repository }}/issues/1394))
+- Add `-D` short-form switch for the drafts option ([#1394]({{ site.repository }}/issues/1394))
- Update the links in the site template for Twitter and GitHub ([#1400]({{ site.repository }}/issues/1400))
- Update dummy email address to example.com domain ([#1408]({{ site.repository }}/issues/1408))
- Update normalize.css to v2.1.2 and minify; add rake task to update
@@ -65,7 +65,7 @@ prev_section: contributing
- Fix markup for the Kramdown options ([#1445]({{ site.repository }}/issues/1445))
- Fix typos in the History file ([#1454]({{ site.repository }}/issues/1454))
- Add trailing slash to site's post URL ([#1462]({{ site.repository }}/issues/1462))
-- Clarify that --config will take multiple files ([#1474]({{ site.repository }}/issues/1474))
+- Clarify that `--config` will take multiple files ([#1474]({{ site.repository }}/issues/1474))
- Fix docs/templates.md private gist example ([#1477]({{ site.repository }}/issues/1477))
- Use `site.repository` for Jekyll's GitHub URL ([#1463]({{ site.repository }}/issues/1463))
- Add `jekyll-pageless-redirects` to list of third-party plugins ([#1486]({{ site.repository }}/issues/1486))
@@ -302,7 +302,7 @@ prev_section: contributing
- Allow symlinked files in unsafe mode ([#824]({{ site.repository }}/issues/824))
- Add 'gist' Liquid tag to core ([#822]({{ site.repository }}/issues/822), [#861]({{ site.repository }}/issues/861))
- New format of Jekyll output ([#795]({{ site.repository }}/issues/795))
-- Reinstate --limit_posts and --future switches ([#788]({{ site.repository }}/issues/788))
+- Reinstate `--limit_posts` and `--future` switches ([#788]({{ site.repository }}/issues/788))
- Remove ambiguity from command descriptions ([#815]({{ site.repository }}/issues/815))
- Fix SafeYAML Warnings ([#807]({{ site.repository }}/issues/807))
- Relaxed Kramdown version to 0.14 ([#808]({{ site.repository }}/issues/808))
@@ -325,7 +325,7 @@ prev_section: contributing
- Catch all exceptions, not just StandardError descendents ([#1007]({{ site.repository }}/issues/1007))
- Bullet-proof limit_posts option ([#1004]({{ site.repository }}/issues/1004))
- Read in YAML as UTF-8 to accept non-ASCII chars ([#836]({{ site.repository }}/issues/836))
-- Fix the CLI option --plugins to actually accept dirs and files ([#993]({{ site.repository }}/issues/993))
+- Fix the CLI option `--plugins` to actually accept dirs and files ([#993]({{ site.repository }}/issues/993))
- Allow 'excerpt' in YAML Front-Matter to override the extracted excerpt ([#946]({{ site.repository }}/issues/946))
- Fix cascade problem with site.baseurl, site.port and site.host. ([#935]({{ site.repository }}/issues/935))
- Filter out directories with valid post names ([#875]({{ site.repository }}/issues/875))
From e65305990abc335cac9ab11110e4ef42355d7cfc Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Wed, 11 Sep 2013 23:45:01 -0400
Subject: [PATCH 005/146] Update history to reflect merge of #1525
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 3e2d583c1..065408e01 100644
--- a/History.markdown
+++ b/History.markdown
@@ -8,6 +8,7 @@
### Bug Fixes
* Fix file discrepancy in gemspec (#1522)
+ * Force rendering of Include tag (#1525)
### Development Fixes
* Add a rake task to generate a new release post (#1404)
From 87de8ddeb46cc493d213f269f4e16bc8747b5f5d Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 13:26:32 +0200
Subject: [PATCH 006/146] fix test muting to work for Ruby > 1.9
---
test/test_related_posts.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_related_posts.rb b/test/test_related_posts.rb
index 27529bb3f..79409f848 100644
--- a/test/test_related_posts.rb
+++ b/test/test_related_posts.rb
@@ -29,7 +29,7 @@ class TestRelatedPosts < Test::Unit::TestCase
'destination' => dest_dir,
'lsi' => true})
end
- any_instance_of(Jekyll::RelatedPosts, :display => nil)
+ any_instance_of(Jekyll::RelatedPosts) { |i| stub(i).display }
@site = Site.new(Jekyll.configuration)
end
From db397dacdd09298040b65036ebd90102a875c1c1 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 10:23:24 -0400
Subject: [PATCH 007/146] Upgrade to Liquid 2.5.2
---
jekyll.gemspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jekyll.gemspec b/jekyll.gemspec
index 25a83d538..5d957e9db 100644
--- a/jekyll.gemspec
+++ b/jekyll.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.markdown LICENSE]
- s.add_runtime_dependency('liquid', "~> 2.5.1")
+ s.add_runtime_dependency('liquid', "~> 2.5.2")
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('directory_watcher', "~> 1.4.1")
s.add_runtime_dependency('maruku', "~> 0.5")
From c219323384a6c21bd0e86515175aef1531abad4d Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 10:38:02 -0400
Subject: [PATCH 008/146] Update history to reflect merge of #1516
---
History.markdown | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/History.markdown b/History.markdown
index 065408e01..2a4a65e81 100644
--- a/History.markdown
+++ b/History.markdown
@@ -18,7 +18,7 @@
* Make navigation menus reusable (#1507)
* Fix link to History page from Release v1.2.0 notes post.
* Fix markup in History file for command line options (#1512)
-
+ * Expand 1.2 release post title to 1.2.0 (#1516)
## 1.2.0 / 2013-09-06
From 0090227487b052f7c2cfff085f7b5fa0ca653218 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 10:48:42 -0400
Subject: [PATCH 009/146] Update CONTRIBUTING docs for better PRs.
---
CONTRIBUTING.markdown | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown
index 95ae0c8f4..6df99625d 100644
--- a/CONTRIBUTING.markdown
+++ b/CONTRIBUTING.markdown
@@ -11,14 +11,20 @@ following in mind:
[RR](http://github.com/btakita/rr/tree/master).
* If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
- where appropriate. Also, whipping up some documentation in your fork's wiki
+ where appropriate. Also, whipping up some documentation in your fork's `site`
would be appreciated, and once merged it will be transferred over to the main
- wiki.
+ `site`, jekyllrb.com.
* If your contribution changes any Jekyll behavior, make sure to update the
documentation. It lives in `site/docs`. If the docs are missing information,
please feel free to add it in. Great docs make a great project!
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
when modifying Ruby code.
+* Please do your best to submit **small pull requests**. The easier the proposed
+ change is to review, the more likely it will be merged.
+* When submitting a pull request, please make judicious use of the pull request
+ body. A description of what changes were made, the motivations behind the
+ changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
+ will also speed up review time.
Test Dependencies
-----------------
@@ -32,8 +38,8 @@ you're all set!
Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly):
- $ rake test
- $ rake features
+ $ bundle exec rake test
+ $ bundle exec rake features
Workflow
--------
@@ -65,8 +71,7 @@ All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted.
The [Jekyll wiki](https://github.com/mojombo/jekyll/wiki) on GitHub
-can be freely updated without a pull request as all
-GitHub users have access.
+can be freely updated without a pull request as all GitHub users have access.
Gotchas
-------
From c38220f45c09844467eba15c3b5dbf1843be091d Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 12:45:19 -0400
Subject: [PATCH 010/146] Update history to reflect merge of #1531
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 2a4a65e81..dca9b5dbc 100644
--- a/History.markdown
+++ b/History.markdown
@@ -12,6 +12,7 @@
### Development Fixes
* Add a rake task to generate a new release post (#1404)
+ * Mute LSI output in tests (#1531)
### Site Enhancements
* Fix a couple of validation errors on the site (#1511)
From 214c851be5d0210c6dd499de16a8ac41168cd812 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 14:02:22 -0400
Subject: [PATCH 011/146] Update history to reflect merge of #1536
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index dca9b5dbc..d707b35eb 100644
--- a/History.markdown
+++ b/History.markdown
@@ -5,6 +5,7 @@
### Minor Enhancements
* Disable reverse lookup when running `jekyll serve` (#1363)
* Upgrade RedCarpet dependency to `~> 2.3.0` (#1515)
+ * Upgrade to Liquid `>= 2.5.2, < 2.6` (#1536)
### Bug Fixes
* Fix file discrepancy in gemspec (#1522)
From c926596be7972389754a7344477476e4d522e1a1 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 8 Sep 2013 15:58:57 -0400
Subject: [PATCH 012/146] Print better messages for detached server. Mute
output on detach.
---
bin/jekyll | 2 ++
lib/jekyll/commands/serve.rb | 51 +++++++++++++++++++++++++++---------
2 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/bin/jekyll b/bin/jekyll
index 53ce267e3..ee497c255 100755
--- a/bin/jekyll
+++ b/bin/jekyll
@@ -65,6 +65,7 @@ command :build do |c|
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
+ c.option '-v', '--verbose', 'Print verbose output.'
c.action do |args, options|
options = normalize_options(options.__hash__)
@@ -84,6 +85,7 @@ command :serve do |c|
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-B', '--detach', 'Run the server in the background (detach)'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
+ c.option '-v', '--verbose', 'Print verbose output.'
c.option '-P', '--port [PORT]', 'Port to listen on'
c.option '-H', '--host [HOST]', 'Host to bind to'
diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb
index 82bbc9470..9cec54571 100644
--- a/lib/jekyll/commands/serve.rb
+++ b/lib/jekyll/commands/serve.rb
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- encoding: utf-8 -*-
module Jekyll
module Commands
class Serve < Command
@@ -10,32 +10,57 @@ module Jekyll
FileUtils.mkdir_p(destination)
- mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__))
- mime_types = WEBrick::HTTPUtils::load_mime_types(mime_types_file)
-
# recreate NondisclosureName under utf-8 circumstance
fh_option = WEBrick::Config::FileHandler
fh_option[:NondisclosureName] = ['.ht*','~*']
- s = HTTPServer.new(
- :Port => options['port'],
- :BindAddress => options['host'],
- :MimeTypes => mime_types,
- :DoNotReverseLookup => true
- )
+ s = HTTPServer.new(webrick_options(options))
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option)
if options['detach'] # detach the server
- pid = Process.fork {s.start}
+ pid = Process.fork { s.start }
Process.detach(pid)
- pid
+ Jekyll.logger.info "Server detatched with pid '#{pid}'.", "Run `kill -9 #{pid}' to stop the server."
else # create a new server thread, then join it with current terminal
- t = Thread.new { s.start }
+ t = Thread.new {
+
+ s.start
+ }
trap("INT") { s.shutdown }
t.join()
end
end
+
+ def self.webrick_options(config)
+ opts = {
+ :Port => config['port'],
+ :BindAddress => config['host'],
+ :MimeTypes => self.mime_types,
+ :DoNotReverseLookup => true,
+ :StartCallback => start_callback(config['detach'])
+ }
+
+ if !config['verbose']
+ opts.merge!({
+ :AccessLog => [],
+ :Logger => Log::new([], Log::WARN)
+ })
+ end
+
+ opts
+ end
+
+ def self.start_callback(detached)
+ unless detached
+ Proc.new { Jekyll.logger.info "Server running...", "press ctrl-c to stop." }
+ end
+ end
+
+ def self.mime_types
+ mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__))
+ WEBrick::HTTPUtils::load_mime_types(mime_types_file)
+ end
end
end
end
From 4b8bb68e56dab5a10b366856804d3436c866d8d9 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Thu, 12 Sep 2013 14:05:16 -0400
Subject: [PATCH 013/146] Cleanup newlines in Commands::Serve
---
lib/jekyll/commands/serve.rb | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb
index 9cec54571..92a6aa480 100644
--- a/lib/jekyll/commands/serve.rb
+++ b/lib/jekyll/commands/serve.rb
@@ -23,10 +23,7 @@ module Jekyll
Process.detach(pid)
Jekyll.logger.info "Server detatched with pid '#{pid}'.", "Run `kill -9 #{pid}' to stop the server."
else # create a new server thread, then join it with current terminal
- t = Thread.new {
-
- s.start
- }
+ t = Thread.new { s.start }
trap("INT") { s.shutdown }
t.join()
end
From 699627e708d8f68ce0cdecd99a8157c0f56a75ec Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 21:19:30 +0200
Subject: [PATCH 014/146] add coveralls to gemfile
---
Gemfile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Gemfile b/Gemfile
index 851fabc21..8675f1e71 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,2 +1,6 @@
source 'https://rubygems.org'
gemspec
+
+if RUBY_VERSION > '1.9'
+ gem 'coveralls', :require => false
+end
\ No newline at end of file
From 5ee41cd3bb646443a444b728660bd736ae3789af Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 21:04:04 +0200
Subject: [PATCH 015/146] setup coveralls for cucumber
---
features/support/env.rb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/features/support/env.rb b/features/support/env.rb
index efe6b1b6e..7a77cd0ec 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,3 +1,8 @@
+if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true"
+ require 'coveralls'
+ Coveralls.wear_merged!
+end
+
require 'fileutils'
require 'rr'
require 'test/unit'
From a12227c07a01ad7200dcbced8610cbbf38627870 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 21:05:56 +0200
Subject: [PATCH 016/146] setup coveralls for unit tests
---
test/helper.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/helper.rb b/test/helper.rb
index 3ee3f2b6f..b54bf01f6 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -2,6 +2,9 @@ if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true"
require 'simplecov'
require 'simplecov-gem-adapter'
SimpleCov.start('gem')
+
+ require 'coveralls'
+ Coveralls.wear_merged!
end
require 'rubygems'
From 66606a7e82d7d12f57b176fa1f0141d9a5ddd2ab Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 21:09:22 +0200
Subject: [PATCH 017/146] enable coveralls on Travis-CI
---
.travis.yml | 1 +
Rakefile | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 7e970a6d8..15a8b56f7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
language: ruby
before_install:
- gem install bundler
+env: COVERAGE=true
rvm:
- 2.0.0
- 1.9.3
diff --git a/Rakefile b/Rakefile
index 2f973cdaf..dec33c449 100644
--- a/Rakefile
+++ b/Rakefile
@@ -84,7 +84,14 @@ end
#
#############################################################################
-task :default => [:test, :features]
+if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true" && ENV["TRAVIS"] == "true"
+ require 'coveralls/rake/task'
+ Coveralls::RakeTask.new
+
+ task :default => [:test, :features, 'coveralls:push']
+else
+ task :default => [:test, :features]
+end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
From aa10f8c89e927da0144cdb3fef8dccb209d8cadd Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 12 Sep 2013 21:10:29 +0200
Subject: [PATCH 018/146] add status badge to README
---
README.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.markdown b/README.markdown
index 9bfe0e80f..94080ed11 100644
--- a/README.markdown
+++ b/README.markdown
@@ -5,6 +5,7 @@
[](https://travis-ci.org/mojombo/jekyll)
[](https://codeclimate.com/github/mojombo/jekyll)
[](https://gemnasium.com/mojombo/jekyll)
+[](https://coveralls.io/r/mojombo/jekyll)
By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
From 1473448dfd55ef51c994bef1a5f4c153b6e0ed4a Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Sat, 14 Sep 2013 08:00:35 -0500
Subject: [PATCH 019/146] Update history to reflect merge of #1537
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index d707b35eb..fe5c04a01 100644
--- a/History.markdown
+++ b/History.markdown
@@ -14,6 +14,7 @@
### Development Fixes
* Add a rake task to generate a new release post (#1404)
* Mute LSI output in tests (#1531)
+ * Update contributor documentation (#1537)
### Site Enhancements
* Fix a couple of validation errors on the site (#1511)
From b26327f20a46e8a4d0dcba6e1c99c0a36d679cb3 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Sat, 14 Sep 2013 15:28:41 +0200
Subject: [PATCH 020/146] simplify conditions for coverage reports
---
.travis.yml | 1 -
Gemfile | 6 +-----
Rakefile | 2 +-
features/support/env.rb | 2 +-
jekyll.gemspec | 1 +
test/helper.rb | 2 +-
6 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 15a8b56f7..7e970a6d8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
language: ruby
before_install:
- gem install bundler
-env: COVERAGE=true
rvm:
- 2.0.0
- 1.9.3
diff --git a/Gemfile b/Gemfile
index 8675f1e71..d92669713 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,2 @@
source 'https://rubygems.org'
-gemspec
-
-if RUBY_VERSION > '1.9'
- gem 'coveralls', :require => false
-end
\ No newline at end of file
+gemspec
\ No newline at end of file
diff --git a/Rakefile b/Rakefile
index dec33c449..e649989c8 100644
--- a/Rakefile
+++ b/Rakefile
@@ -84,7 +84,7 @@ end
#
#############################################################################
-if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true" && ENV["TRAVIS"] == "true"
+if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true"
require 'coveralls/rake/task'
Coveralls::RakeTask.new
diff --git a/features/support/env.rb b/features/support/env.rb
index 7a77cd0ec..5c7db508d 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -1,4 +1,4 @@
-if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true"
+if RUBY_VERSION > '1.9'
require 'coveralls'
Coveralls.wear_merged!
end
diff --git a/jekyll.gemspec b/jekyll.gemspec
index 25a83d538..d05cbf156 100644
--- a/jekyll.gemspec
+++ b/jekyll.gemspec
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('launchy', "~> 2.1.2")
s.add_development_dependency('simplecov', "~> 0.7")
s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
+ s.add_development_dependency('coveralls', "~> 0.6.9")
s.add_development_dependency('activesupport', '~> 3.2.13')
# = MANIFEST =
diff --git a/test/helper.rb b/test/helper.rb
index b54bf01f6..5eb419386 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,4 +1,4 @@
-if RUBY_VERSION > '1.9' && ENV["COVERAGE"] == "true"
+if RUBY_VERSION > '1.9'
require 'simplecov'
require 'simplecov-gem-adapter'
SimpleCov.start('gem')
From 5355fcf02d35db68ac72d5691fdf5a324b31b9b4 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:09:26 -0400
Subject: [PATCH 021/146] Update Contributing page in the docs to match the new
CONTRIBUTING.markdown. #1537.
---
site/docs/contributing.md | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/site/docs/contributing.md b/site/docs/contributing.md
index b0e0531e8..0740e32a8 100644
--- a/site/docs/contributing.md
+++ b/site/docs/contributing.md
@@ -16,13 +16,19 @@ following in mind:
* If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
where appropriate. Also, whipping up some documentation in your fork's `site`
- directory would be appreciated, and once merged it will also appear in
- the next update of the main site.
-* If your contribution adds or changes any Jekyll behavior, make sure to update
- the documentation. It lives in `site/docs`. If the docs are missing
- information, please feel free to add it in. Great docs make a great project!
+ would be appreciated, and once merged it will be transferred over to the main
+ `site`, jekyllrb.com.
+* If your contribution changes any Jekyll behavior, make sure to update the
+ documentation. It lives in `site/docs`. If the docs are missing information,
+ please feel free to add it in. Great docs make a great project!
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
when modifying Ruby code.
+* Please do your best to submit **small pull requests**. The easier the proposed
+ change is to review, the more likely it will be merged.
+* When submitting a pull request, please make judicious use of the pull request
+ body. A description of what changes were made, the motivations behind the
+ changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
+ will also speed up review time.
Contributions will not be accepted without tests
@@ -47,8 +53,8 @@ Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly):
{% highlight bash %}
-$ rake test
-$ rake features
+$ bundle exec rake test
+$ bundle exec rake features
{% endhighlight %}
Workflow
@@ -79,8 +85,8 @@ git checkout -b my_awesome_feature
git push origin my_awesome_feature
{% endhighlight %}
-* Create a pull request against mojombo/jekyll and describe what your change
- does and the why you think it should be merged.
+* Create a pull request against mojombo/jekyll:master and describe what your
+ change does and the why you think it should be merged.
Updating Documentation
----------------------
From 97cb3f1336a3873a875276a00694f9cf999e187a Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:16:26 -0400
Subject: [PATCH 022/146] Update JekyllImport::WordPress instructions on docs
site.
Closes #1548.
---
site/docs/migrations.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/site/docs/migrations.md b/site/docs/migrations.md
index 2d6b808a5..e5fb36a07 100644
--- a/site/docs/migrations.md
+++ b/site/docs/migrations.md
@@ -74,7 +74,7 @@ here's how:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
- JekyllImport::WordPress.process("database", "user", "pass")'
+ JekyllImport::WordPress.process({:database => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
If you are using Webfaction and have to set up an [SSH
From a1e16b3d581bb06b66531c089e549da04a6af8c1 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:45:24 -0400
Subject: [PATCH 023/146] Update history to reflect merge of #1518
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index fe5c04a01..25ae1e2f4 100644
--- a/History.markdown
+++ b/History.markdown
@@ -3,6 +3,7 @@
### Major Enhancements
### Minor Enhancements
+ * Print better messages for detached server. Mute output on detach. (#1518)
* Disable reverse lookup when running `jekyll serve` (#1363)
* Upgrade RedCarpet dependency to `~> 2.3.0` (#1515)
* Upgrade to Liquid `>= 2.5.2, < 2.6` (#1536)
From d44579833042ac85f571de3d86b8b087bd05a277 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:48:20 -0400
Subject: [PATCH 024/146] Fix site:releases:new rake task.
---
Rakefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Rakefile b/Rakefile
index 2f973cdaf..ee7f9d01d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -217,6 +217,7 @@ namespace :site do
task :new, :version do |t, args|
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
today = Time.new.strftime('%Y-%m-%d')
+ release = args.version.to_s
filename = "site/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
File.open(filename, "wb") do |post|
From f922ae10e5793255ca1af201948d8809842425d1 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:49:23 -0400
Subject: [PATCH 025/146] Update the History file
---
History.markdown | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/History.markdown b/History.markdown
index 25ae1e2f4..16267de17 100644
--- a/History.markdown
+++ b/History.markdown
@@ -2,6 +2,16 @@
### Major Enhancements
+### Minor Enhancements
+
+### Bug Fixes
+
+### Development Fixes
+
+### Site Enhancements
+
+## 1.2.1 / 2013-09-14
+
### Minor Enhancements
* Print better messages for detached server. Mute output on detach. (#1518)
* Disable reverse lookup when running `jekyll serve` (#1363)
From f169e37c814b8e2544bee63e4646744f4398f178 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:56:42 -0400
Subject: [PATCH 026/146] Add release post.
---
.../2013-09-14-jekyll-1-2-1-released.markdown | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
diff --git a/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown b/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
new file mode 100644
index 000000000..26a6ca157
--- /dev/null
+++ b/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
@@ -0,0 +1,19 @@
+---
+layout: news_item
+title: 'Jekyll 1.2.1 Released'
+date: 2013-09-14 20:46:50 -0400
+author: parkr
+version: 1.2.1
+categories: [release]
+---
+
+Quick turnover, anyone? A [recent incompatibility with Liquid
+v2.5.2](https://github.com/mojombo/jekyll/pull/1525) produced a nasty bug in
+which `include` tags were not rendered properly within `if` blocks.
+
+This release also includes a better handling of detached servers (prints pid and
+the command for killing the process). **Note**: the `--detach` flag and
+`--watch` flags are presently incompatible in 1.2.x. Fix for that coming soon!
+
+For a full list of the fixes in this release, check out [the change
+log](/docs/history/)!
From be9c0dcc7ea8a8bac47864b49f411168734c3ab6 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:57:10 -0400
Subject: [PATCH 027/146] Update docs/history.md for v1.2.1
---
site/docs/history.md | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/site/docs/history.md b/site/docs/history.md
index 6c4653fed..1b2e7ffca 100644
--- a/site/docs/history.md
+++ b/site/docs/history.md
@@ -5,6 +5,30 @@ permalink: /docs/history/
prev_section: contributing
---
+## 1.2.1 / 2013-09-14
+
+### Minor Enhancements
+- Print better messages for detached server. Mute output on detach. ([#1518]({{ site.repository }}/issues/1518))
+- Disable reverse lookup when running `jekyll serve` ([#1363]({{ site.repository }}/issues/1363))
+- Upgrade RedCarpet dependency to `~> 2.3.0` ([#1515]({{ site.repository }}/issues/1515))
+- Upgrade to Liquid `>= 2.5.2, < 2.6` ([#1536]({{ site.repository }}/issues/1536))
+
+### Bug Fixes
+- Fix file discrepancy in gemspec ([#1522]({{ site.repository }}/issues/1522))
+- Force rendering of Include tag ([#1525]({{ site.repository }}/issues/1525))
+
+### Development Fixes
+- Add a rake task to generate a new release post ([#1404]({{ site.repository }}/issues/1404))
+- Mute LSI output in tests ([#1531]({{ site.repository }}/issues/1531))
+- Update contributor documentation ([#1537]({{ site.repository }}/issues/1537))
+
+### Site Enhancements
+- Fix a couple of validation errors on the site ([#1511]({{ site.repository }}/issues/1511))
+- Make navigation menus reusable ([#1507]({{ site.repository }}/issues/1507))
+- Fix link to History page from Release v1.2.0 notes post.
+- Fix markup in History file for command line options ([#1512]({{ site.repository }}/issues/1512))
+- Expand 1.2 release post title to 1.2.0 ([#1516]({{ site.repository }}/issues/1516))
+
## 1.2.0 / 2013-09-06
### Major Enhancements
From 6f053fbc8ca1d7307b89106f96a8042d734be221 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 14 Sep 2013 20:59:06 -0400
Subject: [PATCH 028/146] Update gemspec & version to v1.2.1
---
jekyll.gemspec | 5 +++--
lib/jekyll.rb | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/jekyll.gemspec b/jekyll.gemspec
index 5d957e9db..7617a8e99 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.2.0'
+ s.version = '1.2.1'
s.license = 'MIT'
- s.date = '2013-09-06'
+ s.date = '2013-09-14'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@@ -149,6 +149,7 @@ Gem::Specification.new do |s|
site/_posts/2013-07-25-jekyll-1-0-4-released.markdown
site/_posts/2013-07-25-jekyll-1-1-2-released.markdown
site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
+ site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
site/css/gridism.css
site/css/normalize.css
site/css/pygments.css
diff --git a/lib/jekyll.rb b/lib/jekyll.rb
index a48d34605..7eb2dda96 100644
--- a/lib/jekyll.rb
+++ b/lib/jekyll.rb
@@ -60,7 +60,7 @@ require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
- VERSION = '1.2.0'
+ VERSION = '1.2.1'
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.
From 94eed4643612522934ac0c354fa066011fab8d3c Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Sat, 14 Sep 2013 22:21:15 -0500
Subject: [PATCH 029/146] Release 1.2.1
From d761338c2cf065aa7a7ffbad89fb4c19e830d4a0 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Sun, 15 Sep 2013 07:44:49 +0200
Subject: [PATCH 030/146] Change links to Liquid documentation
---
site/docs/templates.md | 6 +++---
site/docs/variables.md | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/site/docs/templates.md b/site/docs/templates.md
index 018350d87..a7c1980e4 100644
--- a/site/docs/templates.md
+++ b/site/docs/templates.md
@@ -7,9 +7,9 @@ permalink: /docs/templates/
---
Jekyll uses the [Liquid](http://wiki.shopify.com/Liquid) templating language to
-process templates. All of the [standard Liquid tags and
-filters](http://wiki.github.com/shopify/liquid/liquid-for-designers) are
-supported, Jekyll even adds a few handy filters and tags of its own to make
+process templates. All of the standard Liquid [tags](http://wiki.shopify.com/Logic) and
+[filters](http://wiki.shopify.com/Filters) are
+supported. Jekyll even adds a few handy filters and tags of its own to make
common tasks easier.
## Filters
diff --git a/site/docs/variables.md b/site/docs/variables.md
index ef53ebb11..3f172f205 100644
--- a/site/docs/variables.md
+++ b/site/docs/variables.md
@@ -9,7 +9,7 @@ permalink: /docs/variables/
Jekyll traverses your site looking for files to process. Any files with [YAML
Front Matter](../frontmatter/) are subject to processing. For each of these
files, Jekyll makes a variety of data available via the [Liquid templating
-system](http://wiki.github.com/shopify/liquid/liquid-for-designers). The
+system](http://wiki.shopify.com/Liquid). The
following is a reference of the available data.
## Global Variables
From f15f29a34bb4b24cb08f721e674913b5ad5d7992 Mon Sep 17 00:00:00 2001
From: Christian Grobmeier
Date: Sun, 15 Sep 2013 13:06:00 +0200
Subject: [PATCH 031/146] It's dbname, not database
---
site/docs/migrations.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/site/docs/migrations.md b/site/docs/migrations.md
index e5fb36a07..8019b1693 100644
--- a/site/docs/migrations.md
+++ b/site/docs/migrations.md
@@ -74,7 +74,7 @@ here's how:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
- JekyllImport::WordPress.process({:database => "database", :user => "user", :pass => "pass"})'
+ JekyllImport::WordPress.process({:dbname => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
If you are using Webfaction and have to set up an [SSH
From 30bce38ef25021f32f55770217c51ae5debeb7fb Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 15 Sep 2013 23:11:22 +0200
Subject: [PATCH 032/146] Fix JekyllImport::WordPress instructions on docs site
to use hash as parameter.
See comment by @grobmeier on 97cb3f1336a3873a875276a00694f9cf999e187a
---
site/docs/migrations.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/site/docs/migrations.md b/site/docs/migrations.md
index e5fb36a07..8019b1693 100644
--- a/site/docs/migrations.md
+++ b/site/docs/migrations.md
@@ -74,7 +74,7 @@ here's how:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
- JekyllImport::WordPress.process({:database => "database", :user => "user", :pass => "pass"})'
+ JekyllImport::WordPress.process({:dbname => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
If you are using Webfaction and have to set up an [SSH
From ab4fb8904342e88d71687649c8caee45e87ab93e Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 15 Sep 2013 23:13:02 +0200
Subject: [PATCH 033/146] Fix params on JekyllImport::WordPress.process so it's
using hash
---
site/docs/migrations.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/site/docs/migrations.md b/site/docs/migrations.md
index 8019b1693..b1890abb7 100644
--- a/site/docs/migrations.md
+++ b/site/docs/migrations.md
@@ -85,7 +85,7 @@ authentication system:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
- JekyllImport::WordPress.process("database", "user", "pass", "127.0.0.1")'
+ JekyllImport::WordPress.process({:host => "127.0.0.1", :dbname => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
### Further WordPress migration alternatives
From 6d28d5f95f8126303cea174873f6f9534ee5bb16 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 15 Sep 2013 17:26:15 -0400
Subject: [PATCH 034/146] Update history to reflect merge of #1554
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 16267de17..5da9f64c8 100644
--- a/History.markdown
+++ b/History.markdown
@@ -9,6 +9,7 @@
### Development Fixes
### Site Enhancements
+ * Fix params for `JekyllImport::WordPress.process` arguments (#1554)
## 1.2.1 / 2013-09-14
From ed92d1c4c2b3194b93290c573a1a3767e1c56c61 Mon Sep 17 00:00:00 2001
From: David Ensinger
Date: Sun, 15 Sep 2013 18:56:18 -0400
Subject: [PATCH 035/146] Add link to Jekyll Suggested Tweet liquid tag to list
of Tags plugins.
---
site/docs/plugins.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/site/docs/plugins.md b/site/docs/plugins.md
index 4ce17e2f1..e8e2161fb 100644
--- a/site/docs/plugins.md
+++ b/site/docs/plugins.md
@@ -430,6 +430,7 @@ You can find a few useful plugins at the following locations:
- [Jekyll Image Tag](https://github.com/robwierzbowski/jekyll-image-tag): Better images for Jekyll. Save image presets, generate resized images, and add classes, alt text, and other attributes.
- [Ditaa Tag](https://github.com/matze/jekyll-ditaa) by [matze](https://github.com/matze): Renders ASCII diagram art into PNG images and inserts a figure tag.
- [Good Include](https://github.com/penibelst/jekyll-good-include) by [Anatol Broder](http://penibelst.de/): Strips newlines and whitespaces from the end of include files before processing.
+- [Jekyll Suggested Tweet](https://github.com/davidensinger/jekyll-suggested-tweet) by [David Ensinger](https://github.com/davidensinger/): A Liquid tag for Jekyll that allows for the embedding of suggested tweets via Twitter’s Web Intents API.
#### Collections
From 79c2d5c8f7e762884626fd66d7eed081004dcf0c Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 15 Sep 2013 20:19:38 -0400
Subject: [PATCH 036/146] Update history to reflect merge of #1555
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 5da9f64c8..95ca169e2 100644
--- a/History.markdown
+++ b/History.markdown
@@ -10,6 +10,7 @@
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
+ * Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
## 1.2.1 / 2013-09-14
From 79f50b0568be8c5c08144f058f158193e48ec4a9 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Mon, 16 Sep 2013 08:15:10 +0200
Subject: [PATCH 037/146] Resolve conflict
---
lib/jekyll/tags/include.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 0184a6a4b..b41c03bc6 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -55,7 +55,7 @@ eos
return error
end
- source = File.read(File.join(includes_dir, @file))
+ source = read_file(File.join(includes_dir, @file))
partial = Liquid::Template.parse(source)
context.stack do
@@ -77,13 +77,17 @@ eos
if !File.exists?(file)
return "Included file #{@file} not found in _includes directory"
elsif File.symlink?(file)
- return "The included file '_includes/#{@file}' should not be a symlink"
+ return "The included file '_includes/#{file}' should not be a symlink"
end
end
def blank?
false
end
+
+ def read_file(file)
+ return File.read(file)
+ end
end
end
end
From 081b974114ca2912866e36d45a77ff4f8150503e Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Mon, 16 Sep 2013 08:19:56 +0200
Subject: [PATCH 038/146] Resolve conflict
---
lib/jekyll/tags/include.rb | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index b41c03bc6..3cb8820ba 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -4,6 +4,8 @@ module Jekyll
MATCHER = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
+ INCLUDES_DIR = '_includes'
+
def initialize(tag_name, markup, tokens)
super
@file, @params = markup.strip.split(' ', 2);
@@ -49,14 +51,13 @@ eos
end
def render(context)
- includes_dir = File.join(context.registers[:site].source, '_includes')
+ dir = includes_dir(context)
- if error = validate_file(includes_dir)
+ if error = validate_file(dir)
return error
end
- source = read_file(File.join(includes_dir, @file))
- partial = Liquid::Template.parse(source)
+ partial = Liquid::Template.parse(source(dir))
context.stack do
context['include'] = parse_params(context) if @params
@@ -64,20 +65,20 @@ eos
end
end
- def validate_file(includes_dir)
- if File.symlink?(includes_dir)
- return "Includes directory '#{includes_dir}' cannot be a symlink"
+ def validate_file(dir)
+ if File.symlink?(dir)
+ return "Includes directory '#{dir}' cannot be a symlink"
end
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
return "Include file '#{@file}' contains invalid characters or sequences"
end
- file = File.join(includes_dir, @file)
+ file = File.join(dir, @file)
if !File.exists?(file)
- return "Included file #{@file} not found in _includes directory"
+ return "Included file #{@file} not found in #{INCLUDES_DIR} directory"
elsif File.symlink?(file)
- return "The included file '_includes/#{file}' should not be a symlink"
+ return "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
@@ -85,8 +86,14 @@ eos
false
end
- def read_file(file)
- return File.read(file)
+ # This method allows to modify the file content by inheriting from the class.
+ # Don’t refactor it.
+ def source(dir)
+ File.read(File.join(dir, @file))
+ end
+
+ def includes_dir(context)
+ File.join(context.registers[:site].source, INCLUDES_DIR)
end
end
end
From 891ea8f604d6fb17d8d9b61a7ae524965ee7469e Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Mon, 16 Sep 2013 08:37:07 +0200
Subject: [PATCH 039/146] People can symlink it if they want in unsafe mode
---
lib/jekyll/tags/include.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 3cb8820ba..4bae7db14 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -66,7 +66,7 @@ eos
end
def validate_file(dir)
- if File.symlink?(dir)
+ if File.symlink?(dir) && context.registers[:site].safe?
return "Includes directory '#{dir}' cannot be a symlink"
end
@@ -77,7 +77,7 @@ eos
file = File.join(dir, @file)
if !File.exists?(file)
return "Included file #{@file} not found in #{INCLUDES_DIR} directory"
- elsif File.symlink?(file)
+ elsif File.symlink?(file) && context.registers[:site].safe?
return "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
From f606d9339b40f4e442834da5f11018334de63a13 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Sun, 30 Jun 2013 17:36:10 +0200
Subject: [PATCH 040/146] add features to test source and dest matching
---
features/site_configuration.feature | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/features/site_configuration.feature b/features/site_configuration.feature
index 706e5b669..80a4b50b1 100644
--- a/features/site_configuration.feature
+++ b/features/site_configuration.feature
@@ -18,6 +18,28 @@ Feature: Site configuration
Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html"
+ Scenario: Similarly named source and destination
+ Given I have a blank site in "mysite_source"
+ And I have an "mysite_source/index.html" file that contains "html"
+ And I have a configuration file with:
+ | key | value |
+ | source | mysite_source |
+ | destination | mysite |
+ When I run jekyll
+ Then the mysite directory should exist
+ And I should see "html" in "mysite/index.html"
+
+ Scenario: Similarly named source and destination 2
+ Given I have a blank site in "mysite"
+ And I have an "mysite/index.html" file that contains "html"
+ And I have a configuration file with:
+ | key | value |
+ | source | mysite |
+ | destination | mysite_dest |
+ When I run jekyll
+ Then the mysite_dest directory should exist
+ And I should see "html" in "mysite_dest/index.html"
+
Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
From bec4a07c1287df0f1194d2fd5be55a9e5fa4c1e3 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Mon, 16 Sep 2013 14:41:20 +0200
Subject: [PATCH 041/146] Fix handling of source-dest matching being too
aggressive
Fixes #1130.
---
lib/jekyll/site.rb | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index f4a5bd0dd..ef7be1fca 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -63,11 +63,7 @@ module Jekyll
#
# Returns nothing.
def setup
- # Check that the destination dir isn't the source dir or a directory
- # parent to the source dir.
- if self.source =~ /^#{self.dest}/
- raise FatalException.new "Destination directory cannot be or contain the Source directory."
- end
+ ensure_not_in_dest
# If safe mode is off, load in any Ruby files under the plugins
# directory.
@@ -83,6 +79,17 @@ module Jekyll
self.generators = instantiate_subclasses(Jekyll::Generator)
end
+ # Check that the destination dir isn't the source dir or a directory
+ # parent to the source dir.
+ def ensure_not_in_dest
+ dest = Pathname.new(self.dest)
+ Pathname.new(self.source).ascend do |path|
+ if path == dest
+ raise FatalException.new "Destination directory cannot be or contain the Source directory."
+ end
+ end
+ end
+
# Internal: Setup the plugin search path
#
# Returns an Array of plugin search paths
From 0f4d646510cc4f8d323a8724eccf1ba85fb93c77 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Mon, 16 Sep 2013 15:19:29 +0200
Subject: [PATCH 042/146] extend feature tests and use scenario outline
---
features/site_configuration.feature | 35 +++++++++++------------
features/step_definitions/jekyll_steps.rb | 14 +++++----
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/features/site_configuration.feature b/features/site_configuration.feature
index 80a4b50b1..89324cb1e 100644
--- a/features/site_configuration.feature
+++ b/features/site_configuration.feature
@@ -18,27 +18,26 @@ Feature: Site configuration
Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html"
- Scenario: Similarly named source and destination
- Given I have a blank site in "mysite_source"
- And I have an "mysite_source/index.html" file that contains "html"
+ Scenario Outline: Similarly named source and destination
+ Given I have a blank site in ""
+ And I have an "/index.md" page that contains "markdown"
And I have a configuration file with:
- | key | value |
- | source | mysite_source |
- | destination | mysite |
+ | key | value |
+ | source | |
+ | destination | |
When I run jekyll
- Then the mysite directory should exist
- And I should see "html" in "mysite/index.html"
+ Then the directory should exist
+ And the "/index.html" file should exist
+ And I should see "markdown" in "/index.md"
- Scenario: Similarly named source and destination 2
- Given I have a blank site in "mysite"
- And I have an "mysite/index.html" file that contains "html"
- And I have a configuration file with:
- | key | value |
- | source | mysite |
- | destination | mysite_dest |
- When I run jekyll
- Then the mysite_dest directory should exist
- And I should see "html" in "mysite_dest/index.html"
+ Examples:
+ | source | dest | file_exist |
+ | mysite_source | mysite | |
+ | mysite | mysite_dest | |
+ | mysite/ | mysite | not |
+ | mysite | ./mysite | not |
+ | mysite/source | mysite | not |
+ | mysite | mysite/dest | |
Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded"
diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb
index a1a1b797f..56da1d115 100644
--- a/features/step_definitions/jekyll_steps.rb
+++ b/features/step_definitions/jekyll_steps.rb
@@ -7,7 +7,7 @@ end
World(Test::Unit::Assertions)
Given /^I have a blank site in "(.*)"$/ do |path|
- FileUtils.mkdir(path)
+ FileUtils.mkdir_p(path)
end
Given /^I do not have a "(.*)" directory$/ do |path|
@@ -137,10 +137,14 @@ When /^I delete the file "(.*)"$/ do |file|
File.delete(file)
end
-Then /^the (.*) directory should exist$/ do |dir|
+Then /^the (.*) directory should +exist$/ do |dir|
assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
end
+Then /^the (.*) directory should not exist$/ do |dir|
+ assert !File.directory?(dir), "The directory \"#{dir}\" exists"
+end
+
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(text).match(File.open(file).readlines.join)
end
@@ -157,12 +161,12 @@ Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
end
-Then /^the "(.*)" file should exist$/ do |file|
- assert File.file?(file)
+Then /^the "(.*)" file should +exist$/ do |file|
+ assert File.file?(file), "The file \"#{file}\" does not exist"
end
Then /^the "(.*)" file should not exist$/ do |file|
- assert !File.exists?(file)
+ assert !File.exists?(file), "The file \"#{file}\" exists"
end
Then /^I should see today's time in "(.*)"$/ do |file|
From 3dadc94ce45ef5ef8bc492b1475cb4a460e39cd6 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Mon, 16 Sep 2013 23:16:41 +0200
Subject: [PATCH 043/146] =?UTF-8?q?Don=E2=80=99t=20repeat=20yourself?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/jekyll/tags/include.rb | 59 +++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 20 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 4bae7db14..c0d3be064 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -4,6 +4,8 @@ module Jekyll
MATCHER = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
+ VALID_SYNTAX = "{% include file.ext param='value' param2='value' %}"
+
INCLUDES_DIR = '_includes'
def initialize(tag_name, markup, tokens)
@@ -35,6 +37,26 @@ module Jekyll
# ensure the entire markup string from start to end is valid syntax, and params are separated by spaces
def validate_syntax
+ validate_file_name
+ validate_params
+ end
+
+ def validate_file_name
+ if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
+ raise SyntaxError.new <<-eos
+Invalid syntax for include tag. File contains invalid characters or sequences:
+
+ #{@file}
+
+Valid syntax:
+
+ #{VALID_SYNTAX}
+
+eos
+ end
+ end
+
+ def validate_params
full_matcher = Regexp.compile('\A\s*(?:' + MATCHER.to_s + '(?=\s|\z)\s*)*\z')
unless @params =~ full_matcher
raise SyntaxError.new <<-eos
@@ -44,20 +66,24 @@ Invalid syntax for include tag:
Valid syntax:
- {% include file.ext param='value' param2="value" %}
+ #{VALID_SYNTAX}
eos
end
end
def render(context)
- dir = includes_dir(context)
-
- if error = validate_file(dir)
+ dir = File.join(context.registers[:site].source, INCLUDES_DIR)
+ if error = validate_dir(dir, context.registers[:site].safe)
return error
end
- partial = Liquid::Template.parse(source(dir))
+ file = File.join(dir, @file)
+ if error = validate_file(dir, context.registers[:site].safe)
+ return error
+ end
+
+ partial = Liquid::Template.parse(source(file))
context.stack do
context['include'] = parse_params(context) if @params
@@ -65,19 +91,16 @@ eos
end
end
- def validate_file(dir)
- if File.symlink?(dir) && context.registers[:site].safe?
+ def validate_dir(dir, safe)
+ if File.symlink?(dir) && safe?
return "Includes directory '#{dir}' cannot be a symlink"
end
+ end
- if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
- return "Include file '#{@file}' contains invalid characters or sequences"
- end
-
- file = File.join(dir, @file)
+ def validate_file(file, safe)
if !File.exists?(file)
- return "Included file #{@file} not found in #{INCLUDES_DIR} directory"
- elsif File.symlink?(file) && context.registers[:site].safe?
+ return "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
+ elsif File.symlink?(file) && safe?
return "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
@@ -88,12 +111,8 @@ eos
# This method allows to modify the file content by inheriting from the class.
# Don’t refactor it.
- def source(dir)
- File.read(File.join(dir, @file))
- end
-
- def includes_dir(context)
- File.join(context.registers[:site].source, INCLUDES_DIR)
+ def source(file)
+ File.read(file)
end
end
end
From c376f345faf80920ab67779312368df6e4ba40ea Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 16 Sep 2013 20:29:17 -0500
Subject: [PATCH 044/146] Update history to reflect merge of #1539
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 95ca169e2..c405e1d32 100644
--- a/History.markdown
+++ b/History.markdown
@@ -7,6 +7,7 @@
### Bug Fixes
### Development Fixes
+ * Add coverage reporting with Coveralls (#1539)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
From 454e038fad4f434ae0b9cc340f2a4a490d87ced2 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 16 Sep 2013 20:29:57 -0500
Subject: [PATCH 045/146] Require 'pathname'
---
lib/jekyll.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/jekyll.rb b/lib/jekyll.rb
index 7eb2dda96..1ad928bf7 100644
--- a/lib/jekyll.rb
+++ b/lib/jekyll.rb
@@ -20,6 +20,7 @@ require 'fileutils'
require 'time'
require 'safe_yaml'
require 'English'
+require 'pathname'
# 3rd party
require 'liquid'
From bff0f9e53752c83f45eb9d0244042101ac9a87fe Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 16 Sep 2013 20:35:13 -0500
Subject: [PATCH 046/146] Update history to reflect merge of #1556
---
History.markdown | 2 ++
1 file changed, 2 insertions(+)
diff --git a/History.markdown b/History.markdown
index c405e1d32..4948e05ba 100644
--- a/History.markdown
+++ b/History.markdown
@@ -5,6 +5,8 @@
### Minor Enhancements
### Bug Fixes
+ * Fix up matching against source and destination when the two
+ locations are similar (#1556)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
From 045464c8d40f7fe37a88c01c495afd23a72a9b31 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 16 Sep 2013 20:38:45 -0500
Subject: [PATCH 047/146] Update history to reflect merge of #1553
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 4948e05ba..8e3971943 100644
--- a/History.markdown
+++ b/History.markdown
@@ -14,6 +14,7 @@
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
* Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
+ * Link to Liquid's docs for tags and filters (#1553)
## 1.2.1 / 2013-09-14
From f7beb6bff018f949a8fefc3adb69a326b8184e0c Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 16 Sep 2013 21:38:31 -0500
Subject: [PATCH 048/146] Update history to reflect merge of #1255
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 8e3971943..54b6cd9f8 100644
--- a/History.markdown
+++ b/History.markdown
@@ -7,6 +7,7 @@
### Bug Fixes
* Fix up matching against source and destination when the two
locations are similar (#1556)
+ * Fix the missing `pathname` require in certain cases (#1255)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
From a42e57f274696e7c76addefab7fbd96704cd7084 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:14:41 +0200
Subject: [PATCH 049/146] Rename constants
---
lib/jekyll/tags/include.rb | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index c0d3be064..89aad0ea9 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -2,9 +2,9 @@ module Jekyll
module Tags
class IncludeTag < Liquid::Tag
- MATCHER = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
+ VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
- VALID_SYNTAX = "{% include file.ext param='value' param2='value' %}"
+ SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
INCLUDES_DIR = '_includes'
@@ -19,7 +19,7 @@ module Jekyll
params = {}
markup = @params
- while match = MATCHER.match(markup) do
+ while match = VALID_SYNTAX.match(markup) do
markup = markup[match.end(0)..-1]
value = if match[2]
@@ -50,15 +50,15 @@ Invalid syntax for include tag. File contains invalid characters or sequences:
Valid syntax:
- #{VALID_SYNTAX}
+ #{SYNTAX_EXAMPLE}
eos
end
end
def validate_params
- full_matcher = Regexp.compile('\A\s*(?:' + MATCHER.to_s + '(?=\s|\z)\s*)*\z')
- unless @params =~ full_matcher
+ full_VALID_SYNTAX = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
+ unless @params =~ full_VALID_SYNTAX
raise SyntaxError.new <<-eos
Invalid syntax for include tag:
@@ -66,7 +66,7 @@ Invalid syntax for include tag:
Valid syntax:
- #{VALID_SYNTAX}
+ #{SYNTAX_EXAMPLE}
eos
end
From 3e2ab58d56463fb0b93b996a1d5dc67c5f255199 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:34:04 +0200
Subject: [PATCH 050/146] Fix unruby paradigm
---
lib/jekyll/tags/include.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 89aad0ea9..636b24367 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -92,7 +92,7 @@ eos
end
def validate_dir(dir, safe)
- if File.symlink?(dir) && safe?
+ if File.symlink?(dir) && safe
return "Includes directory '#{dir}' cannot be a symlink"
end
end
@@ -100,7 +100,7 @@ eos
def validate_file(file, safe)
if !File.exists?(file)
return "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
- elsif File.symlink?(file) && safe?
+ elsif File.symlink?(file) && safe
return "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
From e5f99e2798f1e2a3f18e867e8ccf911e6a91eef0 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:35:18 +0200
Subject: [PATCH 051/146] Remove return
---
lib/jekyll/tags/include.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 636b24367..8347aa2d2 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -93,15 +93,15 @@ eos
def validate_dir(dir, safe)
if File.symlink?(dir) && safe
- return "Includes directory '#{dir}' cannot be a symlink"
+ "Includes directory '#{dir}' cannot be a symlink"
end
end
def validate_file(file, safe)
if !File.exists?(file)
- return "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
+ "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
elsif File.symlink?(file) && safe
- return "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
+ "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
From 7f62e698376da64c91719317891edaa6d7e3b55d Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:36:33 +0200
Subject: [PATCH 052/146] Remove obvious comment
---
lib/jekyll/tags/include.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 8347aa2d2..c062f0e2f 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -110,7 +110,6 @@ eos
end
# This method allows to modify the file content by inheriting from the class.
- # Don’t refactor it.
def source(file)
File.read(file)
end
From 8017548bd0b3c33d555f667c94a6832ca6c82b8f Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:46:01 +0200
Subject: [PATCH 053/146] Rename variable
---
lib/jekyll/tags/include.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index c062f0e2f..143555c88 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -57,8 +57,8 @@ eos
end
def validate_params
- full_VALID_SYNTAX = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
- unless @params =~ full_VALID_SYNTAX
+ full_valid_syntax = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
+ unless @params =~ full_valid_syntax
raise SyntaxError.new <<-eos
Invalid syntax for include tag:
From 25519b38f69b0baae0cf7e0cca31a60c3b792b18 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 20:57:01 +0200
Subject: [PATCH 054/146] Validate file name as soon as possible
---
lib/jekyll/tags/include.rb | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 143555c88..c4dea1497 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -11,10 +11,11 @@ module Jekyll
def initialize(tag_name, markup, tokens)
super
@file, @params = markup.strip.split(' ', 2);
+ validate_file_name
end
def parse_params(context)
- validate_syntax
+ validate_params
params = {}
markup = @params
@@ -35,12 +36,6 @@ module Jekyll
params
end
- # ensure the entire markup string from start to end is valid syntax, and params are separated by spaces
- def validate_syntax
- validate_file_name
- validate_params
- end
-
def validate_file_name
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
raise SyntaxError.new <<-eos
From 7cec996f90cd31ca2572e444717bfcc4ddee52fc Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 21:41:11 +0200
Subject: [PATCH 055/146] Validate the entire markup as soon as possible
---
lib/jekyll/tags/include.rb | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index c4dea1497..f02f63102 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -2,21 +2,24 @@ module Jekyll
module Tags
class IncludeTag < Liquid::Tag
- VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
-
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
+ VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
+
INCLUDES_DIR = '_includes'
def initialize(tag_name, markup, tokens)
super
@file, @params = markup.strip.split(' ', 2);
+ validate_syntax
+ end
+
+ def validate_syntax
validate_file_name
+ validate_params if @params
end
def parse_params(context)
- validate_params
-
params = {}
markup = @params
From ec85c49de38641df094ddbef1e7a4749e63864a6 Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 22:11:56 +0200
Subject: [PATCH 056/146] Change exception type
---
lib/jekyll/tags/include.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index f02f63102..2b0d82b4a 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -41,7 +41,7 @@ module Jekyll
def validate_file_name
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
- raise SyntaxError.new <<-eos
+ raise ArgumentError.new <<-eos
Invalid syntax for include tag. File contains invalid characters or sequences:
#{@file}
@@ -57,7 +57,7 @@ eos
def validate_params
full_valid_syntax = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
unless @params =~ full_valid_syntax
- raise SyntaxError.new <<-eos
+ raise ArgumentError.new <<-eos
Invalid syntax for include tag:
#{@params}
From f97eed544ca64255999859e97c1dbe7d5c70192f Mon Sep 17 00:00:00 2001
From: Anatol Broder
Date: Tue, 17 Sep 2013 22:20:41 +0200
Subject: [PATCH 057/146] Change exception type in tests
---
test/test_tags.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/test_tags.rb b/test/test_tags.rb
index 5e25c1db2..c58c9c7ef 100644
--- a/test/test_tags.rb
+++ b/test/test_tags.rb
@@ -373,7 +373,7 @@ CONTENT
end
context "with invalid parameter syntax" do
- should "throw a SyntaxError" do
+ should "throw a ArgumentError" do
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
@@ -392,7 +392,7 @@ title: Invalid parameter syntax
{% include params.html params="value %}
CONTENT
- assert_raise SyntaxError, 'Did not raise exception on invalid "include" syntax' do
+ assert_raise ArgumentError, 'Did not raise exception on invalid "include" syntax' do
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
end
From 5f6af4c215735508b38dc934f3c62a460c10cc1b Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Wed, 18 Sep 2013 13:51:56 -0400
Subject: [PATCH 058/146] Add note about installing Xcode on the Mac in the
Installation docs.
Xcode command-line tools (clang and ruby headers) are required for installing some of Jekyll's dependencies which create native extensions.
Closes #1561.
---
site/docs/installation.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/site/docs/installation.md b/site/docs/installation.md
index af3b5e6bc..861044375 100644
--- a/site/docs/installation.md
+++ b/site/docs/installation.md
@@ -46,6 +46,16 @@ installing Jekyll, check out the [troubleshooting](../troubleshooting/) page or
[report an issue]({{ site.repository }}/issues/new) so the Jekyll
community can improve the experience for everyone.
+
+
Installing Xcode Command-Line Tools
+
+ If you run into issues installing Jekyll's dependencies which make use of
+ native extensions and are using Mac OS X, you will need to install Xcode
+ and the Command-Line Tools it ships with. Download in
+ Preferences → Downloads → Components.
+
+
+
## Optional Extras
There are a number of (optional) extra features that Jekyll supports that you
From bbd275840b67daeaf6bae0f3e2bcb7e8109d2c1d Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Wed, 18 Sep 2013 13:52:25 -0400
Subject: [PATCH 059/146] Update history to reflect fixing of #1561
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 54b6cd9f8..5e2ae75bd 100644
--- a/History.markdown
+++ b/History.markdown
@@ -16,6 +16,7 @@
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
* Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
* Link to Liquid's docs for tags and filters (#1553)
+ * Add note about installing Xcode on the Mac in the Installation docs (#1561)
## 1.2.1 / 2013-09-14
From 7ccb62e5243b660d975f0214a2cc004748629df0 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Wed, 18 Sep 2013 21:36:25 -0500
Subject: [PATCH 060/146] Update history to reflect merge of #1490
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 5e2ae75bd..53f411c59 100644
--- a/History.markdown
+++ b/History.markdown
@@ -11,6 +11,7 @@
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
+ * Refactor the Liquid `include` tag (#1490)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
From 8a28d806909b4ac15491faf81f29de4b05dfef52 Mon Sep 17 00:00:00 2001
From: MURAOKA Taro
Date: Tue, 30 Jul 2013 22:21:09 +0900
Subject: [PATCH 061/146] add encoding for configuration
---
lib/jekyll/configuration.rb | 1 +
lib/jekyll/convertible.rb | 2 +-
lib/jekyll/site.rb | 7 ++++++-
lib/jekyll/tags/include.rb | 2 +-
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb
index 05a097c7f..75230bb81 100644
--- a/lib/jekyll/configuration.rb
+++ b/lib/jekyll/configuration.rb
@@ -11,6 +11,7 @@ module Jekyll
'plugins' => '_plugins',
'layouts' => '_layouts',
'keep_files' => ['.git','.svn'],
+ 'encoding' => nil,
'timezone' => nil, # use the local timezone
diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb
index 5f4938002..74125e7bd 100644
--- a/lib/jekyll/convertible.rb
+++ b/lib/jekyll/convertible.rb
@@ -28,7 +28,7 @@ module Jekyll
# Returns nothing.
def read_yaml(base, name)
begin
- self.content = File.read(File.join(base, name))
+ self.content = File.read(File.join(base, name), self.site.file_read_opts)
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index ef7be1fca..6aec1c198 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -3,7 +3,7 @@ module Jekyll
attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
- :show_drafts, :keep_files, :baseurl
+ :show_drafts, :keep_files, :baseurl, :file_read_opts
attr_accessor :converters, :generators
@@ -22,6 +22,11 @@ module Jekyll
self.plugins = plugins_path
self.permalink_style = config['permalink'].to_sym
+ self.file_read_opts = {}
+ if encoding = config['encoding']
+ self.file_read_opts[:encoding] = Encoding.find(encoding)
+ end
+
self.reset
self.setup
end
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 2b0d82b4a..b8b54353b 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -109,7 +109,7 @@ eos
# This method allows to modify the file content by inheriting from the class.
def source(file)
- File.read(file)
+ File.read(file, context.registers[:site].file_read_opts)
end
end
end
From f4c2383d3c266314b5a8481eb3b03b38e21be7b2 Mon Sep 17 00:00:00 2001
From: MURAOKA Taro
Date: Tue, 30 Jul 2013 22:28:30 +0900
Subject: [PATCH 062/146] write document for config.encoding
---
lib/jekyll/configuration.rb | 3 ++-
site/docs/configuration.md | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb
index 75230bb81..43244b478 100644
--- a/lib/jekyll/configuration.rb
+++ b/lib/jekyll/configuration.rb
@@ -11,10 +11,11 @@ module Jekyll
'plugins' => '_plugins',
'layouts' => '_layouts',
'keep_files' => ['.git','.svn'],
- 'encoding' => nil,
'timezone' => nil, # use the local timezone
+ 'encoding' => nil, # use the system encoding
+
'safe' => false,
'detach' => false, # default to not detaching the server
'show_drafts' => nil,
diff --git a/site/docs/configuration.md b/site/docs/configuration.md
index fa92c6d1a..79d4a3cfd 100644
--- a/site/docs/configuration.md
+++ b/site/docs/configuration.md
@@ -99,6 +99,18 @@ class="flag">flags (specified on the command-line) that control them.
timezone: TIMEZONE
+
+
+
Encoding
+
+ Set the encoding of files. The default is the system encoding,
+ which determined by LANG environment variable.
+
+
+
+
encoding: ENCODING
+
+
@@ -266,6 +278,7 @@ include: ['.htaccess']
exclude: []
keep_files: ['.git','.svn']
timezone: nil
+encoding: nil
future: true
show_drafts: nil
From 4cb24f4b877e1e0d1ead5f2def09f18fc9eb9408 Mon Sep 17 00:00:00 2001
From: MURAOKA Taro
Date: Tue, 30 Jul 2013 23:19:26 +0900
Subject: [PATCH 063/146] consider a case of "site" is unavailable in
Convertible
---
lib/jekyll/convertible.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb
index 74125e7bd..da8858ee6 100644
--- a/lib/jekyll/convertible.rb
+++ b/lib/jekyll/convertible.rb
@@ -28,7 +28,8 @@ module Jekyll
# Returns nothing.
def read_yaml(base, name)
begin
- self.content = File.read(File.join(base, name), self.site.file_read_opts)
+ opts = self.site ? self.site.file_read_opts : {}
+ self.content = File.read(File.join(base, name), opts)
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
From 8b892ed735bfcaaeecfcf8d97db763561ee466a9 Mon Sep 17 00:00:00 2001
From: Shigeya Suzuki
Date: Sun, 18 Aug 2013 10:43:02 +0900
Subject: [PATCH 064/146] read_yaml to accept optional parameter to override
defaults
---
lib/jekyll/convertible.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb
index da8858ee6..21f950d09 100644
--- a/lib/jekyll/convertible.rb
+++ b/lib/jekyll/convertible.rb
@@ -24,11 +24,13 @@ module Jekyll
#
# base - The String path to the dir containing the file.
# name - The String filename of the file.
+ # opts - optional parameter to File.read, default at site configs
#
# Returns nothing.
- def read_yaml(base, name)
+ def read_yaml(base, name, opts = {})
begin
- opts = self.site ? self.site.file_read_opts : {}
+ opts = (self.site ? self.site.file_read_opts : {}).merge(opts)
+
self.content = File.read(File.join(base, name), opts)
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
From fbea3471ddb458838fe352cd3b6f30459dcdec90 Mon Sep 17 00:00:00 2001
From: Shigeya Suzuki
Date: Sun, 18 Aug 2013 10:43:25 +0900
Subject: [PATCH 065/146] Make TestConvertible to pass with utf-8 encoding
---
test/test_convertible.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_convertible.rb b/test/test_convertible.rb
index ee7fc8e35..694c152c9 100644
--- a/test/test_convertible.rb
+++ b/test/test_convertible.rb
@@ -40,7 +40,7 @@ class TestConvertible < Test::Unit::TestCase
should "not parse if there is encoding error in file" do
name = 'broken_front_matter3.erb'
out = capture_stdout do
- ret = @convertible.read_yaml(@base, name)
+ ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8')
assert_equal({}, ret)
end
assert_match(/invalid byte sequence in UTF-8/, out)
From 97e052df639df2091502b65a7dfa64db323584cc Mon Sep 17 00:00:00 2001
From: Shigeya Suzuki
Date: Tue, 20 Aug 2013 09:23:21 +0900
Subject: [PATCH 066/146] Pass encoding parameter as string, not an object
---
lib/jekyll/site.rb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index 6aec1c198..6084631a0 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -23,9 +23,7 @@ module Jekyll
self.permalink_style = config['permalink'].to_sym
self.file_read_opts = {}
- if encoding = config['encoding']
- self.file_read_opts[:encoding] = Encoding.find(encoding)
- end
+ self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
self.reset
self.setup
From c625ddf6cd9481965b3339f119f8b2011520cce4 Mon Sep 17 00:00:00 2001
From: Shigeya Suzuki
Date: Sat, 24 Aug 2013 14:40:55 +0900
Subject: [PATCH 067/146] Invoke File.read with or without options depends on
Ruby version
- Extract option fetch method as a separate method
- Added File.read_with_options method to use
- With performance fix
---
lib/jekyll/convertible.rb | 12 ++++++++----
lib/jekyll/core_ext.rb | 15 +++++++++++++++
lib/jekyll/tags/include.rb | 11 ++++++++---
3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb
index 21f950d09..44bd8b9a1 100644
--- a/lib/jekyll/convertible.rb
+++ b/lib/jekyll/convertible.rb
@@ -20,6 +20,12 @@ module Jekyll
self.content || ''
end
+ # Returns merged optin hash for File.read of self.site (if exists)
+ # and a given param
+ def merged_file_read_opts(opts)
+ (self.site ? self.site.file_read_opts : {}).merge(opts)
+ end
+
# Read the YAML frontmatter.
#
# base - The String path to the dir containing the file.
@@ -29,10 +35,8 @@ module Jekyll
# Returns nothing.
def read_yaml(base, name, opts = {})
begin
- opts = (self.site ? self.site.file_read_opts : {}).merge(opts)
-
- self.content = File.read(File.join(base, name), opts)
-
+ self.content = File.read_with_options(File.join(base, name),
+ merged_file_read_opts(opts))
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
self.data = YAML.safe_load($1)
diff --git a/lib/jekyll/core_ext.rb b/lib/jekyll/core_ext.rb
index 1a7b18166..54f7c9d55 100644
--- a/lib/jekyll/core_ext.rb
+++ b/lib/jekyll/core_ext.rb
@@ -69,3 +69,18 @@ module Enumerable
any? { |exp| File.fnmatch?(exp, e) }
end
end
+
+# Ruby 1.8's File.read don't support option.
+# read_with_options ignore optional parameter for 1.8,
+# and act as alias for 1.9 or later.
+class File
+ if RUBY_VERSION < '1.9'
+ def self.read_with_options(path, opts = {})
+ self.read(path)
+ end
+ else
+ def self.read_with_options(path, opts = {})
+ self.read(path, opts)
+ end
+ end
+end
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index b8b54353b..57095ce72 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -70,6 +70,11 @@ eos
end
end
+ # Grab file read opts in the context
+ def file_read_opts(context)
+ context.registers[:site].file_read_opts
+ end
+
def render(context)
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
if error = validate_dir(dir, context.registers[:site].safe)
@@ -81,7 +86,7 @@ eos
return error
end
- partial = Liquid::Template.parse(source(file))
+ partial = Liquid::Template.parse(source(file, context))
context.stack do
context['include'] = parse_params(context) if @params
@@ -108,8 +113,8 @@ eos
end
# This method allows to modify the file content by inheriting from the class.
- def source(file)
- File.read(file, context.registers[:site].file_read_opts)
+ def source(file, context)
+ File.read_with_options(file, file_read_opts(context))
end
end
end
From a93b1a26eb20cb29eaac48aa42c3c464a950ea3c Mon Sep 17 00:00:00 2001
From: Shigeya Suzuki
Date: Thu, 29 Aug 2013 07:38:53 +0900
Subject: [PATCH 068/146] Documentation update for the encoding configuration
---
site/docs/configuration.md | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/site/docs/configuration.md b/site/docs/configuration.md
index 79d4a3cfd..31bf7048f 100644
--- a/site/docs/configuration.md
+++ b/site/docs/configuration.md
@@ -103,8 +103,12 @@ class="flag">flags (specified on the command-line) that control them.
Encoding
- Set the encoding of files. The default is the system encoding,
- which determined by LANG environment variable.
+ Set the encoding of files by name. Only available for Ruby
+ 1.9 or later).
+ The default value is nil, which use Ruby default,
+ ASCII-8BIT.
+ Available encoding for the ruby in use, can be shown by
+ command ruby -e 'puts Encoding::list.join("\n")'
From 06fb31544f2ba67369191565e1373b1df2b2781b Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Sat, 7 Sep 2013 20:15:34 +0200
Subject: [PATCH 069/146] Change error handling for gist tag: raise exception
---
lib/jekyll/tags/gist.rb | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb
index d69499afb..145a41b4b 100644
--- a/lib/jekyll/tags/gist.rb
+++ b/lib/jekyll/tags/gist.rb
@@ -12,7 +12,15 @@ module Jekyll
gist_id, filename = tag_contents[0], tag_contents[1]
gist_script_tag(gist_id, filename)
else
- "Error parsing gist id"
+ raise SyntaxError.new <<-eos
+Syntax error in tag 'gist' while parsing the following markup:
+
+ #{@markup}
+
+Valid syntax:
+ for public gists: {% gist 1234567 %}
+ for private gists: {% gist user/1234567 %}
+eos
end
end
From 39c0d125bbb34d42f01b8fbd5ce50d91a6693360 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Tue, 10 Sep 2013 19:25:16 +0200
Subject: [PATCH 070/146] fix tests for new behaviour
---
test/test_tags.rb | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/test/test_tags.rb b/test/test_tags.rb
index c58c9c7ef..6179077ec 100644
--- a/test/test_tags.rb
+++ b/test/test_tags.rb
@@ -273,22 +273,19 @@ CONTENT
end
end
- context "when invalid" do
- setup do
- @gist = "mattr-24081a1d93d2898ecf0f"
- @filename = "myfile.ext"
- content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
- end
- should "write script tag with specific file in gist" do
- assert_match "Error parsing gist id", @result
+ assert_raise SyntaxError do
+ create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
end
end
@@ -313,7 +310,7 @@ CONTENT
end
context "with blank gist id" do
- setup do
+ should "raise SyntaxError" do
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
- end
- should "output error message" do
- assert_match "Error parsing gist id", @result
+ assert_raise SyntaxError do
+ create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
+ end
end
end
context "with invalid gist id" do
- setup do
+ should "raise SyntaxError" do
invalid_gist = 'invalid'
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
- end
- should "output error message" do
- assert_match "Error parsing gist id", @result
+ assert_raise SyntaxError do
+ create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
+ end
end
end
end
From 72c3bba56a345ecb0c30580b227396599bfeef15 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Sat, 7 Sep 2013 20:11:00 +0200
Subject: [PATCH 071/146] Change error handling in 'post_url' tag: raise
exception
---
lib/jekyll/tags/post_url.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb
index 51b3b6057..063e22a47 100644
--- a/lib/jekyll/tags/post_url.rb
+++ b/lib/jekyll/tags/post_url.rb
@@ -50,9 +50,11 @@ module Jekyll
end
end
- puts "ERROR: post_url: \"#{@orig_post}\" could not be found"
+ raise ArgumentError.new <<-eos
+Could not find post "#{@orig_post}" in tag 'post_url'.
- return "#"
+Make sure the post exists and the name is correct.
+eos
end
end
end
From 9409a3d0348a126bd654d98eb7c0246f1e0f6921 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 19 Sep 2013 14:32:15 +0200
Subject: [PATCH 072/146] raise exceptions in include tag
---
lib/jekyll/tags/include.rb | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb
index 2b0d82b4a..4d8839226 100644
--- a/lib/jekyll/tags/include.rb
+++ b/lib/jekyll/tags/include.rb
@@ -72,14 +72,10 @@ eos
def render(context)
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
- if error = validate_dir(dir, context.registers[:site].safe)
- return error
- end
+ validate_dir(dir, context.registers[:site].safe)
file = File.join(dir, @file)
- if error = validate_file(dir, context.registers[:site].safe)
- return error
- end
+ validate_file(file, context.registers[:site].safe)
partial = Liquid::Template.parse(source(file))
@@ -91,15 +87,15 @@ eos
def validate_dir(dir, safe)
if File.symlink?(dir) && safe
- "Includes directory '#{dir}' cannot be a symlink"
+ raise IOError.new "Includes directory '#{dir}' cannot be a symlink"
end
end
def validate_file(file, safe)
if !File.exists?(file)
- "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
+ raise IOError.new "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
elsif File.symlink?(file) && safe
- "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
+ raise IOError.new "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
end
end
From 1829c2734a43db457d8f243dcb10a441ff6973e8 Mon Sep 17 00:00:00 2001
From: "maul.esel"
Date: Thu, 19 Sep 2013 23:23:04 +0200
Subject: [PATCH 073/146] 'gist' tag: switch to ArgumentError exception class
SyntaxError is reserved for Ruby's internal use.
Adjust the tests, including the call to liquid to
make it rethrow ArgumentErrors.
---
lib/jekyll/tags/gist.rb | 2 +-
test/test_tags.rb | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb
index 145a41b4b..f4f32880a 100644
--- a/lib/jekyll/tags/gist.rb
+++ b/lib/jekyll/tags/gist.rb
@@ -12,7 +12,7 @@ module Jekyll
gist_id, filename = tag_contents[0], tag_contents[1]
gist_script_tag(gist_id, filename)
else
- raise SyntaxError.new <<-eos
+ raise ArgumentError.new <<-eos
Syntax error in tag 'gist' while parsing the following markup:
#{@markup}
diff --git a/test/test_tags.rb b/test/test_tags.rb
index 6179077ec..fe16faa52 100644
--- a/test/test_tags.rb
+++ b/test/test_tags.rb
@@ -19,7 +19,7 @@ class TestTags < Test::Unit::TestCase
payload = { "pygments_prefix" => @converter.pygments_prefix,
"pygments_suffix" => @converter.pygments_suffix }
- @result = Liquid::Template.parse(content).render(payload, info)
+ @result = Liquid::Template.parse(content).render!(payload, info)
@result = @converter.convert(@result)
end
@@ -273,7 +273,7 @@ CONTENT
end
end
- should "raise SyntaxError when invalid" do
+ should "raise ArgumentError when invalid" do
@gist = "mattr-24081a1d93d2898ecf0f"
@filename = "myfile.ext"
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
end
@@ -310,7 +310,7 @@ CONTENT
end
context "with blank gist id" do
- should "raise SyntaxError" do
+ should "raise ArgumentError" do
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
end
end
context "with invalid gist id" do
- should "raise SyntaxError" do
+ should "raise ArgumentError" do
invalid_gist = 'invalid'
content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
end
From 1bfc10dd32e1ab78b599b4745bbfce316b337d75 Mon Sep 17 00:00:00 2001
From: Tom Preston-Werner
Date: Fri, 20 Sep 2013 19:59:03 -0700
Subject: [PATCH 074/146] =?UTF-8?q?+=20=E2=80=98.sparkleshare=E2=80=99=20+?=
=?UTF-8?q?=20=E2=80=98SparkleShare.txt=E2=80=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.sparkleshare | 1 +
SparkleShare.txt | 9 +++++++++
2 files changed, 10 insertions(+)
create mode 100644 .sparkleshare
create mode 100644 SparkleShare.txt
diff --git a/.sparkleshare b/.sparkleshare
new file mode 100644
index 000000000..73e2fe37f
--- /dev/null
+++ b/.sparkleshare
@@ -0,0 +1 @@
+0b8eacc0d6e17d054fdee9496bf8b1f10c4e080c
\ No newline at end of file
diff --git a/SparkleShare.txt b/SparkleShare.txt
new file mode 100644
index 000000000..3744aa893
--- /dev/null
+++ b/SparkleShare.txt
@@ -0,0 +1,9 @@
+Congratulations, you've successfully created a SparkleShare repository!
+
+Any files you add or change in this folder will be automatically synced to
+ssh://git@github.com/mojombo/jekyll and everyone connected to it.
+
+SparkleShare is an Open Source software program that helps people collaborate and
+share files. If you like what we do, consider buying us a beer: http://www.sparkleshare.org/
+
+Have fun! :)
From b0694e96d12ba7d976a955f167bb34bd6badcbe6 Mon Sep 17 00:00:00 2001
From: Tom Preston-Werner
Date: Fri, 20 Sep 2013 20:02:40 -0700
Subject: [PATCH 075/146] Removing Sparkleshare files. Thanks Sparkleshare, for
that.
---
.sparkleshare | 1 -
SparkleShare.txt | 9 ---------
2 files changed, 10 deletions(-)
delete mode 100644 .sparkleshare
delete mode 100644 SparkleShare.txt
diff --git a/.sparkleshare b/.sparkleshare
deleted file mode 100644
index 73e2fe37f..000000000
--- a/.sparkleshare
+++ /dev/null
@@ -1 +0,0 @@
-0b8eacc0d6e17d054fdee9496bf8b1f10c4e080c
\ No newline at end of file
diff --git a/SparkleShare.txt b/SparkleShare.txt
deleted file mode 100644
index 3744aa893..000000000
--- a/SparkleShare.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Congratulations, you've successfully created a SparkleShare repository!
-
-Any files you add or change in this folder will be automatically synced to
-ssh://git@github.com/mojombo/jekyll and everyone connected to it.
-
-SparkleShare is an Open Source software program that helps people collaborate and
-share files. If you like what we do, consider buying us a beer: http://www.sparkleshare.org/
-
-Have fun! :)
From a88a63da2ddaa814a4d735e78fdcbaa12a084d95 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sun, 22 Sep 2013 18:26:34 -0400
Subject: [PATCH 076/146] Don't use destructive Array#concat for Liquid
Attribute arrays
---
lib/jekyll/post.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb
index 291921fff..da64af931 100644
--- a/lib/jekyll/post.rb
+++ b/lib/jekyll/post.rb
@@ -19,10 +19,10 @@ module Jekyll
]
# Attributes for Liquid templates
- ATTRIBUTES_FOR_LIQUID = EXCERPT_ATTRIBUTES_FOR_LIQUID.concat(%w[
+ ATTRIBUTES_FOR_LIQUID = EXCERPT_ATTRIBUTES_FOR_LIQUID + %w[
content
excerpt
- ])
+ ]
# Post name validator. Post filenames must be like:
# 2008-11-05-my-awesome-post.textile
From 943acc43953fc041b479d01f0edc81cd60535588 Mon Sep 17 00:00:00 2001
From: Edward Ball
Date: Mon, 23 Sep 2013 13:23:54 +0100
Subject: [PATCH 077/146] Remove overly specific css from site template
---
lib/site_template/css/main.css | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/site_template/css/main.css b/lib/site_template/css/main.css
index 50a818048..1a2c013f5 100755
--- a/lib/site_template/css/main.css
+++ b/lib/site_template/css/main.css
@@ -34,16 +34,16 @@ a:visited { color: #a0a; }
/* Home
/*
/*****************************************************************************/
-ul.posts {
+.posts {
list-style-type: none;
margin-bottom: 2em;
}
-ul.posts li {
+.posts li {
line-height: 1.75em;
}
-ul.posts span {
+.posts span {
color: #aaa;
font-family: Monaco, "Courier New", monospace;
font-size: 80%;
@@ -63,38 +63,38 @@ ul.posts span {
line-height: 1.5em;
}
-.site .header a {
+.header a {
font-weight: bold;
text-decoration: none;
}
-.site .header h1.title {
+.title {
display: inline-block;
margin-bottom: 2em;
}
-.site .header h1.title a {
+.title a {
color: #a00;
}
-.site .header h1.title a:hover {
+.title a:hover {
color: #000;
}
-.site .header a.extra {
+.header a.extra {
color: #aaa;
margin-left: 1em;
}
-.site .header a.extra:hover {
+.header a.extra:hover {
color: #000;
}
-.site .meta {
+.meta {
color: #aaa;
}
-.site .footer {
+.footer {
font-size: 80%;
color: #666;
border-top: 4px solid #eee;
@@ -102,22 +102,22 @@ ul.posts span {
overflow: hidden;
}
-.site .footer .contact {
+.footer .contact {
float: left;
margin-right: 3em;
}
-.site .footer .contact a {
+.footer .contact a {
color: #8085C1;
}
-.site .footer .rss {
+.footer .rss {
margin-top: 1.1em;
margin-right: -.2em;
float: right;
}
-.site .footer .rss img {
+.footer .rss img {
border: 0;
}
From 93b5004c486fc516371f4999970bbf5804b24b45 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 23 Sep 2013 09:12:44 -0500
Subject: [PATCH 078/146] Update history to reflect merge of #1574
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 53f411c59..e0db33ae5 100644
--- a/History.markdown
+++ b/History.markdown
@@ -3,6 +3,7 @@
### Major Enhancements
### Minor Enhancements
+ * Decrease the specificity in the site template CSS (#1574)
### Bug Fixes
* Fix up matching against source and destination when the two
From 903be7b75059887f5c60b5fca9e54378ce736d96 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Mon, 23 Sep 2013 10:17:43 -0400
Subject: [PATCH 079/146] Update history to reflect merge of #1571
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index e0db33ae5..a7a74cac0 100644
--- a/History.markdown
+++ b/History.markdown
@@ -9,6 +9,7 @@
* Fix up matching against source and destination when the two
locations are similar (#1556)
* Fix the missing `pathname` require in certain cases (#1255)
+ * Use `+` instead of `Array#concat` when building `Post` attribute list (#1571)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
From 5badf7d53b7d416e24f97c834f3ebe1418937677 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Mon, 23 Sep 2013 22:31:38 -0400
Subject: [PATCH 080/146] Update history to reflect merge of #1449
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index a7a74cac0..5aacabf40 100644
--- a/History.markdown
+++ b/History.markdown
@@ -4,6 +4,7 @@
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
+ * Add `encoding` configuration option (#1449)
### Bug Fixes
* Fix up matching against source and destination when the two
From dd6d0b42fee22b4fd6cb0e1a9c45119a6107d34d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=90=9B=E5=90=9B?=
Date: Thu, 26 Sep 2013 00:11:06 +0800
Subject: [PATCH 081/146] Update pagination example
---
site/docs/pagination.md | 54 +++++++++++++----------------------------
1 file changed, 17 insertions(+), 37 deletions(-)
diff --git a/site/docs/pagination.md b/site/docs/pagination.md
index 1b3e9486e..81bb228c1 100644
--- a/site/docs/pagination.md
+++ b/site/docs/pagination.md
@@ -182,51 +182,31 @@ page with links to all but the current page.
{% highlight html %}
{% raw %}
-
+{% endif %}
{% endraw %}
{% endhighlight %}
From 26803c28db23dbd0b6aa7b7c565bd9e1f432eb8b Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Fri, 27 Sep 2013 15:11:59 -0400
Subject: [PATCH 082/146] Remove gist URL in pagination docs.
---
site/docs/pagination.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/site/docs/pagination.md b/site/docs/pagination.md
index 81bb228c1..ccd8ba745 100644
--- a/site/docs/pagination.md
+++ b/site/docs/pagination.md
@@ -183,7 +183,6 @@ page with links to all but the current page.
{% highlight html %}
{% raw %}
{% if paginator.total_pages > 1 %}
-
{% if paginator.previous_page %}
« Prev
From 35336bfff4335055d3c26ddfd9f0592b00dbf481 Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Fri, 27 Sep 2013 15:12:50 -0400
Subject: [PATCH 083/146] Update history to reflect the merge of #1577.
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 5aacabf40..b7f092028 100644
--- a/History.markdown
+++ b/History.markdown
@@ -21,6 +21,7 @@
* Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
* Link to Liquid's docs for tags and filters (#1553)
* Add note about installing Xcode on the Mac in the Installation docs (#1561)
+ * Simplify/generalize pagination docs (#1577)
## 1.2.1 / 2013-09-14
From 924285695ceadce50e748a16b427858329377d8f Mon Sep 17 00:00:00 2001
From: Parker Moore
Date: Sat, 28 Sep 2013 19:18:36 -0400
Subject: [PATCH 084/146] Print server address when launching a server.
Related to: https://github.com/mojombo/jekyll/issues/1583
---
lib/jekyll/commands/serve.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb
index 92a6aa480..8e8d00bbb 100644
--- a/lib/jekyll/commands/serve.rb
+++ b/lib/jekyll/commands/serve.rb
@@ -18,6 +18,8 @@ module Jekyll
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option)
+ Jekyll.logger.info "Server address:", "http://#{s.config[:BindAddress]}:#{s.config[:Port]}"
+
if options['detach'] # detach the server
pid = Process.fork { s.start }
Process.detach(pid)
From f074bb6ae62909a0f1b4134bf3efc2439b2fe16a Mon Sep 17 00:00:00 2001
From: Xavier Noria
Date: Mon, 30 Sep 2013 23:04:29 +0200
Subject: [PATCH 085/146] adds more information to the documentation of
generators
---
site/docs/plugins.md | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/site/docs/plugins.md b/site/docs/plugins.md
index e8e2161fb..2a068ca11 100644
--- a/site/docs/plugins.md
+++ b/site/docs/plugins.md
@@ -38,7 +38,42 @@ In general, plugins you make will fall into one of three categories:
## Generators
You can create a generator when you need Jekyll to create additional content
-based on your own rules. For example, a generator might look like this:
+based on your own rules.
+
+A generator is a subclass of `Jekyll::Generator` that defines a `generate`
+method, which receives an instance of
+[`Jekyll::Site`](https://github.com/fxn/jekyll/blob/master/lib/jekyll/site.rb).
+Generation is triggered for its side-effects, the return value of `generate` is
+ignored. Jekyll does not assume any particular side-effect to happen, it just
+runs the method.
+
+Generators run after Jekyll has made an inventory of the existing pages, and
+before the site is generated. Pages with YAML headers are stored as instances of
+[`Jekyll::Page`](https://github.com/fxn/jekyll/blob/master/lib/jekyll/page.rb)
+and are available via `site.pages`. Static files become instances of
+[`Jekyll::StaticFile`](https://github.com/fxn/jekyll/blob/master/lib/jekyll/static_file.rb)
+and are available via `site.static_files`.
+
+For example, if an existing Liquid template has data that needs to be computed
+at build time, a generator can search for it and inject it. In the following
+example the template called "reading.html" has two variables "ongoing" and
+"done" that we fill in the generator.
+
+{% highlight ruby %}
+module Reading
+ class Generator < Jekyll::Generator
+ def generate(site)
+ ongoing, done = Book.all.partition(&:ongoing?)
+
+ reading = site.pages.detect {|page| page.name == 'reading.html'}
+ reading.data['ongoing'] = ongoing
+ reading.data['done'] = done
+ end
+ end
+end
+{% endhighlight %}
+
+This is a more complex generator that generates new pages:
{% highlight ruby %}
module Jekyll
@@ -95,7 +130,7 @@ Generators are only required to implement one method:
generate
-
String output of the content being generated.
+
Generates content as a side-effect.
From 92907c9545a7925cfc8ebfcb529144daae5d2169 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 30 Sep 2013 16:41:10 -0500
Subject: [PATCH 086/146] Update history to reflect merge of #1590
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index b7f092028..09ffe4580 100644
--- a/History.markdown
+++ b/History.markdown
@@ -15,6 +15,7 @@
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
* Refactor the Liquid `include` tag (#1490)
+ * Update the documentation for generators (#1590)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
From 760cbc7f91ecd3dada0d6ce8c214bbc102bebfd9 Mon Sep 17 00:00:00 2001
From: liufengyun
Date: Tue, 1 Oct 2013 11:18:31 +0800
Subject: [PATCH 087/146] Autoload yaml files under _data directory
The jekyll engine will autoload all yaml files(ends with .yml or .yaml)
under _data. If there's a file members.yml under the directory, then user
can access contents of the file through site.members.
---
features/data.feature | 65 +++++++++++++++++++++++
features/step_definitions/jekyll_steps.rb | 6 +++
jekyll.gemspec | 2 +
lib/jekyll/configuration.rb | 1 +
lib/jekyll/site.rb | 40 +++++++++++++-
site/docs/structure.md | 17 ++++++
test/source/_data/languages.yml | 2 +
test/source/_data/members.yaml | 7 +++
test/source/_data/products.yml | 1 +
test/source/products.yml | 4 ++
test/source/symlink-test/_data | 1 +
test/test_site.rb | 57 ++++++++++++++++++++
12 files changed, 201 insertions(+), 2 deletions(-)
create mode 100644 features/data.feature
create mode 100644 test/source/_data/languages.yml
create mode 100644 test/source/_data/members.yaml
create mode 120000 test/source/_data/products.yml
create mode 100644 test/source/products.yml
create mode 120000 test/source/symlink-test/_data
diff --git a/features/data.feature b/features/data.feature
new file mode 100644
index 000000000..33adfaad5
--- /dev/null
+++ b/features/data.feature
@@ -0,0 +1,65 @@
+Feature: Data
+ In order to use well-formatted data in my blog
+ As a blog's user
+ I want to use _data directory in my site
+
+ Scenario: autoload *.yaml files in _data directory
+ Given I have a _data directory
+ And I have a "_data/products.yaml" file with content:
+ """
+ - name: sugar
+ price: 5.3
+ - name: salt
+ price: 2.5
+ """
+ And I have an "index.html" page that contains "{% for product in site.data.products %}{{product.name}}{% endfor %}"
+ When I run jekyll
+ Then the "_site/index.html" file should exist
+ And I should see "sugar" in "_site/index.html"
+ And I should see "salt" in "_site/index.html"
+
+ Scenario: autoload *.yml files in _data directory
+ Given I have a _data directory
+ And I have a "_data/members.yml" file with content:
+ """
+ - name: Jack
+ age: 28
+ - name: Leon
+ age: 34
+ """
+ And I have an "index.html" page that contains "{% for member in site.data.members %}{{member.name}}{% endfor %}"
+ When I run jekyll
+ Then the "_site/index.html" file should exist
+ And I should see "Jack" in "_site/index.html"
+ And I should see "Leon" in "_site/index.html"
+
+ Scenario: autoload *.yml files in _data directory with space in file name
+ Given I have a _data directory
+ And I have a "_data/team members.yml" file with content:
+ """
+ - name: Jack
+ age: 28
+ - name: Leon
+ age: 34
+ """
+ And I have an "index.html" page that contains "{% for member in site.data.team_members %}{{member.name}}{% endfor %}"
+ When I run jekyll
+ Then the "_site/index.html" file should exist
+ And I should see "Jack" in "_site/index.html"
+ And I should see "Leon" in "_site/index.html"
+
+ Scenario: should be backward compatible with site.data in _config.yml
+ Given I have a "_config.yml" file with content:
+ """
+ data:
+ - name: Jack
+ age: 28
+ - name: Leon
+ age: 34
+ """
+ And I have an "index.html" page that contains "{% for member in site.data %}{{member.name}}{% endfor %}"
+ When I run jekyll
+ Then the "_site/index.html" file should exist
+ And I should see "Jack" in "_site/index.html"
+ And I should see "Leon" in "_site/index.html"
+
diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb
index 56da1d115..3604f5230 100644
--- a/features/step_definitions/jekyll_steps.rb
+++ b/features/step_definitions/jekyll_steps.rb
@@ -43,6 +43,12 @@ Given /^I have an? (.*) (layout|theme) that contains "(.*)"$/ do |name, type, te
end
end
+Given /^I have an? "(.*)" file with content:$/ do |file, text|
+ File.open(file, 'w') do |f|
+ f.write(text)
+ end
+end
+
Given /^I have an? (.*) directory$/ do |dir|
FileUtils.mkdir_p(dir)
end
diff --git a/jekyll.gemspec b/jekyll.gemspec
index f726d4d1c..a9ddd3383 100644
--- a/jekyll.gemspec
+++ b/jekyll.gemspec
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
bin/jekyll
cucumber.yml
features/create_sites.feature
+ features/data.feature
features/drafts.feature
features/embed_filters.feature
features/include_tag.feature
@@ -203,6 +204,7 @@ Gem::Specification.new do |s|
test/helper.rb
test/source/+/foo.md
test/source/.htaccess
+ test/source/_data/members.yaml
test/source/_includes/params.html
test/source/_includes/sig.markdown
test/source/_layouts/default.html
diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb
index 43244b478..de903a966 100644
--- a/lib/jekyll/configuration.rb
+++ b/lib/jekyll/configuration.rb
@@ -10,6 +10,7 @@ module Jekyll
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => '_plugins',
'layouts' => '_layouts',
+ 'data_source' => '_data',
'keep_files' => ['.git','.svn'],
'timezone' => nil, # use the local timezone
diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb
index 6084631a0..5cad11c87 100644
--- a/lib/jekyll/site.rb
+++ b/lib/jekyll/site.rb
@@ -3,7 +3,7 @@ module Jekyll
attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
- :show_drafts, :keep_files, :baseurl, :file_read_opts
+ :show_drafts, :keep_files, :baseurl, :data, :file_read_opts
attr_accessor :converters, :generators
@@ -56,6 +56,7 @@ module Jekyll
self.static_files = []
self.categories = Hash.new { |hash, key| hash[key] = [] }
self.tags = Hash.new { |hash, key| hash[key] = [] }
+ self.data = {}
if self.limit_posts < 0
raise ArgumentError, "limit_posts must be a non-negative number"
@@ -110,6 +111,7 @@ module Jekyll
def read
self.read_layouts
self.read_directories
+ self.read_data(config['data_source'])
end
# Read all the files in / and create a new Layout object
@@ -197,6 +199,25 @@ module Jekyll
end
end
+ # Read and parse all yaml files under /
+ #
+ # Returns nothing
+ def read_data(dir)
+ base = File.join(self.source, dir)
+ return unless File.directory?(base) && (!self.safe || !File.symlink?(base))
+
+ entries = Dir.chdir(base) { Dir['*.{yaml,yml}'] }
+ entries.delete_if { |e| File.directory?(File.join(base, e)) }
+
+ entries.each do |entry|
+ path = File.join(self.source, dir, entry)
+ next if File.symlink?(path) && self.safe
+
+ key = sanitize_filename(File.basename(entry, '.*'))
+ self.data[key] = YAML.safe_load_file(path)
+ end
+ end
+
# Run each of the Generators.
#
# Returns nothing.
@@ -262,6 +283,14 @@ module Jekyll
hash
end
+ # Prepare site data for site payload. The method maintains backward compatibility
+ # if the key 'data' is already used in _config.yml.
+ #
+ # Returns the Hash to be hooked to site.data.
+ def site_data
+ self.config['data'] || self.data
+ end
+
# The Hash payload containing site-wide data.
#
# Returns the Hash: { "site" => data } where data is a Hash with keys:
@@ -283,7 +312,8 @@ module Jekyll
"pages" => self.pages,
"html_pages" => self.pages.reject { |page| !page.html? },
"categories" => post_attr_hash('categories'),
- "tags" => post_attr_hash('tags')})}
+ "tags" => post_attr_hash('tags'),
+ "data" => site_data})}
end
# Filter out any files/directories that are hidden or backup files (start
@@ -393,5 +423,11 @@ module Jekyll
def site_cleaner
@site_cleaner ||= Cleaner.new(self)
end
+
+ def sanitize_filename(name)
+ name = name.gsub(/[^\w\s_-]+/, '')
+ name = name.gsub(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
+ name = name.gsub(/\s+/, '_')
+ end
end
end
diff --git a/site/docs/structure.md b/site/docs/structure.md
index 02b33daf8..d03baee06 100644
--- a/site/docs/structure.md
+++ b/site/docs/structure.md
@@ -31,6 +31,8 @@ A basic Jekyll site usually looks something like this:
├── _posts
| ├── 2007-10-29-why-every-programmer-should-play-nethack.textile
| └── 2009-04-26-barcamp-boston-4-roundup.textile
+├── _data
+| └── members.yml
├── _site
└── index.html
{% endhighlight %}
@@ -121,6 +123,21 @@ An overview of what each of these does:
+
+
+
_data
+
+
+
+
+ Well-formatted site data should be placed here. The jekyll engine will
+ autoload all yaml files (ends with .yml or .yaml)
+ in this directory. If there's a file members.yml under the directory,
+ then you can access contents of the file through site.data.members.
+
+
+
+
_site
diff --git a/test/source/_data/languages.yml b/test/source/_data/languages.yml
new file mode 100644
index 000000000..6b0a250c0
--- /dev/null
+++ b/test/source/_data/languages.yml
@@ -0,0 +1,2 @@
+- java
+- ruby
diff --git a/test/source/_data/members.yaml b/test/source/_data/members.yaml
new file mode 100644
index 000000000..22e29a9f3
--- /dev/null
+++ b/test/source/_data/members.yaml
@@ -0,0 +1,7 @@
+- name: Jack
+ age: 27
+ blog: http://example.com/jack
+
+- name: John
+ age: 32
+ blog: http://example.com/john
diff --git a/test/source/_data/products.yml b/test/source/_data/products.yml
new file mode 120000
index 000000000..bc0c6852c
--- /dev/null
+++ b/test/source/_data/products.yml
@@ -0,0 +1 @@
+../products.yml
\ No newline at end of file
diff --git a/test/source/products.yml b/test/source/products.yml
new file mode 100644
index 000000000..21828a09d
--- /dev/null
+++ b/test/source/products.yml
@@ -0,0 +1,4 @@
+- name: sugar
+ price: 5.3
+- name: salt
+ price: 2.5
diff --git a/test/source/symlink-test/_data b/test/source/symlink-test/_data
new file mode 120000
index 000000000..37fb8ffe0
--- /dev/null
+++ b/test/source/symlink-test/_data
@@ -0,0 +1 @@
+../_data
\ No newline at end of file
diff --git a/test/test_site.rb b/test/test_site.rb
index b4d062399..0ff9185f6 100644
--- a/test/test_site.rb
+++ b/test/test_site.rb
@@ -335,5 +335,62 @@ class TestSite < Test::Unit::TestCase
end
end
+ context 'data directory' do
+ should 'auto load yaml files' do
+ site = Site.new(Jekyll.configuration)
+ site.process
+
+ file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'members.yaml'))
+
+ assert_equal site.data['members'], file_content
+ assert_equal site.site_payload['site']['data']['members'], file_content
+ end
+
+ should 'auto load yml files' do
+ site = Site.new(Jekyll.configuration)
+ site.process
+
+ file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'languages.yml'))
+
+ assert_equal site.data['languages'], file_content
+ assert_equal site.site_payload['site']['data']['languages'], file_content
+ end
+
+ should "load symlink files in unsafe mode" do
+ site = Site.new(Jekyll.configuration.merge({'safe' => false}))
+ site.process
+
+ file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'products.yml'))
+
+ assert_equal site.data['products'], file_content
+ assert_equal site.site_payload['site']['data']['products'], file_content
+ end
+
+ should "not load symlink files in safe mode" do
+ site = Site.new(Jekyll.configuration.merge({'safe' => true}))
+ site.process
+
+ assert_nil site.data['products']
+ assert_nil site.site_payload['site']['data']['products']
+ end
+
+ should "load symlink directory in unsafe mode" do
+ site = Site.new(Jekyll.configuration.merge({'safe' => false, 'data_source' => File.join('symlink-test', '_data')}))
+ site.process
+
+ assert_not_nil site.data['products']
+ assert_not_nil site.data['languages']
+ assert_not_nil site.data['members']
+ end
+
+ should "not load symlink directory in safe mode" do
+ site = Site.new(Jekyll.configuration.merge({'safe' => true, 'data_source' => File.join('symlink-test', '_data')}))
+ site.process
+
+ assert_nil site.data['products']
+ assert_nil site.data['languages']
+ assert_nil site.data['members']
+ end
+ end
end
end
From e8cab9da26c9cc89dcee2d3bebfb1ac70de6a420 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 30 Sep 2013 22:47:18 -0500
Subject: [PATCH 088/146] Update history to reflect merge of #1586
---
History.markdown | 1 +
1 file changed, 1 insertion(+)
diff --git a/History.markdown b/History.markdown
index 09ffe4580..e354b2e3e 100644
--- a/History.markdown
+++ b/History.markdown
@@ -11,6 +11,7 @@
locations are similar (#1556)
* Fix the missing `pathname` require in certain cases (#1255)
* Use `+` instead of `Array#concat` when building `Post` attribute list (#1571)
+ * Print server address when launching a server (#1586)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
From 246825ac12ae1d3e7af00a19a5983d12bdb8c31f Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 30 Sep 2013 22:50:21 -0500
Subject: [PATCH 089/146] Update history to reflect merge of #1003
---
History.markdown | 2 ++
1 file changed, 2 insertions(+)
diff --git a/History.markdown b/History.markdown
index e354b2e3e..dbfa2287f 100644
--- a/History.markdown
+++ b/History.markdown
@@ -1,6 +1,8 @@
## HEAD
### Major Enhancements
+ * Add support for adding data as YAML files under a site's `_data`
+ directory (#1003)
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
From cb8572fedbea1876c8baec8bb096938b8ed31305 Mon Sep 17 00:00:00 2001
From: Matt Rogers
Date: Mon, 30 Sep 2013 22:55:25 -0500
Subject: [PATCH 090/146] Update history to reflect merge of #1514
---
History.markdown | 2 ++
1 file changed, 2 insertions(+)
diff --git a/History.markdown b/History.markdown
index dbfa2287f..98c2f3293 100644
--- a/History.markdown
+++ b/History.markdown
@@ -7,6 +7,8 @@
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
* Add `encoding` configuration option (#1449)
+ * Provide better error handling for Jekyll's custom Liquid tags
+ (#1514)
### Bug Fixes
* Fix up matching against source and destination when the two
From f864b690190bb1af93598a399022acf7d2cae364 Mon Sep 17 00:00:00 2001
From: Matt Swanson
Date: Wed, 4 Sep 2013 15:58:50 -0400
Subject: [PATCH 091/146] Add docs for new Data Files feature
---
site/_includes/docs_contents.html | 2 +-
site/_includes/docs_contents_mobile.html | 2 +-
site/docs/data.md | 61 ++++++++++++++++++++++++
site/docs/variables.md | 2 +-
4 files changed, 64 insertions(+), 3 deletions(-)
create mode 100644 site/docs/data.md
diff --git a/site/_includes/docs_contents.html b/site/_includes/docs_contents.html
index 0df6c0a47..523b5227a 100644
--- a/site/_includes/docs_contents.html
+++ b/site/_includes/docs_contents.html
@@ -3,7 +3,7 @@
Getting Started
{% include docs_ul.html items='home quickstart installation usage structure configuration' %}