Compare commits

...

8 Commits

Author SHA1 Message Date
Pat Hawks
0d555a7361 Release 💎 3.6.2 2017-10-21 14:21:14 -05:00
Pat Hawks
1cda1842d2 Update history to reflect merge of #6451 #6452 #6453 [ci skip] 2017-10-20 13:43:24 -05:00
Maximiliano Kotvinsky
5a0582aad6 Backport add-test-for-layout-as-string from #6445 to 3.6-stable 2017-10-20 13:41:08 -05:00
bellvat
035c6e0337 Backport patch-1 from #6442 to 3.6-stable 2017-10-20 13:40:38 -05:00
Pat Hawks
1377cf2f70 Backport utf8-bom from #6322 to 3.6-stable (#6451) 2017-10-20 13:39:57 -05:00
Pat Hawks
de4007c2cd Update history to reflect merge of #6450 [ci skip] 2017-10-20 13:37:36 -05:00
Pat Hawks
538976270b Backport pull/rubocop from #6444 to 3.6-stable (#6450) 2017-10-20 13:34:30 -05:00
Pat Hawks
d41f181625 Release 💎 3.6.1 2017-10-20 09:21:44 -05:00
20 changed files with 99 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
---
AllCops:
TargetRubyVersion: 2.0
TargetRubyVersion: 2.1
Include:
- lib/**/*.rb
Exclude:
@@ -117,8 +117,6 @@ Style/Documentation:
- !ruby/regexp /features\/.*.rb$/
Style/DoubleNegation:
Enabled: false
Style/Encoding:
EnforcedStyle: when_needed
Style/GuardClause:
Enabled: false
Style/HashSyntax:

View File

@@ -30,7 +30,7 @@ group :test do
gem "nokogiri", RUBY_VERSION >= "2.2" ? "~> 1.7" : "~> 1.7.0"
gem "rspec"
gem "rspec-mocks"
gem "rubocop", "~> 0.50.0"
gem "rubocop", "~> 0.51.0"
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)

View File

@@ -1,12 +1,24 @@
## HEAD
## 3.6.2 / 2017-10-21
### Development Fixes
* Update Rubocop to 0.51.0 (#6444)
* Add test for layout as string (#6445)
### Bug Fixes
* Problematic UTF+bom files (#6322)
* Always treat `data.layout` as a string (#6442)
## 3.6.1 / 2017-10-20
### Documentation
* Doc y_day in docs/permalinks (#6244)
* Update frontmatter.md (#6371)
* Elaborate on excluding items from processing (#6136)
* Docs: Style lists in tables (#6379)
* Docs: remove duplicate "available" (#6380)
* Style lists in tables (#6379)
* Remove duplicate "available" (#6380)
### Development Fixes

View File

@@ -1 +1 @@
3.6.0
3.6.2

View File

@@ -3,6 +3,26 @@ Feature: Layout data
I want to be able to embed data into my layouts
In order to make the layouts slightly dynamic
Scenario: Use custom layout data
Given I have a _layouts directory
And I have a "_layouts/999.html" file with content:
"""
---
---
{{ content }} layout content
"""
And I have an "index.html" page with layout "custom" that contains "page content"
And I have an "index.html" file with content:
"""
---
layout: 999
---
page content
"""
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "page content layout content" in "_site/index.html"
Scenario: Use custom layout data
Given I have a _layouts directory
And I have a "_layouts/custom.html" file with content:

View File

@@ -156,7 +156,7 @@ end
When(%r!^I run jekyll(.*)$!) do |args|
run_jekyll(args)
if args.include?("--verbose") || ENV["DEBUG"]
$stderr.puts "\n#{jekyll_run_output}\n"
warn "\n#{jekyll_run_output}\n"
end
end
@@ -165,7 +165,7 @@ end
When(%r!^I run bundle(.*)$!) do |args|
run_bundle(args)
if args.include?("--verbose") || ENV["DEBUG"]
$stderr.puts "\n#{jekyll_run_output}\n"
warn "\n#{jekyll_run_output}\n"
end
end
@@ -174,7 +174,7 @@ end
When(%r!^I run gem(.*)$!) do |args|
run_rubygem(args)
if args.include?("--verbose") || ENV["DEBUG"]
$stderr.puts "\n#{jekyll_run_output}\n"
warn "\n#{jekyll_run_output}\n"
end
end

View File

@@ -96,7 +96,7 @@ module Jekyll
)
end
end
end # end of class << self
end
end
end
end

View File

@@ -206,7 +206,7 @@ module Jekyll
rescue ArgumentError => err
Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
"Using defaults (and options)."
$stderr.puts err
warn err
end
configuration.fix_common_issues.backwards_compatibilize.add_default_collections

View File

@@ -47,7 +47,7 @@ class Jekyll::Converters::Markdown::RedcarpetParser
end
module WithRouge
def block_code(code, lang)
def block_code(_code, lang)
code = "<pre>#{super}</pre>"
"<div class=\"highlight\">#{add_code_tags(code, lang)}</div>"

View File

@@ -143,7 +143,7 @@ module Jekyll
# Returns String rendered content
def place_in_layouts(content, payload, info)
output = content.dup
layout = layouts[document.data["layout"]]
layout = layouts[document.data["layout"].to_s]
validate_layout(layout)
used = Set.new([layout])

View File

@@ -444,6 +444,7 @@ module Jekyll
def configure_file_read_opts
self.file_read_opts = {}
self.file_read_opts[:encoding] = config["encoding"] if config["encoding"]
self.file_read_opts = Jekyll::Utils.merged_file_read_opts(self, {})
end
private

View File

@@ -301,6 +301,9 @@ module Jekyll
# and a given param
def merged_file_read_opts(site, opts)
merged = (site ? site.file_read_opts : {}).merge(opts)
if merged[:encoding] && !merged[:encoding].start_with?("bom|")
merged[:encoding] = "bom|#{merged[:encoding]}"
end
if merged["encoding"] && !merged["encoding"].start_with?("bom|")
merged["encoding"] = "bom|#{merged["encoding"]}"
end

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Jekyll
VERSION = "3.6.0".freeze
VERSION = "3.6.2".freeze
end

View File

@@ -0,0 +1,11 @@
---
layout: post
title: "UTF8CRLFandBOM"
date: 2017-04-05 16:16:01 -0800
categories: bom
---
This file was created with CR/LFs, and encoded as UTF8 with a BOM
Youll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `bundle exec jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

Binary file not shown.

View File

@@ -7,6 +7,15 @@ class TestDocument < JekyllUnitTest
assert_equal(one[key], other[key])
end
def setup_encoded_document(filename)
site = fixture_site("collections" => ["encodings"])
site.process
Document.new(site.in_source_dir(File.join("_encodings", filename)), {
:site => site,
:collection => site.collections["encodings"],
}).tap(&:read)
end
context "a document in a collection" do
setup do
@site = fixture_site({
@@ -529,4 +538,24 @@ class TestDocument < JekyllUnitTest
assert_equal true, File.file?(@dest_file)
end
end
context "a document with UTF-8 CLRF" do
setup do
@document = setup_encoded_document "UTF8CRLFandBOM.md"
end
should "not throw an error" do
Jekyll::Renderer.new(@document.site, @document).render_document
end
end
context "a document with UTF-16LE CLRF" do
setup do
@document = setup_encoded_document "Unicode16LECRLFandBOM.md"
end
should "not throw an error" do
Jekyll::Renderer.new(@document.site, @document).render_document
end
end
end

View File

@@ -1,4 +1,3 @@
# coding: utf-8
# frozen_string_literal: true
require "helper"

View File

@@ -1,4 +1,3 @@
# encoding: UTF-8
# frozen_string_literal: true
require "helper"

View File

@@ -1,4 +1,3 @@
# coding: utf-8
# frozen_string_literal: true
require "helper"

View File

@@ -1,4 +1,3 @@
# encoding: utf-8
# frozen_string_literal: true
require "helper"
@@ -387,16 +386,21 @@ class TestUtils < JekyllUnitTest
should "ignore encoding if it's not there" do
opts = Utils.merged_file_read_opts(nil, {})
assert_nil opts["encoding"]
assert_nil opts[:encoding]
end
should "add bom to encoding" do
opts = Utils.merged_file_read_opts(nil, { "encoding" => "utf-8" })
assert_equal "bom|utf-8", opts["encoding"]
opts = { "encoding" => "utf-8", :encoding => "utf-8" }
merged = Utils.merged_file_read_opts(nil, opts)
assert_equal "bom|utf-8", merged["encoding"]
assert_equal "bom|utf-8", merged[:encoding]
end
should "preserve bom in encoding" do
opts = Utils.merged_file_read_opts(nil, { "encoding" => "bom|utf-8" })
assert_equal "bom|utf-8", opts["encoding"]
opts = { "encoding" => "bom|another", :encoding => "bom|another" }
merged = Utils.merged_file_read_opts(nil, opts)
assert_equal "bom|another", merged["encoding"]
assert_equal "bom|another", merged[:encoding]
end
end
end