Compare commits

...

24 Commits

Author SHA1 Message Date
Parker Moore
d0e00ca12d Release 💎 3.0.3 2016-02-08 11:01:54 -08:00
Parker Moore
fe17a79e03 Merge pull request #4498 from jekyll/3.0.3-release
Release v3.0.3
2016-02-08 11:00:56 -08:00
Parker Moore
fdae8ce148 By me! 2016-02-08 11:00:30 -08:00
Parker Moore
53b781bbd1 Release v3.0.3 2016-02-08 10:47:22 -08:00
Parker Moore
c87a060ae8 Merge pull request #4493 from jekyll/fix-extension-weirdness
Fix extension weirdness with folders
2016-02-08 10:36:13 -08:00
Parker Moore
3f0e34b398 update pre-existing tests to align with changes 2016-02-08 10:00:13 -08:00
Parker Moore
7211ca9270 Add tests for non-html inputs being output as html 2016-02-08 09:36:46 -08:00
Parker Moore
9f8a4bc486 Fix extension weirdness with folders 2016-02-07 18:03:45 -08:00
Parker Moore
c2a75dee36 Merge pull request #4468 from jekyll/escape-the-tildes
Jekyll.sanitized_path: escape tildes before sanitizing a questionable path
2016-02-07 17:25:43 -08:00
Parker Moore
1f8e8f6b34 Merge pull request #4479 from jekyll/only-exclude-on-excluded
EntryFilter: only include 'excluded' log on excluded files
2016-02-05 15:02:19 -08:00
Parker Moore
888eb90f6f EntryFilter: only include 'excluded' log on excluded files 2016-02-05 13:28:27 -08:00
Parker Moore
4508e91a02 only prefix the path if it starts with a tilde 2016-02-03 15:22:11 -08:00
Parker Moore
1363492425 Jekyll.sanitized_path: escape tildes before sanitizing a questionable path 2016-02-03 13:25:31 -08:00
Parker Moore
599ad5b754 Merge pull request #4453 from jekyll/set-linenumbers-3.0
LiquidRenderer#parse: parse with line numbers.
2016-02-02 17:01:23 -08:00
Parker Moore
cdf169df94 Merge pull request #4446 from jekyll/fix-cmp
Document#<=>: protect against nil comparison in dates.
2016-02-02 17:01:10 -08:00
Parker Moore
d91a4eb266 LiquidRenderer#parse: parse with line numbers. 2016-02-02 14:45:03 -08:00
Parker Moore
a8afa8a65d Document#<=>: protect against nil comparison in dates. 2016-02-02 10:48:24 -08:00
Parker Moore
c538d80c54 Also release docs. 2016-01-20 14:15:47 -08:00
Parker Moore
d842f02b20 Release 💎 3.0.2 2016-01-20 14:14:22 -08:00
Parker Moore
3dfc0f26e1 We can release from 3.0-stable 2016-01-20 14:14:15 -08:00
Parker Moore
8e27409029 Merge branch '3.0-stable' of github.com:jekyll/jekyll into 3.0-stable
* '3.0-stable' of github.com:jekyll/jekyll:
  Document: throw a useful error when an invalid date is given
2016-01-20 14:10:57 -08:00
Parker Moore
766149cd83 Release 💎 v3.0.2 2016-01-20 14:10:47 -08:00
Parker Moore
f4523cb897 Merge pull request #4378 from jekyll/invalid-date-error
Document: throw a useful error when an invalid date is given
2016-01-20 14:07:22 -08:00
Parker Moore
805b117238 Document: throw a useful error when an invalid date is given 2016-01-20 12:23:48 -08:00
23 changed files with 200 additions and 28 deletions

View File

@@ -1,4 +1,18 @@
## HEAD
## 3.0.3 / 2016-02-08
### Bug Fixes
* Fix extension weirdness with folders (#4493)
* EntryFilter: only include 'excluded' log on excluded files (#4479)
* `Jekyll.sanitized_path`: escape tildes before sanitizing a questionable path (#4468)
* `LiquidRenderer#parse`: parse with line numbers (#4453)
* `Document#<=>`: protect against nil comparison in dates. (#4446)
## 3.0.2 / 2016-01-20
### Bug Fixes
* Document: throw a useful error when an invalid date is given (#4378)
### Development Fixes

View File

@@ -288,13 +288,13 @@ end
desc "Release #{name} v#{version}"
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
unless `git branch` =~ /^\* 3\.0-stable$/
puts "You must be on the 3.0-stable branch to release!"
exit!
end
sh "git commit --allow-empty -m 'Release :gem: #{version}'"
sh "git tag v#{version}"
sh "git push origin master"
sh "git push origin 3.0-stable"
sh "git push origin v#{version}"
sh "gem push pkg/#{name}-#{version}.gem"
end
@@ -315,8 +315,8 @@ end
namespace :docs do
desc "Release #{docs_name} v#{version}"
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
unless `git branch` =~ /^\* 3\.0-stable$/
puts "You must be on the 3.0-stable branch to release!"
exit!
end
sh "gem push pkg/#{docs_name}-#{version}.gem"

View File

@@ -36,6 +36,20 @@ Feature: Post data
Then the _site directory should exist
And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.date variable with invalid
Given I have a _posts directory
And I have a "_posts/2016-01-01-test.md" page with date "tuesday" that contains "I have a bad date."
When I run jekyll build
Then the _site directory should not exist
And I should see "Document '_posts/2016-01-01-test.md' does not have a valid date in the YAML front matter." in the build output
Scenario: Invalid date in filename
Given I have a _posts directory
And I have a "_posts/2016-22-01-test.md" page that contains "I have a bad date."
When I run jekyll build
Then the _site directory should not exist
And I should see "Document '_posts/2016-22-01-test.md' does not have a valid date in the filename." in the build output
Scenario: Use post.id variable
Given I have a _posts directory
And I have a _layouts directory

View File

@@ -153,8 +153,9 @@ module Jekyll
def sanitized_path(base_directory, questionable_path)
return base_directory if base_directory.eql?(questionable_path)
questionable_path.insert(0, '/') if questionable_path.start_with?('~')
clean_path = File.expand_path(questionable_path, "/")
clean_path = clean_path.sub(/\A\w\:\//, '/')
clean_path.sub!(/\A\w\:\//, '/')
unless clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
File.join(base_directory, clean_path)

View File

@@ -58,7 +58,7 @@ module Jekyll
# Merge some data in with this document's data.
#
# Returns the merged data.
def merge_data!(other)
def merge_data!(other, source: "YAML front matter")
if other.key?('categories') && !other['categories'].nil?
if other['categories'].is_a?(String)
other['categories'] = other['categories'].split(" ").map(&:strip)
@@ -67,7 +67,7 @@ module Jekyll
end
Utils.deep_merge_hashes!(data, other)
if data.key?('date') && !data['date'].is_a?(Time)
data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the YAML front matter.")
data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the #{source}.")
end
data
end
@@ -235,8 +235,11 @@ module Jekyll
def destination(base_directory)
dest = site.in_dest_dir(base_directory)
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index.html") if url.end_with?("/")
path << output_ext unless path.end_with?(output_ext)
if url.end_with? "/"
path = File.join(path, "index.html")
else
path << output_ext unless path.end_with?(output_ext)
end
path
end
@@ -287,20 +290,23 @@ module Jekyll
else
begin
defaults = @site.frontmatter_defaults.all(url, collection.label.to_sym)
merge_data!(defaults) unless defaults.empty?
merge_data!(defaults, source: "front matter defaults") unless defaults.empty?
self.content = File.read(path, merged_file_read_opts(opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load($1)
merge_data!(data_file) if data_file
merge_data!(data_file, source: "YAML front matter") if data_file
end
post_read
rescue SyntaxError => e
puts "YAML Exception reading #{path}: #{e.message}"
Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
rescue Exception => e
puts "Error reading file #{path}: #{e.message}"
if e.is_a? Jekyll::Errors::FatalException
raise e
end
Jekyll.logger.error "Error:", "could not read file #{path}: #{e.message}"
end
end
end
@@ -311,8 +317,10 @@ module Jekyll
merge_data!({
"slug" => slug,
"ext" => ext
})
merge_data!({"date" => date}) if data['date'].nil? || data['date'].to_i == site.time.to_i
}, source: "filename")
if data['date'].nil? || data['date'].to_i == site.time.to_i
merge_data!({"date" => date}, source: "filename")
end
data['title'] ||= slug.split('-').select {|w| w.capitalize! || w }.join(' ')
end
populate_categories
@@ -332,7 +340,7 @@ module Jekyll
superdirs = relative_path.sub(/#{special_dir}(.*)/, '').split(File::SEPARATOR).reject do |c|
c.empty? || c.eql?(special_dir) || c.eql?(basename)
end
merge_data!({ 'categories' => superdirs })
merge_data!({ 'categories' => superdirs }, source: "file path")
end
def populate_categories
@@ -393,7 +401,7 @@ module Jekyll
def <=>(other)
return nil if !other.respond_to?(:data)
cmp = data['date'] <=> other.data['date']
cmp = path <=> other.path if cmp == 0
cmp = path <=> other.path if cmp.nil? || cmp == 0
cmp
end

View File

@@ -47,7 +47,7 @@ module Jekyll
def excluded?(entry)
excluded = glob_include?(site.exclude, relative_to_source(entry))
Jekyll.logger.debug "EntryFilter:", "excluded?(#{relative_to_source(entry)}) ==> #{excluded}"
Jekyll.logger.debug "EntryFilter:", "excluded #{relative_to_source(entry)}" if excluded
excluded
end

View File

@@ -8,7 +8,7 @@ module Jekyll
def parse(content)
measure_time do
@template = Liquid::Template.parse(content)
@template = Liquid::Template.parse(content, line_numbers: true)
end
self

View File

@@ -135,8 +135,11 @@ module Jekyll
# Returns the destination file path String.
def destination(dest)
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index.html") if url.end_with?("/")
path << output_ext unless path.end_with?(output_ext)
if url.end_with? "/"
path = File.join(path, "index.html")
else
path << output_ext unless path.end_with?(output_ext)
end
path
end

View File

@@ -224,7 +224,7 @@ module Jekyll
# Build a hash map based on the specified post attribute ( post attr =>
# array of posts ) then sort each array in reverse order.
hash = Hash.new { |h, key| h[key] = [] }
posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } }
posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr] }
hash.values.each { |posts| posts.sort!.reverse! }
hash
end

View File

@@ -1,3 +1,3 @@
module Jekyll
VERSION = '3.0.1'
VERSION = '3.0.3'
end

View File

@@ -4,6 +4,33 @@ title: History
permalink: "/docs/history/"
---
## 3.0.3 / 2016-02-08
{: #v3-0-3}
### Bug Fixes
{: #bug-fixes-v3-0-3}
* Fix extension weirdness with folders ([#4493]({{ site.repository }}/issues/4493))
* EntryFilter: only include 'excluded' log on excluded files ([#4479]({{ site.repository }}/issues/4479))
* `Jekyll.sanitized_path`: escape tildes before sanitizing a questionable path ([#4468]({{ site.repository }}/issues/4468))
* `LiquidRenderer#parse`: parse with line numbers ([#4453]({{ site.repository }}/issues/4453))
* `Document#<=>`: protect against nil comparison in dates. ([#4446]({{ site.repository }}/issues/4446))
## 3.0.2 / 2016-01-20
{: #v3-0-2}
### Bug Fixes
{: #bug-fixes-v3-0-2}
- Document: throw a useful error when an invalid date is given ([#4378]({{ site.repository }}/issues/4378))
### Development Fixes
{: #development-fixes-v3-0-2}
- `jekyll-docs` should be easily release-able ([#4152]({{ site.repository }}/issues/4152))
## 3.0.1 / 2015-11-17
{: #v3-0-1}

View File

@@ -0,0 +1,14 @@
---
layout: news_item
title: 'Jekyll 3.0.2 Released'
date: 2016-01-20 14:08:18 -0800
author: parkr
version: 3.0.2
categories: [release]
---
A crucial bug was found in v3.0.1 which caused invalid post dates to go
unnoticed in the build chain until the error that popped up was unhelpful.
v3.0.2 [throws errors as you'd expect](https://github.com/jekyll/jekyll/issues/4375)
when there is a post like `_posts/2016-22-01-future.md` or a post has an
invalid date like `date: "tuesday"` in their front matter.

View File

@@ -0,0 +1,31 @@
---
layout: news_item
title: 'Jekyll 3.0.3 Released'
date: 2016-02-08 10:39:08 -0800
author: parkr
version: 3.0.3
categories: [release]
---
[GitHub Pages upgraded to Jekyll 3.0.2][1] last week and there has been a
joyous reception so far! This release is to address some bugs that affected
some users during the cut-over. The fixes include:
* Fix problem where outputting to a folder would have two extensions
* Handle tildes (`~`) in filenames properly
* Fix issue when comparing documents without dates
* Include line numbers in liquid error output
Read more on the [changelog](/docs/history/#v3-0-3) with links to the
related patches.
Please keep [submitting bugs][2] as you find them! Please do take a look
[in our various help resources](/help/) before filing a bug and use [our
forum][3] for asking questions and getting help on a specific problem
you're having.
Happy Jekylling!
[1]: https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0
[2]: {{ site.repository }}/issues
[3]: https://talk.jekyllrb.com/

View File

@@ -1 +1 @@
3.0.1
3.0.2

View File

@@ -0,0 +1,4 @@
---
---
I should be output to `/with.dots/mit/index.html`.

View File

@@ -0,0 +1,5 @@
---
permalink: /contacts/humans/
---
I should be output to `/contacts/humans/index.html`.

0
test/source/~hi.txt Normal file
View File

View File

@@ -203,7 +203,7 @@ class TestCollections < JekyllUnitTest
end
should "contain one document" do
assert_equal 2, @collection.docs.size
assert_equal 3, @collection.docs.size
end
should "allow dots in the filename" do

View File

@@ -380,4 +380,33 @@ class TestDocument < JekyllUnitTest
end
context "a document in a collection with a non-HTML-able filename" do
setup do
@site = fixture_site({
"collections" => {
"with.dots" => {
"output" => true,
"permalink" => "/:collection/:path/"
}
},
})
@site.process
@document = @site.collections["with.dots"].docs.find { |doc| doc.relative_path == "_with.dots/mit.txt" }
@dest_file = dest_dir("with.dots", "mit", "index.html")
end
should "produce the right URL" do
assert_equal "/with.dots/mit/", @document.url
end
should "produce the right destination" do
assert_equal @dest_file, @document.destination(dest_dir)
end
should "be output in the correct place" do
assert_equal true, File.file?(@dest_file)
end
end
end

View File

@@ -257,7 +257,7 @@ class TestFilters < JekyllUnitTest
assert_equal 2, g["items"].size
when ""
assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
assert_equal 11, g["items"].size
assert_equal 12, g["items"].size
end
end
end

View File

@@ -310,6 +310,18 @@ class TestPage < JekyllUnitTest
assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'bar', 'index.html'))
end
should "write properly without html extension in source file" do
page = setup_page('/contacts', 'humans.txt')
page.site.permalink_style = "/:categories/:year/:month/:day/:title/"
do_render(page)
page.write(dest_dir)
dest = dest_dir('contacts', 'humans', 'index.html')
assert File.directory?(dest_dir)
assert_equal dest, page.destination(dest_dir)
assert File.exist?(dest), "contacts/humans/index.html should exist"
end
end
end

View File

@@ -15,4 +15,13 @@ class TestPathSanitization < JekyllUnitTest
assert_equal "/tmp/foobar/jail/..c:/..c:/..c:/etc/passwd", Jekyll.sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd")
end
end
should "escape tilde" do
assert_equal source_dir("~hi.txt"), Jekyll.sanitized_path(source_dir, "~hi.txt")
assert_equal source_dir("files", "~hi.txt"), Jekyll.sanitized_path(source_dir, "files/../files/~hi.txt")
end
should "remove path traversals" do
assert_equal source_dir("files", "hi.txt"), Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt")
end
end

View File

@@ -177,6 +177,7 @@ class TestSite < JekyllUnitTest
environment.html
exploit.md
foo.md
humans.txt
index.html
index.html
main.scss