mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
15 Commits
4.2-stable
...
4.0-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dfb5499d9 | ||
|
|
c9aa19c59d | ||
|
|
ddc060c21c | ||
|
|
587cb9bd5a | ||
|
|
3845850c09 | ||
|
|
4c124cc636 | ||
|
|
3014f8d0c8 | ||
|
|
de89a60b3a | ||
|
|
830c1e6736 | ||
|
|
94f60cb097 | ||
|
|
55624a57e3 | ||
|
|
ca9989ae29 | ||
|
|
8c6f8fb856 | ||
|
|
c6308d8f11 | ||
|
|
65adc8dbed |
@@ -107,6 +107,8 @@ Style/Alias:
|
||||
EnforcedStyle: prefer_alias_method
|
||||
Style/AndOr:
|
||||
Severity: error
|
||||
Style/BracesAroundHashParameters:
|
||||
Enabled: false
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- test/**/*.rb
|
||||
|
||||
10
.travis.yml
10
.travis.yml
@@ -4,9 +4,11 @@ cache: bundler
|
||||
language: ruby
|
||||
|
||||
rvm:
|
||||
- &ruby1 2.6.3
|
||||
- &ruby2 2.4.6
|
||||
- &jruby jruby-9.2.7.0
|
||||
- &ruby1 2.7.1
|
||||
- &ruby2 2.6.6
|
||||
- &ruby3 2.5.8
|
||||
- &ruby4 2.4.10
|
||||
- &jruby jruby-9.2.11.1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
@@ -19,7 +21,7 @@ matrix:
|
||||
- rvm: *ruby1
|
||||
env: TEST_SUITE=profile-docs
|
||||
name: "Profile Docs"
|
||||
- rvm: *ruby1
|
||||
- rvm: *ruby4
|
||||
env: TEST_SUITE=memprof
|
||||
name: "Profile Memory Allocation"
|
||||
exclude:
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
## 4.0.1 / 2020-05-08
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Prevent console warning with Ruby 2.7 (#8124)
|
||||
* Clear cached Liquid template scope before render (#8141)
|
||||
* Add static file's basename to its url_placeholder (#8142)
|
||||
* Update item_property to recognize integers (#8160)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Fix Kramdown converter based tests for v4.0.x (#8143)
|
||||
|
||||
## 4.0.0 / 2019-08-19
|
||||
|
||||
### Major Enhancements
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
version: 4.0.0
|
||||
version: 4.0.1
|
||||
name: Jekyll • Simple, blog-aware, static sites
|
||||
description: Transform your plain text into static websites and blogs
|
||||
url: https://jekyllrb.com
|
||||
|
||||
@@ -4,6 +4,23 @@ permalink: "/docs/history/"
|
||||
note: This file is autogenerated. Edit /History.markdown instead.
|
||||
---
|
||||
|
||||
## 4.0.1 / 2020-05-08
|
||||
{: #v4-0-1}
|
||||
|
||||
### Bug Fixes
|
||||
{: #bug-fixes-v4-0-1}
|
||||
|
||||
- Prevent console warning with Ruby 2.7 ([#8124]({{ site.repository }}/issues/8124))
|
||||
- Clear cached Liquid template scope before render ([#8141]({{ site.repository }}/issues/8141))
|
||||
- Add static file's basename to its url_placeholder ([#8142]({{ site.repository }}/issues/8142))
|
||||
- Update item_property to recognize integers ([#8160]({{ site.repository }}/issues/8160))
|
||||
|
||||
### Development Fixes
|
||||
{: #development-fixes-v4-0-1}
|
||||
|
||||
- Fix Kramdown converter based tests for v4.0.x ([#8143]({{ site.repository }}/issues/8143))
|
||||
|
||||
|
||||
## 4.0.0 / 2019-08-19
|
||||
{: #v4-0-0}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.0.0
|
||||
4.0.1
|
||||
|
||||
@@ -610,3 +610,17 @@ Feature: Collections
|
||||
And I should see "Thanksgiving Black Friday" in "_site/index.html"
|
||||
And I should see "Happy Thanksgiving" in "_site/thanksgiving/2015-11-26-thanksgiving.html"
|
||||
And I should see "Black Friday" in "_site/thanksgiving/black-friday.html"
|
||||
|
||||
Scenario: Rendered collection with custom permalinks and static file contents
|
||||
Given I have fixture collections
|
||||
And I have a "_config.yml" file with content:
|
||||
"""
|
||||
collections:
|
||||
methods:
|
||||
output: true
|
||||
permalink: /:collection/:name
|
||||
"""
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "I have no front matter." in "_site/methods/extensionless_static_file"
|
||||
|
||||
@@ -108,7 +108,7 @@ Feature: Post excerpts
|
||||
Then I should get a zero exit status
|
||||
And I should not see "Kramdown warning" in the build output
|
||||
But I should see exactly "<p>Install Jekyll</p>" in "_site/just-text-excerpt.html"
|
||||
And I should see "<p>Alpha <sup id=\"fnref:1\"><a href=\"#fn:1\" class=\"footnote\">1</a></sup></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Omega sigma <a href=\"#fnref:1\" class=\"reversefootnote\">↩</a></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Alpha <sup id=\"fnref:1\" role=\"doc-noteref\"><a href=\"#fn:1\" class=\"footnote\">1</a></sup></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Omega sigma <a href=\"#fnref:1\" class=\"reversefootnote\" role=\"doc-backlink\">↩</a></p>" in "_site/text-and-footnote.html"
|
||||
And I should see "<p>Read <a href=\"docs.jekyll.com\">docs</a></p>" in "_site/text-and-reference-link.html"
|
||||
And I should see "<p>Check out <a href=\"jekyllrb.com\">jekyll</a></p>" in "_site/text-and-self-refencing-link.html"
|
||||
|
||||
@@ -39,7 +39,7 @@ module Jekyll
|
||||
|
||||
begin
|
||||
self.content = File.read(@path || site.in_source_dir(base, name),
|
||||
Utils.merged_file_read_opts(site, opts))
|
||||
**Utils.merged_file_read_opts(site, opts))
|
||||
if content =~ Document::YAML_FRONT_MATTER_REGEXP
|
||||
self.content = $POSTMATCH
|
||||
self.data = SafeYAML.load(Regexp.last_match(1))
|
||||
|
||||
@@ -298,7 +298,7 @@ module Jekyll
|
||||
else
|
||||
begin
|
||||
merge_defaults
|
||||
read_content(opts)
|
||||
read_content(**opts)
|
||||
read_post_data
|
||||
rescue StandardError => e
|
||||
handle_read_error(e)
|
||||
@@ -429,14 +429,14 @@ module Jekyll
|
||||
categories.flatten!
|
||||
categories.uniq!
|
||||
|
||||
merge_data!("categories" => categories)
|
||||
merge_data!({ "categories" => categories })
|
||||
end
|
||||
|
||||
def populate_tags
|
||||
tags = Utils.pluralized_array_from_hash(data, "tag", "tags")
|
||||
tags.flatten!
|
||||
|
||||
merge_data!("tags" => tags)
|
||||
merge_data!({ "tags" => tags })
|
||||
end
|
||||
|
||||
private
|
||||
@@ -462,8 +462,8 @@ module Jekyll
|
||||
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
|
||||
end
|
||||
|
||||
def read_content(opts)
|
||||
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
|
||||
def read_content(**opts)
|
||||
self.content = File.read(path, **Utils.merged_file_read_opts(site, opts))
|
||||
if content =~ YAML_FRONT_MATTER_REGEXP
|
||||
self.content = $POSTMATCH
|
||||
data_file = SafeYAML.load(Regexp.last_match(1))
|
||||
|
||||
@@ -368,15 +368,18 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Performance/RegexpMatch
|
||||
FLOAT_LIKE = %r!\A\s*-?(?:\d+\.?\d*|\.\d+)\s*\Z!.freeze
|
||||
INTEGER_LIKE = %r!\A\s*-?\d+\s*\Z!.freeze
|
||||
private_constant :FLOAT_LIKE, :INTEGER_LIKE
|
||||
|
||||
# return numeric values as numbers for proper sorting
|
||||
def parse_sort_input(property)
|
||||
number_like = %r!\A\s*-?(?:\d+\.?\d*|\.\d+)\s*\Z!
|
||||
return property.to_f if property.to_s =~ number_like
|
||||
stringified = property.to_s
|
||||
return property.to_i if INTEGER_LIKE.match?(stringified)
|
||||
return property.to_f if FLOAT_LIKE.match?(stringified)
|
||||
|
||||
property
|
||||
end
|
||||
# rubocop:enable Performance/RegexpMatch
|
||||
|
||||
def as_liquid(item)
|
||||
case item
|
||||
|
||||
@@ -18,6 +18,8 @@ module Jekyll
|
||||
end
|
||||
|
||||
def render(*args)
|
||||
reset_template_assigns
|
||||
|
||||
measure_time do
|
||||
measure_bytes do
|
||||
measure_counts do
|
||||
@@ -29,6 +31,8 @@ module Jekyll
|
||||
|
||||
# This method simply 'rethrows any error' before attempting to render the template.
|
||||
def render!(*args)
|
||||
reset_template_assigns
|
||||
|
||||
measure_time do
|
||||
measure_bytes do
|
||||
measure_counts do
|
||||
@@ -44,6 +48,12 @@ module Jekyll
|
||||
|
||||
private
|
||||
|
||||
# clear assigns to `Liquid::Template` instance prior to rendering since
|
||||
# `Liquid::Template` instances are cached in Jekyll 4.
|
||||
def reset_template_assigns
|
||||
@template.instance_assigns.clear
|
||||
end
|
||||
|
||||
def measure_counts
|
||||
@renderer.increment_count(@filename)
|
||||
yield
|
||||
|
||||
@@ -126,7 +126,7 @@ module Jekyll
|
||||
:collection => @collection.label,
|
||||
:path => cleaned_relative_path,
|
||||
:output_ext => "",
|
||||
:name => "",
|
||||
:name => basename,
|
||||
:title => "",
|
||||
}
|
||||
end
|
||||
|
||||
@@ -176,7 +176,7 @@ module Jekyll
|
||||
|
||||
# This method allows to modify the file content by inheriting from the class.
|
||||
def read_file(file, context)
|
||||
File.read(file, file_read_opts(context))
|
||||
File.read(file, **file_read_opts(context))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "4.0.0"
|
||||
VERSION = "4.0.1"
|
||||
end
|
||||
|
||||
1
test/source/_methods/extensionless_static_file
Normal file
1
test/source/_methods/extensionless_static_file
Normal file
@@ -0,0 +1 @@
|
||||
I have no front matter.
|
||||
@@ -175,7 +175,7 @@ class TestDocument < JekyllUnitTest
|
||||
}]
|
||||
)
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first
|
||||
@document = @site.collections["slides"].docs.find { |d| d.is_a?(Document) }
|
||||
end
|
||||
|
||||
should "know the front matter defaults" do
|
||||
|
||||
@@ -831,6 +831,16 @@ class TestFilters < JekyllUnitTest
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
should "should pass integers as is" do
|
||||
grouping = @filter.group_by([
|
||||
{ "name" => "Allison", "year" => 2016 },
|
||||
{ "name" => "Amy", "year" => 2016 },
|
||||
{ "name" => "George", "year" => 2019 },
|
||||
], "year")
|
||||
assert_equal "2016", grouping[0]["name"]
|
||||
assert_equal "2019", grouping[1]["name"]
|
||||
end
|
||||
end
|
||||
|
||||
context "where filter" do
|
||||
@@ -1036,7 +1046,7 @@ class TestFilters < JekyllUnitTest
|
||||
posts = @filter.site.site_payload["site"]["posts"]
|
||||
results = @filter.where_exp(posts, "post",
|
||||
"post.date > site.dont_show_posts_before")
|
||||
assert_equal posts.select { |p| p.date > @sample_time }.count, results.length
|
||||
assert_equal posts.count { |p| p.date > @sample_time }, results.length
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,10 +4,24 @@ require "helper"
|
||||
require "rouge"
|
||||
|
||||
class TestKramdown < JekyllUnitTest
|
||||
def fixture_converter(config)
|
||||
site = fixture_site(
|
||||
Utils.deep_merge_hashes(
|
||||
{
|
||||
"markdown" => "kramdown",
|
||||
},
|
||||
config
|
||||
)
|
||||
)
|
||||
Jekyll::Cache.clear
|
||||
site.find_converter_instance(
|
||||
Jekyll::Converters::Markdown
|
||||
)
|
||||
end
|
||||
|
||||
context "kramdown" do
|
||||
setup do
|
||||
@config = {
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"smart_quotes" => "lsquo,rsquo,ldquo,rdquo",
|
||||
"entity_output" => "as_char",
|
||||
@@ -31,9 +45,7 @@ class TestKramdown < JekyllUnitTest
|
||||
@config["kramdown"]["syntax_highlighter_opts"].keys
|
||||
|
||||
@config = Jekyll.configuration(@config)
|
||||
@markdown = Converters::Markdown.new(@config)
|
||||
@markdown.setup
|
||||
Jekyll::Cache.clear
|
||||
@converter = fixture_converter(@config)
|
||||
end
|
||||
|
||||
should "not break kramdown" do
|
||||
@@ -43,20 +55,32 @@ class TestKramdown < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "run Kramdown" do
|
||||
assert_equal "<h1>Some Header</h1>", @markdown.convert("# Some Header #").strip
|
||||
assert_equal "<h1>Some Header</h1>", @converter.convert("# Some Header #").strip
|
||||
end
|
||||
|
||||
should "should log kramdown warnings" do
|
||||
allow_any_instance_of(Kramdown::Document).to receive(:warnings).and_return(["foo"])
|
||||
expect(Jekyll.logger).to receive(:warn).with("Kramdown warning:", "foo")
|
||||
@markdown.convert("Something")
|
||||
@converter.convert("Something")
|
||||
end
|
||||
|
||||
should "render fenced code blocks with syntax highlighting" do
|
||||
result = nokogiri_fragment(@converter.convert(<<~MARKDOWN))
|
||||
~~~ruby
|
||||
puts "Hello World"
|
||||
~~~
|
||||
MARKDOWN
|
||||
div_highlight = ">div.highlight"
|
||||
selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code"
|
||||
refute(result.css(selector).empty?, result.to_html)
|
||||
end
|
||||
|
||||
context "when asked to convert smart quotes" do
|
||||
should "convert" do
|
||||
converter = fixture_converter(@config)
|
||||
assert_match(
|
||||
%r!<p>(“|“)Pit(’|’)hy(”|”)<\/p>!,
|
||||
@markdown.convert(%("Pit'hy")).strip
|
||||
converter.convert(%("Pit'hy")).strip
|
||||
)
|
||||
end
|
||||
|
||||
@@ -67,36 +91,22 @@ class TestKramdown < JekyllUnitTest
|
||||
"smart_quotes" => "lsaquo,rsaquo,laquo,raquo",
|
||||
},
|
||||
}
|
||||
|
||||
markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, override))
|
||||
converter = fixture_converter(Utils.deep_merge_hashes(@config, override))
|
||||
assert_match %r!<p>(«|«)Pit(›|›)hy(»|»)<\/p>!, \
|
||||
markdown.convert(%("Pit'hy")).strip
|
||||
converter.convert(%("Pit'hy")).strip
|
||||
end
|
||||
end
|
||||
|
||||
should "render fenced code blocks with syntax highlighting" do
|
||||
result = nokogiri_fragment(@markdown.convert(<<~MARKDOWN))
|
||||
~~~ruby
|
||||
puts "Hello World"
|
||||
~~~
|
||||
MARKDOWN
|
||||
div_highlight = ">div.highlight"
|
||||
selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code"
|
||||
refute(result.css(selector).empty?, result.to_html)
|
||||
end
|
||||
|
||||
context "when a custom highlighter is chosen" do
|
||||
should "use the chosen highlighter if it's available" do
|
||||
override = {
|
||||
"highlighter" => nil,
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"syntax_highlighter" => :coderay,
|
||||
"syntax_highlighter" => "coderay",
|
||||
},
|
||||
}
|
||||
|
||||
markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, override))
|
||||
result = nokogiri_fragment(markdown.convert(<<~MARKDOWN))
|
||||
converter = fixture_converter(Utils.deep_merge_hashes(@config, override))
|
||||
result = nokogiri_fragment(converter.convert(<<~MARKDOWN))
|
||||
~~~ruby
|
||||
puts "Hello World"
|
||||
~~~
|
||||
@@ -108,7 +118,6 @@ class TestKramdown < JekyllUnitTest
|
||||
|
||||
should "support legacy enable_coderay... for now" do
|
||||
override = {
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"enable_coderay" => true,
|
||||
},
|
||||
@@ -116,8 +125,9 @@ class TestKramdown < JekyllUnitTest
|
||||
|
||||
@config.delete("highlighter")
|
||||
@config["kramdown"].delete("syntax_highlighter")
|
||||
markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, override))
|
||||
result = nokogiri_fragment(markdown.convert(<<~MARKDOWN))
|
||||
|
||||
converter = fixture_converter(Utils.deep_merge_hashes(@config, override))
|
||||
result = nokogiri_fragment(converter.convert(<<~MARKDOWN))
|
||||
~~~ruby
|
||||
puts "Hello World"
|
||||
~~~
|
||||
@@ -129,17 +139,18 @@ class TestKramdown < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "move coderay to syntax_highlighter_opts" do
|
||||
override = {
|
||||
"higlighter" => nil,
|
||||
"kramdown" => {
|
||||
"syntax_highlighter" => "coderay",
|
||||
"coderay" => {
|
||||
"hello" => "world",
|
||||
},
|
||||
},
|
||||
}
|
||||
original = Kramdown::Document.method(:new)
|
||||
markdown = Converters::Markdown.new(
|
||||
Utils.deep_merge_hashes(@config,
|
||||
"higlighter" => nil,
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"syntax_highlighter" => "coderay",
|
||||
"coderay" => {
|
||||
"hello" => "world",
|
||||
},
|
||||
})
|
||||
converter = fixture_converter(
|
||||
Utils.deep_merge_hashes(@config, override)
|
||||
)
|
||||
|
||||
expect(Kramdown::Document).to receive(:new) do |arg1, hash|
|
||||
@@ -147,7 +158,7 @@ class TestKramdown < JekyllUnitTest
|
||||
original.call(arg1, hash)
|
||||
end
|
||||
|
||||
markdown.convert("hello world")
|
||||
converter.convert("hello world")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user