mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d555a7361 | ||
|
|
1cda1842d2 | ||
|
|
5a0582aad6 | ||
|
|
035c6e0337 | ||
|
|
1377cf2f70 | ||
|
|
de4007c2cd | ||
|
|
538976270b | ||
|
|
d41f181625 |
@@ -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:
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -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__)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.6.0
|
||||
3.6.2
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ module Jekyll
|
||||
)
|
||||
end
|
||||
end
|
||||
end # end of class << self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>"
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "3.6.0".freeze
|
||||
VERSION = "3.6.2".freeze
|
||||
end
|
||||
|
||||
11
test/source/_encodings/UTF8CRLFandBOM.md
Executable file
11
test/source/_encodings/UTF8CRLFandBOM.md
Executable 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
|
||||
|
||||
You’ll 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.
|
||||
BIN
test/source/_encodings/Unicode16LECRLFandBOM.md
Executable file
BIN
test/source/_encodings/Unicode16LECRLFandBOM.md
Executable file
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# coding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# coding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user