Compare commits

...

15 Commits

Author SHA1 Message Date
Frank Taillandier
8dfb5499d9 Release 💎 4.0.1 2020-05-08 17:00:08 +02:00
Frank Taillandier
c9aa19c59d chore(release): v4.0.1 💎 2020-05-08 16:59:52 +02:00
Ashwin Maroli
ddc060c21c Update history to reflect merge of #8160 [ci skip] 2020-05-06 21:50:30 +05:30
Ashwin Maroli
587cb9bd5a Backport #7878 for v4.0.x (#8160)
Update item_property to recognize integers
This backports eb81dc0 to 4.0-stable

Co-authored-by: Ivan Gromov <summer.is.gone@gmail.com>
2020-05-06 21:47:10 +05:30
Ashwin Maroli
3845850c09 Update history to reflect merge of #8142 [ci skip] 2020-04-26 20:05:13 +05:30
Ashwin Maroli
4c124cc636 Backport #7908 for v4.0.x (#8142)
Add static file's basename to its url_placeholder
This backports be70c3e to 4.0-stable
2020-04-26 20:03:33 +05:30
Ashwin Maroli
3014f8d0c8 Update history to reflect merge of #8141 [ci skip] 2020-04-26 20:02:04 +05:30
Ashwin Maroli
de89a60b3a Backport #7967 for v4.0.x (#8141)
Clear cached Liquid template scope before render
This backports 67380a2 to 4.0-stable
2020-04-26 20:00:17 +05:30
Ashwin Maroli
830c1e6736 Merge branch '4.0-stable' into this branch 2020-04-26 16:06:26 +05:30
Ashwin Maroli
94f60cb097 Update history to reflect merge of #8143 [ci skip] 2020-04-26 16:00:41 +05:30
Ashwin Maroli
55624a57e3 Fix Kramdown converter based tests for v4.0.x (#8143)
* Update unit tests for Kramdown-based converter
  Backports d65a09b to 4.0-stable

* Update expected markup rendered by kramdown
  Backports 79be8ab to 4.0-stable
2020-04-26 15:54:19 +05:30
Ashwin Maroli
ca9989ae29 Backport #7908 for v4.0.x
Add static file's basename to its url_placeholder
This backports be70c3e to 4.0-stable
2020-04-26 14:45:19 +05:30
Ashwin Maroli
8c6f8fb856 Update history to reflect merge of #8124 [ci skip] 2020-04-16 22:50:29 +05:30
Ashwin Maroli
c6308d8f11 Backport #7948 for v4.0.x (#8124)
Attain Ruby 3.0 compatibility
This backports 389eb88 to 4.0-stable

Additionally includes:
  * Changes to appease RuboCop
  * Bump Ruby versions used for Travis jobs
2020-04-16 22:47:15 +05:30
Matt Rogers
65adc8dbed Release 💎 4.0.0 2019-08-20 09:48:04 -05:00
19 changed files with 146 additions and 63 deletions

View File

@@ -107,6 +107,8 @@ Style/Alias:
EnforcedStyle: prefer_alias_method
Style/AndOr:
Severity: error
Style/BracesAroundHashParameters:
Enabled: false
Style/ClassAndModuleChildren:
Exclude:
- test/**/*.rb

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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}

View File

@@ -1 +1 @@
4.0.0
4.0.1

View File

@@ -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"

View 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\">&#8617;</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\">&#8617;</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"

View File

@@ -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))

View File

@@ -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))

View File

@@ -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

View File

@@ -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

View File

@@ -126,7 +126,7 @@ module Jekyll
:collection => @collection.label,
:path => cleaned_relative_path,
:output_ext => "",
:name => "",
:name => basename,
:title => "",
}
end

View File

@@ -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

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Jekyll
VERSION = "4.0.0"
VERSION = "4.0.1"
end

View File

@@ -0,0 +1 @@
I have no front matter.

View File

@@ -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

View File

@@ -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

View File

@@ -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>(&#8220;|“)Pit(&#8217;|)hy(&#8221;|”)<\/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>(&#171;|«)Pit(&#8250;|)hy(&#187;|»)<\/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