mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33a5a803d4 | ||
|
|
fb364ba91b | ||
|
|
a6b18000b2 | ||
|
|
b52339004e | ||
|
|
935a7a99e2 | ||
|
|
abd2cd9471 | ||
|
|
595cc23067 | ||
|
|
9ff6eb78db | ||
|
|
3874e124d7 | ||
|
|
2a6efa2373 | ||
|
|
e0f339a1e5 | ||
|
|
4df3d241ab | ||
|
|
14a9c9c01a | ||
|
|
a079df52bd | ||
|
|
7a6e0f1802 | ||
|
|
da570f02d7 | ||
|
|
868d96948b | ||
|
|
a260cabb89 | ||
|
|
7979f480b3 | ||
|
|
4d439407a9 | ||
|
|
8810223544 | ||
|
|
f519371e5d | ||
|
|
e83680e487 | ||
|
|
590d0b58b9 | ||
|
|
f3fa91e7c7 | ||
|
|
6408c0f264 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -22,10 +22,10 @@ jobs:
|
||||
ruby_version: "2.7"
|
||||
- label: Ruby 3.0
|
||||
ruby_version: "3.0"
|
||||
- label: Ruby 3.1
|
||||
ruby_version: "3.1"
|
||||
- label: JRuby 9.3.4.0
|
||||
ruby_version: "jruby-9.3.4.0"
|
||||
- label: Ruby 3.1.2
|
||||
ruby_version: "3.1.2"
|
||||
- label: JRuby 9.4.0.0
|
||||
ruby_version: "jruby-9.4.0.0"
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
7
Gemfile
7
Gemfile
@@ -15,6 +15,7 @@ end
|
||||
#
|
||||
|
||||
group :test do
|
||||
gem "activesupport", "~> 7.0.0"
|
||||
gem "cucumber", RUBY_VERSION >= "2.5" ? "~> 5.1.2" : "~> 4.1"
|
||||
gem "httpclient"
|
||||
gem "jekyll_test_plugin"
|
||||
@@ -75,6 +76,12 @@ group :jekyll_optional_dependencies do
|
||||
gem "kramdown-syntax-coderay"
|
||||
gem "matrix"
|
||||
gem "mime-types", "~> 3.0"
|
||||
# Psych 5 has stopped bundling `libyaml` and expects it to be installed on the host system prior
|
||||
# to being invoked.
|
||||
# Since we don't have a direct dependency on the Psych gem (it gets included in the gem bundle as
|
||||
# a dependency of the `rdoc` gem), lock psych gem to v4.x instead of installing `libyaml` in our
|
||||
# development / CI environment.
|
||||
gem "psych", "~> 4.0"
|
||||
gem "rdoc", "~> 6.0"
|
||||
gem "tomlrb"
|
||||
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
## 4.3.3 / 2023-12-27
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Backport #9392 for v4.3.x: Fix backward compatibility issues in the Logger (#9510)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Backport #9237 for v4.3.x: Use Hash explicitly for Struct initializer (#9285)
|
||||
|
||||
## 4.3.2 / 2023-01-20
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Backport #9257 for v4.3.x: Rename sass partial created for new blank site (#9262)
|
||||
* Backport #9187 for v4.3.x: Optimize `Site#each_site_file` (#9256)
|
||||
* Backport #9186 for v4.3.x: Remove totals in profile table properly (#9255)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Backport #9223 for 4.3.x: Update sass related tests for jekyll-sass-converter 3.x (#9254)
|
||||
|
||||
## 4.3.1 / 2022-10-26
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Respect user-defined name attribute in documents (#9167)
|
||||
* Revert "Incrementally rebuild when a data file is changed" (#9170)
|
||||
|
||||
### Documentation
|
||||
|
||||
* Release post for v4.3.1 (#9171)
|
||||
|
||||
## 4.3.0 / 2022-10-20
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
16
appveyor.yml
16
appveyor.yml
@@ -1,5 +1,7 @@
|
||||
version: "{build}"
|
||||
|
||||
image: Visual Studio 2019
|
||||
|
||||
clone_depth: 5
|
||||
|
||||
branches:
|
||||
@@ -13,22 +15,22 @@ build: off
|
||||
environment:
|
||||
BUNDLE_WITHOUT: "benchmark:development"
|
||||
matrix:
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TZINFO_VERSION: "~> 1.2"
|
||||
TEST_SUITE: "test"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TZINFO_VERSION: "~> 2.0"
|
||||
TEST_SUITE: "test"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TEST_SUITE: "default-site"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TEST_SUITE: "profile-docs"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TEST_SUITE: "memprof"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TZINFO_VERSION: "~> 1.2"
|
||||
TEST_SUITE: "cucumber"
|
||||
- RUBY_FOLDER_VER: "26"
|
||||
- RUBY_FOLDER_VER: "27"
|
||||
TZINFO_VERSION: "~> 2.0"
|
||||
TEST_SUITE: "cucumber"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
version: 4.3.0
|
||||
version: 4.3.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,20 @@ permalink: "/docs/history/"
|
||||
note: This file is autogenerated. Edit /History.markdown instead.
|
||||
---
|
||||
|
||||
## 4.3.1 / 2022-10-26
|
||||
{: #v4-3-1}
|
||||
|
||||
### Bug Fixes
|
||||
{: #bug-fixes-v4-3-1}
|
||||
|
||||
- Respect user-defined name attribute in documents ([#9167]({{ site.repository }}/issues/9167))
|
||||
- Revert "Incrementally rebuild when a data file is changed" ([#9170]({{ site.repository }}/issues/9170))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Release post for v4.3.1 ([#9171]({{ site.repository }}/issues/9171))
|
||||
|
||||
|
||||
## 4.3.0 / 2022-10-20
|
||||
{: #v4-3-0}
|
||||
|
||||
|
||||
21
docs/_posts/2022-10-26-jekyll-4-3-1-released.markdown
Normal file
21
docs/_posts/2022-10-26-jekyll-4-3-1-released.markdown
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: 'Jekyll 4.3.1 Released'
|
||||
date: 2022-10-26 19:09:42 +0530
|
||||
author: ashmaroli
|
||||
version: 4.3.1
|
||||
category: release
|
||||
---
|
||||
|
||||
Hello Jekyllers!
|
||||
|
||||
We're shipping `v4.3.1` containing fixes for two issues with v4.3.0:
|
||||
- Jekyll now respects user-defined `name` attribute for collection documents when accessed in Liquid templates.
|
||||
- Revert the changes made to trigger incremental rebuilds when data files are changed.
|
||||
|
||||
Thanks to the users who took the time to report the issues to us.
|
||||
Happy Jekyllin'
|
||||
|
||||
P.S. Development towards v5 has taken a back seat as of now. I plan on releasing a v4.4.0 instead.
|
||||
That said, please feel free to comment on the [tentative roadmap to v5][roadmap].
|
||||
|
||||
[roadmap]: {{ site.repository }}/issues/9156
|
||||
@@ -1 +1 @@
|
||||
4.3.0
|
||||
4.3.1
|
||||
|
||||
@@ -14,10 +14,15 @@ Feature: Create sites
|
||||
And the test_blank/_sass directory should exist
|
||||
And the test_blank/assets/css directory should exist
|
||||
And the "test_blank/_layouts/default.html" file should exist
|
||||
And the "test_blank/_sass/main.scss" file should exist
|
||||
And the "test_blank/_sass/base.scss" file should exist
|
||||
And the "test_blank/assets/css/main.scss" file should exist
|
||||
And the "test_blank/_config.yml" file should exist
|
||||
And the "test_blank/index.md" file should exist
|
||||
When I run jekyll build --source test_blank --destination test_blank/_site
|
||||
Then I should get a zero exit status
|
||||
And the test_blank/_site directory should exist
|
||||
And I should see "Start developing" in "test_blank/_site/index.html"
|
||||
And I should see "body {" in "test_blank/_site/assets/css/main.css"
|
||||
|
||||
Scenario: Basic site
|
||||
Given I have an "index.html" file that contains "Basic Site"
|
||||
|
||||
@@ -67,59 +67,6 @@ Feature: Incremental rebuild
|
||||
And the _site directory should exist
|
||||
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"
|
||||
|
||||
Scenario: Rebuild when a data file is changed
|
||||
Given I have a _data directory
|
||||
And I have a "_data/colors.yml" file that contains "[red, green, blue]"
|
||||
And I have a _data/members/core directory
|
||||
And I have a "_data/members/core/emeritus.yml" file with content:
|
||||
"""
|
||||
- name: John Doe
|
||||
role: Admin
|
||||
"""
|
||||
And I have an _includes directory
|
||||
And I have an "_includes/about.html" file with content:
|
||||
"""
|
||||
<ul>
|
||||
{% for entry in site.data.members.core.emeritus %}
|
||||
<li title="{{ entry.name }} -- {{ entry.role }}">{{ entry.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
"""
|
||||
And I have a _layouts directory
|
||||
And I have a page layout that contains "{{ content }}\n\n{% include about.html %}"
|
||||
And I have a home layout that contains "{{ content }}\n\nGenerated by Jekyll"
|
||||
And I have a "_layouts/post.html" page with layout "page" that contains "{{ content }}"
|
||||
And I have a "_layouts/static.html" page with layout "home" that contains "{{ content }}"
|
||||
And I have an "index.html" page with layout "home" that contains "{{ site.data.colors | join: '_' }}"
|
||||
And I have an "about.html" page with layout "page" that contains "About Us"
|
||||
And I have a configuration file with "collections_dir" set to "collections"
|
||||
And I have a collections/_posts directory
|
||||
And I have the following post within the "collections" directory:
|
||||
| title | date | layout | content |
|
||||
| Table | 2009-03-26 | post | Post with data dependency |
|
||||
| Wargames | 2009-03-27 | static | Post without data dependency |
|
||||
When I run jekyll build -IV
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "red_green_blue" in "_site/index.html"
|
||||
And I should see "John Doe -- Admin" in "_site/about.html"
|
||||
And I should see "Rendering: index.html" in the build output
|
||||
And I should see "Rendering: _posts/2009-03-27-wargames.markdown" in the build output
|
||||
When I wait 1 second
|
||||
Then I have a "_data/members/core/emeritus.yml" file with content:
|
||||
"""
|
||||
- name: Jane Doe
|
||||
role: Admin
|
||||
"""
|
||||
When I run jekyll build -IV
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "red_green_blue" in "_site/index.html"
|
||||
And I should see "Jane Doe -- Admin" in "_site/about.html"
|
||||
And I should see "Rendering: _posts/2009-03-26-table.markdown" in the build output
|
||||
But I should not see "Rendering: index.html" in the build output
|
||||
And I should not see "Rendering: _posts/2009-03-27-wargames.markdown" in the build output
|
||||
|
||||
Scenario: Rebuild when a dependency of document in custom collection_dir is changed
|
||||
Given I have a _includes directory
|
||||
And I have a configuration file with "collections_dir" set to "collections"
|
||||
|
||||
@@ -168,7 +168,7 @@ Feature: Rendering
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see ".foo-bar { color: red; }\n\n\/\*# sourceMappingURL=index.css.map \*\/" in "_site/index.css"
|
||||
And I should see ".foo-bar {\n color: red;\n}\n\n\/\*# sourceMappingURL=index.css.map \*\/" in "_site/index.css"
|
||||
|
||||
Scenario: Not render liquid in CoffeeScript without explicitly including jekyll-coffeescript
|
||||
Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'"
|
||||
|
||||
@@ -19,7 +19,7 @@ Feature: Writing themes
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see ".sample { color: red; }\n\n\/\*# sourceMappingURL=style.css.map \*\/" in "_site/assets/style.css"
|
||||
And I should see ".sample {\n color: red;\n}\n\n\/\*# sourceMappingURL=style.css.map \*\/" in "_site/assets/style.css"
|
||||
|
||||
Scenario: Overriding a theme with SCSS
|
||||
Given I have a configuration file with "theme" set to "test-theme"
|
||||
@@ -28,7 +28,7 @@ Feature: Writing themes
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see ".sample { color: black; }\n\n\/\*# sourceMappingURL=style.css.map \*\/" in "_site/assets/style.css"
|
||||
And I should see ".sample {\n color: black;\n}\n\n\/\*# sourceMappingURL=style.css.map \*\/" in "_site/assets/style.css"
|
||||
|
||||
Scenario: A theme with an include
|
||||
Given I have a configuration file with "theme" set to "test-theme"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
@import "main";
|
||||
@import "base";
|
||||
|
||||
@@ -45,8 +45,6 @@ module Jekyll
|
||||
autoload :Collection, "jekyll/collection"
|
||||
autoload :Configuration, "jekyll/configuration"
|
||||
autoload :Convertible, "jekyll/convertible"
|
||||
autoload :DataEntry, "jekyll/data_entry"
|
||||
autoload :DataHash, "jekyll/data_hash"
|
||||
autoload :Deprecator, "jekyll/deprecator"
|
||||
autoload :Document, "jekyll/document"
|
||||
autoload :EntryFilter, "jekyll/entry_filter"
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class DataEntry
|
||||
attr_accessor :context
|
||||
attr_reader :data
|
||||
|
||||
# Create a Jekyll wrapper for given parsed data object.
|
||||
#
|
||||
# site - The current Jekyll::Site instance.
|
||||
# abs_path - Absolute path to the data source file.
|
||||
# parsed_data - Parsed representation of data source file contents.
|
||||
#
|
||||
# Returns nothing.
|
||||
def initialize(site, abs_path, parsed_data)
|
||||
@site = site
|
||||
@path = abs_path
|
||||
@data = parsed_data
|
||||
end
|
||||
|
||||
# Liquid representation of current instance is the parsed data object.
|
||||
#
|
||||
# Mark as a dependency for regeneration here since every renderable object primarily uses the
|
||||
# parsed data object while the parent resource is being rendered by Liquid. Accessing the data
|
||||
# object directly via Ruby interface `#[]()` is outside the scope of regeneration.
|
||||
#
|
||||
# FIXME: Marking as dependency on every call is non-ideal. Optimize at later day.
|
||||
#
|
||||
# Returns the parsed data object.
|
||||
def to_liquid
|
||||
add_regenerator_dependencies if incremental_build?
|
||||
@data
|
||||
end
|
||||
|
||||
# -- Overrides to maintain backwards compatibility --
|
||||
|
||||
# Any missing method will be forwarded to the underlying data object stored in the instance
|
||||
# variable `@data`.
|
||||
def method_missing(method, *args, &block)
|
||||
@data.respond_to?(method) ? @data.send(method, *args, &block) : super
|
||||
end
|
||||
|
||||
def respond_to_missing?(method, *)
|
||||
@data.respond_to?(method) || super
|
||||
end
|
||||
|
||||
def <=>(other)
|
||||
data <=> (other.is_a?(self.class) ? other.data : other)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
data == (other.is_a?(self.class) ? other.data : other)
|
||||
end
|
||||
|
||||
# Explicitly defined to bypass re-routing from `method_missing` hook for greater performance.
|
||||
#
|
||||
# Returns string representation of parsed data object.
|
||||
def inspect
|
||||
@data.inspect
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def incremental_build?
|
||||
@incremental = @site.config["incremental"] if @incremental.nil?
|
||||
@incremental
|
||||
end
|
||||
|
||||
def add_regenerator_dependencies
|
||||
page = context.registers[:page]
|
||||
return unless page&.key?("path")
|
||||
|
||||
absolute_path = \
|
||||
if page["collection"]
|
||||
@site.in_source_dir(@site.config["collections_dir"], page["path"])
|
||||
else
|
||||
@site.in_source_dir(page["path"])
|
||||
end
|
||||
|
||||
@site.regenerator.add_dependency(absolute_path, @path)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,61 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
# A class that behaves very similar to Ruby's `Hash` class yet different in how it is handled by
|
||||
# Liquid. This class emulates Hash by delegation instead of inheritance to minimize overridden
|
||||
# methods especially since some Hash methods returns another Hash instance instead of the
|
||||
# subclass instance.
|
||||
class DataHash
|
||||
#
|
||||
# Delegate given (zero-arity) method(s) to the Hash object stored in instance variable
|
||||
# `@registry`.
|
||||
# NOTE: Avoiding the use of `Forwardable` module's `def_delegators` for preventing unnecessary
|
||||
# creation of interim objects on multiple calls.
|
||||
def self.delegate_to_registry(*symbols)
|
||||
symbols.each { |sym| define_method(sym) { @registry.send(sym) } }
|
||||
end
|
||||
private_class_method :delegate_to_registry
|
||||
|
||||
# -- core instance methods --
|
||||
|
||||
attr_accessor :context
|
||||
|
||||
def initialize
|
||||
@registry = {}
|
||||
end
|
||||
|
||||
def [](key)
|
||||
@registry[key].tap do |value|
|
||||
value.context = context if value.respond_to?(:context=)
|
||||
end
|
||||
end
|
||||
|
||||
# `Hash#to_liquid` returns the Hash instance itself.
|
||||
# Mimic that behavior by returning `self` instead of returning the `@registry` variable value.
|
||||
def to_liquid
|
||||
self
|
||||
end
|
||||
|
||||
# -- supplementary instance methods to emulate Hash --
|
||||
|
||||
delegate_to_registry :freeze, :inspect
|
||||
|
||||
def merge(other, &block)
|
||||
merged_registry = @registry.merge(other, &block)
|
||||
dup.tap { |d| d.instance_variable_set(:@registry, merged_registry) }
|
||||
end
|
||||
|
||||
def merge!(other, &block)
|
||||
@registry.merge!(other, &block)
|
||||
self
|
||||
end
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
@registry.send(method, *args, &block)
|
||||
end
|
||||
|
||||
def respond_to_missing?(method, *)
|
||||
@registry.respond_to?(method)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,7 +12,6 @@ module Jekyll
|
||||
mutable false
|
||||
|
||||
delegate_method_as :relative_path, :path
|
||||
delegate_method_as :basename, :name
|
||||
private delegate_method_as :data, :fallback_data
|
||||
|
||||
delegate_methods :id, :output, :content, :to_s, :relative_path, :url, :date
|
||||
@@ -26,6 +25,10 @@ module Jekyll
|
||||
fallback_data["excerpt"].to_s
|
||||
end
|
||||
|
||||
def name
|
||||
fallback_data["name"] || @obj.basename
|
||||
end
|
||||
|
||||
def <=>(other)
|
||||
return nil unless other.is_a? DocumentDrop
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def name
|
||||
@obj.doc.basename
|
||||
@obj.doc.data["name"] || @obj.doc.basename
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,6 +7,7 @@ module Jekyll
|
||||
|
||||
mutable false
|
||||
|
||||
delegate_method_as :site_data, :data
|
||||
delegate_methods :time, :pages, :static_files, :tags, :categories
|
||||
|
||||
private delegate_method_as :config, :fallback_data
|
||||
@@ -23,12 +24,6 @@ module Jekyll
|
||||
(key != "posts" && @obj.collections.key?(key)) || super
|
||||
end
|
||||
|
||||
def data
|
||||
@obj.site_data.tap do |value|
|
||||
value.context = @context if value.respond_to?(:context=)
|
||||
end
|
||||
end
|
||||
|
||||
def posts
|
||||
@site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
|
||||
end
|
||||
|
||||
@@ -15,16 +15,12 @@ module Jekyll
|
||||
|
||||
private
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def data_for_table(num_of_rows)
|
||||
sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
|
||||
sorted = sorted.slice(0, num_of_rows)
|
||||
|
||||
table = [header_labels]
|
||||
totals = Hash.new { |hash, key| hash[key] = 0 }
|
||||
|
||||
sorted.each do |filename, file_stats|
|
||||
GAUGES.each { |gauge| totals[gauge] += file_stats[gauge] }
|
||||
row = []
|
||||
row << filename
|
||||
row << file_stats[:count].to_s
|
||||
@@ -33,14 +29,8 @@ module Jekyll
|
||||
table << row
|
||||
end
|
||||
|
||||
footer = []
|
||||
footer << "TOTAL (for #{sorted.size} files)"
|
||||
footer << totals[:count].to_s
|
||||
footer << format_bytes(totals[:bytes])
|
||||
footer << format("%.3f", totals[:time])
|
||||
table << footer
|
||||
table
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def header_labels
|
||||
GAUGES.map { |gauge| gauge.to_s.capitalize }.unshift("Filename")
|
||||
|
||||
@@ -33,18 +33,14 @@ module Jekyll
|
||||
|
||||
def profile_process
|
||||
profile_data = { "PHASE" => "TIME" }
|
||||
total_time = 0
|
||||
|
||||
[:reset, :read, :generate, :render, :cleanup, :write].each do |method|
|
||||
start_time = Time.now
|
||||
@site.send(method)
|
||||
end_time = (Time.now - start_time).round(4)
|
||||
profile_data[method.to_s.upcase] = format("%.4f", end_time)
|
||||
total_time += end_time
|
||||
end
|
||||
|
||||
profile_data["TOTAL TIME"] = format("%.4f", total_time)
|
||||
|
||||
Jekyll.logger.info "\nBuild Process Summary:"
|
||||
Jekyll.logger.info Profiler.tabulate(Array(profile_data))
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ module Jekyll
|
||||
|
||||
def initialize(site, in_source_dir: nil)
|
||||
@site = site
|
||||
@content = DataHash.new
|
||||
@content = {}
|
||||
@entry_filter = EntryFilter.new(site)
|
||||
@in_source_dir = in_source_dir || @site.method(:in_source_dir)
|
||||
@source_dir = @in_source_dir.call("/")
|
||||
@@ -24,8 +24,6 @@ module Jekyll
|
||||
@content
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
|
||||
# Read and parse all .yaml, .yml, .json, .csv and .tsv
|
||||
# files under <dir> and add them to the <data> variable.
|
||||
#
|
||||
@@ -45,14 +43,13 @@ module Jekyll
|
||||
next if @entry_filter.symlink?(path)
|
||||
|
||||
if File.directory?(path)
|
||||
read_data_to(path, data[sanitize_filename(entry)] = DataHash.new)
|
||||
read_data_to(path, data[sanitize_filename(entry)] = {})
|
||||
else
|
||||
key = sanitize_filename(File.basename(entry, ".*"))
|
||||
data[key] = DataEntry.new(site, path, read_data_file(path))
|
||||
data[key] = read_data_file(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
# Determines how to read a data file.
|
||||
#
|
||||
|
||||
@@ -360,15 +360,9 @@ module Jekyll
|
||||
end
|
||||
|
||||
def each_site_file
|
||||
seen_files = []
|
||||
%w(pages static_files_to_write docs_to_write).each do |type|
|
||||
send(type).each do |item|
|
||||
next if seen_files.include?(item)
|
||||
|
||||
yield item
|
||||
seen_files << item
|
||||
end
|
||||
end
|
||||
pages.each { |page| yield page }
|
||||
static_files.each { |file| yield(file) if file.write? }
|
||||
collections.each_value { |coll| coll.docs.each { |doc| yield(doc) if doc.write? } }
|
||||
end
|
||||
|
||||
# Returns the FrontmatterDefaults or creates a new FrontmatterDefaults
|
||||
|
||||
@@ -3,13 +3,10 @@
|
||||
module Jekyll
|
||||
class Stevenson < ::Logger
|
||||
def initialize
|
||||
@progname = nil
|
||||
@level = DEBUG
|
||||
@default_formatter = Formatter.new
|
||||
@logdev = $stdout
|
||||
@formatter = proc do |_, _, _, msg|
|
||||
formatter = proc do |_, _, _, msg|
|
||||
msg.to_s
|
||||
end
|
||||
super($stdout, :formatter => formatter)
|
||||
end
|
||||
|
||||
def add(severity, message = nil, progname = nil)
|
||||
|
||||
@@ -47,14 +47,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def mergable?(value)
|
||||
case value
|
||||
when Hash, Drops::Drop, DataHash
|
||||
true
|
||||
when DataEntry
|
||||
mergable?(value.data)
|
||||
else
|
||||
false
|
||||
end
|
||||
value.is_a?(Hash) || value.is_a?(Drops::Drop)
|
||||
end
|
||||
|
||||
def duplicable?(obj)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "4.3.0"
|
||||
VERSION = "4.3.3"
|
||||
end
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
true
|
||||
@@ -1,4 +0,0 @@
|
||||
- java
|
||||
- ruby
|
||||
- rust
|
||||
- golang
|
||||
5
test/source/_roles/named.md
Normal file
5
test/source/_roles/named.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
name: launcher
|
||||
---
|
||||
|
||||
`name` defined in front matter.
|
||||
4
test/source/_roles/unnamed.md
Normal file
4
test/source/_roles/unnamed.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
No `name` in front matter.
|
||||
@@ -1,34 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
||||
class TestDataEntry < JekyllUnitTest
|
||||
context "Data Entry" do
|
||||
setup do
|
||||
site = fixture_site
|
||||
site.read
|
||||
@data_hash = site.site_data
|
||||
end
|
||||
|
||||
should "expose underlying data object es Liquid representation" do
|
||||
subject = @data_hash["languages"]
|
||||
assert_equal Jekyll::DataEntry, subject.class
|
||||
assert_equal subject.data, subject.to_liquid
|
||||
end
|
||||
|
||||
should "respond to `#[](key)` when expected to but raise Exception otherwise" do
|
||||
greeting = @data_hash["greetings"]
|
||||
assert greeting["foo"]
|
||||
|
||||
boolean = @data_hash["boolean"] # the value is a Boolean.
|
||||
assert_raises(NoMethodError) { boolean["foo"] }
|
||||
end
|
||||
|
||||
should "compare with another instance of same class using underlying data" do
|
||||
assert_equal(
|
||||
[%w(java ruby), %w(java ruby rust golang)],
|
||||
[@data_hash["languages_plus"], @data_hash["languages"]].sort
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,57 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "helper"
|
||||
|
||||
class TestDataHash < JekyllUnitTest
|
||||
context "Data Hash" do
|
||||
setup do
|
||||
@site = fixture_site
|
||||
@site.read
|
||||
end
|
||||
|
||||
should "only mimic a ::Hash instance" do
|
||||
subject = @site.site_data
|
||||
assert_equal Jekyll::DataHash, subject.class
|
||||
refute subject.is_a?(Hash)
|
||||
|
||||
copy = subject.dup
|
||||
assert copy["greetings"]["foo"]
|
||||
assert_includes copy.dig("greetings", "foo"), "Hello!"
|
||||
|
||||
copy["greetings"] = "Hola!"
|
||||
assert_equal "Hola!", copy["greetings"]
|
||||
refute copy["greetings"]["foo"]
|
||||
|
||||
frozen_data_hash = Jekyll::DataHash.new.freeze
|
||||
assert_raises(FrozenError) { frozen_data_hash["lorem"] = "ipsum" }
|
||||
end
|
||||
|
||||
should "be mergable" do
|
||||
alpha = Jekyll::DataHash.new
|
||||
beta = Jekyll::DataHash.new
|
||||
|
||||
assert_equal "{}", alpha.inspect
|
||||
sample_data = { "foo" => "bar" }
|
||||
|
||||
assert_equal sample_data["foo"], alpha.merge(sample_data)["foo"]
|
||||
assert_equal alpha.class, alpha.merge(sample_data).class
|
||||
assert_empty alpha
|
||||
|
||||
beta.merge!(sample_data)
|
||||
assert_equal sample_data["foo"], alpha.merge(beta)["foo"]
|
||||
assert_equal alpha.class, alpha.merge(beta).class
|
||||
assert_empty alpha
|
||||
|
||||
beta.merge!(@site.site_data)
|
||||
assert_equal alpha.class, beta.class
|
||||
assert_includes beta.dig("greetings", "foo"), "Hello!"
|
||||
|
||||
assert_empty alpha
|
||||
assert_equal sample_data["foo"], Jekyll::Utils.deep_merge_hashes(alpha, sample_data)["foo"]
|
||||
assert_includes(
|
||||
Jekyll::Utils.deep_merge_hashes(alpha, beta).dig("greetings", "foo"),
|
||||
"Hello!"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -159,6 +159,23 @@ class TestDocument < JekyllUnitTest
|
||||
should "output its relative path as path in Liquid" do
|
||||
assert_equal "_methods/configuration.md", @document.to_liquid["path"]
|
||||
end
|
||||
|
||||
context "when rendered with Liquid" do
|
||||
should "respect the front matter definition" do
|
||||
site = fixture_site("collections" => ["roles"]).tap(&:process)
|
||||
docs = site.collections["roles"].docs
|
||||
|
||||
# Ruby context: doc.basename is aliased as doc.to_liquid["name"] by default.
|
||||
|
||||
document = docs.detect { |d| d.relative_path == "_roles/unnamed.md" }
|
||||
assert_equal "unnamed.md", document.basename
|
||||
assert_equal "unnamed.md", document.to_liquid["name"]
|
||||
|
||||
document = docs.detect { |d| d.relative_path == "_roles/named.md" }
|
||||
assert_equal "named.md", document.basename
|
||||
assert_equal "launcher", document.to_liquid["name"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "a document as part of a collection with front matter defaults" do
|
||||
|
||||
@@ -143,7 +143,7 @@ class TestFilters < JekyllUnitTest
|
||||
|
||||
should "sassify with simple string" do
|
||||
assert_equal(
|
||||
"p { color: #123456; }\n",
|
||||
"p {\n color: #123456;\n}",
|
||||
@filter.sassify(<<~SASS)
|
||||
$blue: #123456
|
||||
p
|
||||
@@ -154,7 +154,7 @@ class TestFilters < JekyllUnitTest
|
||||
|
||||
should "scssify with simple string" do
|
||||
assert_equal(
|
||||
"p { color: #123456; }\n",
|
||||
"p {\n color: #123456;\n}",
|
||||
@filter.scssify("$blue:#123456; p{color: $blue}")
|
||||
)
|
||||
end
|
||||
@@ -718,7 +718,7 @@ class TestFilters < JekyllUnitTest
|
||||
{
|
||||
"name" => name,
|
||||
:v => 1,
|
||||
:thing => M.new(:kay => "jewelers"),
|
||||
:thing => M.new({:kay => "jewelers"}),
|
||||
:stuff => true,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -15,7 +15,9 @@ class TestSass < JekyllUnitTest
|
||||
|
||||
should "import SCSS partial" do
|
||||
result = <<~CSS
|
||||
.half { width: 50%; }
|
||||
.half {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=main.css.map */
|
||||
CSS
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestThemeAssetsReader < JekyllUnitTest
|
||||
file = @site.pages.find { |f| f.relative_path == "assets/style.scss" }
|
||||
refute_nil file
|
||||
assert_equal @site.in_dest_dir("assets/style.css"), file.destination(@site.dest)
|
||||
assert_includes file.output, ".sample { color: black; }"
|
||||
assert_includes file.output, ".sample {\n color: black;\n}"
|
||||
end
|
||||
|
||||
should "not overwrite site content with the same relative path" do
|
||||
|
||||
Reference in New Issue
Block a user