From 6792ff936c987972ec686d749647675d91dcd593 Mon Sep 17 00:00:00 2001 From: Philip Belesky Date: Mon, 21 May 2018 02:30:15 +1000 Subject: [PATCH 1/4] Fix --unpublished not affecting collection documents (#7027) Merge pull request 7027 --- features/collections.feature | 98 ++++++++++++++++++++++++++++++++++++ lib/jekyll/collection.rb | 4 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/features/collections.feature b/features/collections.feature index 33a01ade..03f10dc1 100644 --- a/features/collections.feature +++ b/features/collections.feature @@ -263,6 +263,104 @@ Feature: Collections And the "_site/puppies/snowy.html" file should not exist And the "_site/puppies/hardy.html" file should not exist + Scenario: Access rendered collection with future date and unpublished flag via Liquid + Given I have a _puppies directory + And I have the following documents under the puppies collection: + | title | date | content | published | + | Rover | 2007-12-31 | content for Rover. | true | + | Figor | 2007-12-31 | content for Figor. | false | + | Snowy | 2199-12-31 | content for Snowy. | true | + | Hardy | 2199-12-31 | content for Hardy. | false | + And I have a "_config.yml" file with content: + """ + collections: + puppies: + output: true + """ + And I have a "index.md" page that contains "{% for puppy in site.puppies %}
{{ puppy.title }}
{% endfor %}" + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + But I should see "
Snowy
" in "_site/index.html" + And I should not see "
Figor
" in "_site/index.html" + And I should not see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should exist + And the "_site/puppies/snowy.html" file should not exist + And the "_site/puppies/figor.html" file should not exist + And the "_site/puppies/hardy.html" file should not exist + When I run jekyll build --unpublished + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + And I should see "
Snowy
" in "_site/index.html" + And I should see "
Figor
" in "_site/index.html" + But I should see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should exist + And the "_site/puppies/snowy.html" file should not exist + And the "_site/puppies/figor.html" file should exist + And the "_site/puppies/hardy.html" file should not exist + When I run jekyll build --unpublished --future + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + And I should see "
Snowy
" in "_site/index.html" + And I should see "
Figor
" in "_site/index.html" + But I should see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should exist + And the "_site/puppies/snowy.html" file should exist + And the "_site/puppies/figor.html" file should exist + And the "_site/puppies/hardy.html" file should exist + + Scenario: Access unrendered collection with future date and unpublished flag via Liquid + Given I have a _puppies directory + And I have the following documents under the puppies collection: + | title | date | content | published | + | Rover | 2007-12-31 | content for Rover. | true | + | Figor | 2007-12-31 | content for Figor. | false | + | Snowy | 2199-12-31 | content for Snowy. | true | + | Hardy | 2199-12-31 | content for Hardy. | false | + And I have a "_config.yml" file with content: + """ + collections: + puppies: + output: false + """ + And I have a "index.md" page that contains "{% for puppy in site.puppies %}
{{ puppy.title }}
{% endfor %}" + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + But I should see "
Snowy
" in "_site/index.html" + And I should not see "
Figor
" in "_site/index.html" + And I should not see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should not exist + And the "_site/puppies/snowy.html" file should not exist + And the "_site/puppies/figor.html" file should not exist + And the "_site/puppies/hardy.html" file should not exist + When I run jekyll build --unpublished + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + And I should see "
Snowy
" in "_site/index.html" + And I should see "
Figor
" in "_site/index.html" + But I should see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should not exist + And the "_site/puppies/snowy.html" file should not exist + And the "_site/puppies/figor.html" file should not exist + And the "_site/puppies/hardy.html" file should not exist + When I run jekyll build --unpublished --future + Then I should get a zero exit status + And the _site directory should exist + And I should see "
Rover
" in "_site/index.html" + And I should see "
Snowy
" in "_site/index.html" + And I should see "
Figor
" in "_site/index.html" + But I should see "
Hardy
" in "_site/index.html" + And the "_site/puppies/rover.html" file should not exist + And the "_site/puppies/snowy.html" file should not exist + And the "_site/puppies/figor.html" file should not exist + And the "_site/puppies/hardy.html" file should not exist + Scenario: All the documents Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}" And I have fixture collections diff --git a/lib/jekyll/collection.rb b/lib/jekyll/collection.rb index bdfa4b86..4a8b6f53 100644 --- a/lib/jekyll/collection.rb +++ b/lib/jekyll/collection.rb @@ -212,7 +212,9 @@ module Jekyll def read_document(full_path) doc = Document.new(full_path, :site => site, :collection => self) doc.read - docs << doc unless doc.data["published"] == false + if site.unpublished || doc.published? + docs << doc + end end private From 03c252ba4d659c6758f39e96507e38820fba2189 Mon Sep 17 00:00:00 2001 From: jekyllbot Date: Sun, 20 May 2018 12:30:17 -0400 Subject: [PATCH 2/4] Update history to reflect merge of #7027 [ci skip] --- History.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/History.markdown b/History.markdown index 64f743f5..b50563f8 100644 --- a/History.markdown +++ b/History.markdown @@ -1,3 +1,9 @@ +## HEAD + +### Bug Fixes + + * Fix --unpublished not affecting collection documents (#7027) + ## 3.8.2 / 2018-05-18 ### Development Fixes From 5687a092554599e8c2cf1247764a7eaf87f3d05f Mon Sep 17 00:00:00 2001 From: Pat Hawks Date: Mon, 4 Jun 2018 21:39:43 -0500 Subject: [PATCH 3/4] Release :gem: 3.8.3 --- History.markdown | 2 +- docs/_config.yml | 2 +- docs/_docs/history.md | 9 +++++++++ .../2018-06-04-jekyll-3-8-3-released.markdown | 13 +++++++++++++ docs/latest_version.txt | 2 +- lib/jekyll/version.rb | 2 +- 6 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 docs/_posts/2018-06-04-jekyll-3-8-3-released.markdown diff --git a/History.markdown b/History.markdown index b50563f8..7c5bdb82 100644 --- a/History.markdown +++ b/History.markdown @@ -1,4 +1,4 @@ -## HEAD +## 3.8.3 / 2018-06-05 ### Bug Fixes diff --git a/docs/_config.yml b/docs/_config.yml index e608b1b6..27ad51ff 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,5 +1,5 @@ --- -version: 3.8.2 +version: 3.8.3 name: Jekyll • Simple, blog-aware, static sites description: Transform your plain text into static websites and blogs url: https://jekyllrb.com diff --git a/docs/_docs/history.md b/docs/_docs/history.md index 4a9faf7f..1e6c14d8 100644 --- a/docs/_docs/history.md +++ b/docs/_docs/history.md @@ -4,6 +4,15 @@ permalink: "/docs/history/" note: This file is autogenerated. Edit /History.markdown instead. --- +## 3.8.3 / 2018-06-05 +{: #v3-8-3} + +### Bug Fixes +{: #bug-fixes-v3-8-3} + +- Fix --unpublished not affecting collection documents ([#7027]({{ site.repository }}/issues/7027)) + + ## 3.8.2 / 2018-05-18 {: #v3-8-2} diff --git a/docs/_posts/2018-06-04-jekyll-3-8-3-released.markdown b/docs/_posts/2018-06-04-jekyll-3-8-3-released.markdown new file mode 100644 index 00000000..5678b0ad --- /dev/null +++ b/docs/_posts/2018-06-04-jekyll-3-8-3-released.markdown @@ -0,0 +1,13 @@ +--- +title: 'Jekyll 3.8.3 Released' +date: 2018-06-05 09:00:00 -0500 +author: pathawks +version: 3.8.3 +categories: [release] +--- + +This release fixes a regression in 3.8 where collections with `published: false` +do not show when using the `--unpublished` flag. + +Thanks to @philipbelesky for reporting and fixing this issue; collections with +`published: false` now behave the same way as Posts. diff --git a/docs/latest_version.txt b/docs/latest_version.txt index a08ffae0..269aa9c8 100644 --- a/docs/latest_version.txt +++ b/docs/latest_version.txt @@ -1 +1 @@ -3.8.2 +3.8.3 diff --git a/lib/jekyll/version.rb b/lib/jekyll/version.rb index 0a6a8a2d..9a62ec6f 100644 --- a/lib/jekyll/version.rb +++ b/lib/jekyll/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Jekyll - VERSION = "3.8.2".freeze + VERSION = "3.8.3".freeze end