Merge pull request #4373 from jekyll/page-as-renderable

Merge pull request 4373
This commit is contained in:
jekyllbot 2016-01-18 15:00:46 -08:00
commit c5830ce6e0
33 changed files with 463 additions and 242 deletions

View File

@ -8,7 +8,8 @@ Feature: Collections
And I have fixture collections And I have fixture collections
And I have a configuration file with "collections" set to "['methods']" And I have a configuration file with "collections" set to "['methods']"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>\n<p>Signs are nice</p>\n<p><code class=\"highlighter-rouge\">Jekyll.sanitized_path</code> is used to make sure your path is in your source.</p>\n<p>Run your generators! default</p>\n<p>Page without title.</p>\n<p>Run your generators! default</p>" in "_site/index.html" And I should see "Collections: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>\n<p>Signs are nice</p>\n<p><code class=\"highlighter-rouge\">Jekyll.sanitized_path</code> is used to make sure your path is in your source.</p>\n<p>Run your generators! default</p>\n<p>Page without title.</p>\n<p>Run your generators! default</p>" in "_site/index.html"
And the "_site/methods/configuration.html" file should not exist And the "_site/methods/configuration.html" file should not exist
@ -24,7 +25,8 @@ Feature: Collections
foo: bar foo: bar
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: output => true" in "_site/index.html" And I should see "Collections: output => true" in "_site/index.html"
And I should see "label => methods" in "_site/index.html" And I should see "label => methods" in "_site/index.html"
And I should see "Methods metadata: bar" in "_site/collection_metadata.html" And I should see "Methods metadata: bar" in "_site/collection_metadata.html"
@ -41,7 +43,8 @@ Feature: Collections
permalink: /:collection/:path/ permalink: /:collection/:path/
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<p>Whatever: foo.bar</p>" in "_site/methods/configuration/index.html" And I should see "<p>Whatever: foo.bar</p>" in "_site/methods/configuration/index.html"
Scenario: Rendered document in a layout Scenario: Rendered document in a layout
@ -56,7 +59,8 @@ Feature: Collections
foo: bar foo: bar
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: output => true" in "_site/index.html" And I should see "Collections: output => true" in "_site/index.html"
And I should see "label => methods" in "_site/index.html" And I should see "label => methods" in "_site/index.html"
And I should see "foo => bar" in "_site/index.html" And I should see "foo => bar" in "_site/index.html"
@ -72,7 +76,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: Collections specified as an hash Scenario: Collections specified as an hash
@ -84,7 +89,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: All the documents Scenario: All the documents
@ -96,7 +102,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "All documents: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html" And I should see "All documents: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: Documents have an output attribute, which is the converted HTML Scenario: Documents have an output attribute, which is the converted HTML
@ -108,7 +115,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "First document's output: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>" in "_site/index.html" And I should see "First document's output: <p>Use <code class=\"highlighter-rouge\">Jekyll.configuration</code> to build a full configuration for use w/Jekyll.</p>\n\n<p>Whatever: foo.bar</p>" in "_site/index.html"
Scenario: Filter documents by where Scenario: Filter documents by where
@ -120,7 +128,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Item count: 2" in "_site/index.html" And I should see "Item count: 2" in "_site/index.html"
Scenario: Sort by title Scenario: Sort by title
@ -132,7 +141,8 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "1. of 7: <p>Page without title.</p>" in "_site/index.html" And I should see "1. of 7: <p>Page without title.</p>" in "_site/index.html"
Scenario: Sort by relative_path Scenario: Sort by relative_path
@ -144,5 +154,6 @@ Feature: Collections
- methods - methods
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, , Site#generate," in "_site/index.html" And I should see "Collections: Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, , Site#generate," in "_site/index.html"

View File

@ -13,7 +13,8 @@ Feature: Create sites
Scenario: Basic site Scenario: Basic site
Given I have an "index.html" file that contains "Basic Site" Given I have an "index.html" file that contains "Basic Site"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site" in "_site/index.html" And I should see "Basic Site" in "_site/index.html"
Scenario: Basic site with a post Scenario: Basic site with a post
@ -22,7 +23,8 @@ Feature: Create sites
| title | date | content | | title | date | content |
| Hackers | 2009-03-27 | My First Exploit | | Hackers | 2009-03-27 | My First Exploit |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "My First Exploit" in "_site/2009/03/27/hackers.html" And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
Scenario: Basic site with layout and a page Scenario: Basic site with layout and a page
@ -30,7 +32,8 @@ Feature: Create sites
And I have an "index.html" page with layout "default" that contains "Basic Site with Layout" And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
And I have a default layout that contains "Page Layout: {{ content }}" And I have a default layout that contains "Page Layout: {{ content }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
Scenario: Basic site with layout and a post Scenario: Basic site with layout and a post
@ -41,7 +44,8 @@ Feature: Create sites
| Wargames | 2009-03-27 | default | The only winning move is not to play. | | Wargames | 2009-03-27 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}" And I have a default layout that contains "Post Layout: {{ content }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html" And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layout inside a subfolder and a post Scenario: Basic site with layout inside a subfolder and a post
@ -52,7 +56,8 @@ Feature: Create sites
| Wargames | 2009-03-27 | post/simple | The only winning move is not to play. | | Wargames | 2009-03-27 | post/simple | The only winning move is not to play. |
And I have a post/simple layout that contains "Post Layout: {{ content }}" And I have a post/simple layout that contains "Post Layout: {{ content }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html" And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layouts, pages, posts and files Scenario: Basic site with layouts, pages, posts and files
@ -75,7 +80,8 @@ Feature: Create sites
| entry3 | 2009-05-27 | post | content for entry3. | | entry3 | 2009-05-27 | post | content for entry3. |
| entry4 | 2009-06-27 | post | content for entry4. | | entry4 | 2009-06-27 | post | content for entry4. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html" And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html" And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
And I should see "" in "_site/another_file" And I should see "" in "_site/another_file"
@ -90,7 +96,8 @@ Feature: Create sites
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
And I have an "_includes/about.textile" file that contains "Generated by Jekyll" And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with subdir include tag Scenario: Basic site with subdir include tag
@ -99,7 +106,8 @@ Feature: Create sites
And I have an info directory And I have an info directory
And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}" And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html" And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html"
Scenario: Basic site with nested include tag Scenario: Basic site with nested include tag
@ -108,7 +116,8 @@ Feature: Create sites
And I have an "_includes/jekyll.textile" file that contains "Jekyll" And I have an "_includes/jekyll.textile" file that contains "Jekyll"
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with internal post linking Scenario: Basic site with internal post linking
@ -120,19 +129,22 @@ Feature: Create sites
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2008-01-01 | post | content for entry2. | | entry2 | 2008-01-01 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "URL: /2008/01/01/entry2/" in "_site/index.html" And I should see "URL: /2008/01/01/entry2/" in "_site/index.html"
Scenario: Basic site with whitelisted dotfile Scenario: Basic site with whitelisted dotfile
Given I have an ".htaccess" file that contains "SomeDirective" Given I have an ".htaccess" file that contains "SomeDirective"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "SomeDirective" in "_site/.htaccess" And I should see "SomeDirective" in "_site/.htaccess"
Scenario: File was replaced by a directory Scenario: File was replaced by a directory
Given I have a "test" file that contains "some stuff" Given I have a "test" file that contains "some stuff"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
When I delete the file "test" When I delete the file "test"
Given I have a test directory Given I have a test directory
And I have a "test/index.html" file that contains "some other stuff" And I have a "test/index.html" file that contains "some other stuff"
@ -146,13 +158,15 @@ Feature: Create sites
And I have a "secret.html" page with published "false" that contains "Unpublished page" And I have a "secret.html" page with published "false" that contains "Unpublished page"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.html" file should exist And the "_site/index.html" file should exist
And the "_site/public.html" file should exist And the "_site/public.html" file should exist
But the "_site/secret.html" file should not exist But the "_site/secret.html" file should not exist
When I run jekyll build --unpublished When I run jekyll build --unpublished
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.html" file should exist And the "_site/index.html" file should exist
And the "_site/public.html" file should exist And the "_site/public.html" file should exist
And the "_site/secret.html" file should exist And the "_site/secret.html" file should exist
@ -164,9 +178,11 @@ Feature: Create sites
| entry1 | 2020-12-31 | post | content for entry1. | | entry1 | 2020-12-31 | post | content for entry1. |
| entry2 | 2007-12-31 | post | content for entry2. | | entry2 | 2007-12-31 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "content for entry2" in "_site/2007/12/31/entry2.html" And I should see "content for entry2" in "_site/2007/12/31/entry2.html"
And the "_site/2020/12/31/entry1.html" file should not exist And the "_site/2020/12/31/entry1.html" file should not exist
When I run jekyll build --future When I run jekyll build --future
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/2020/12/31/entry1.html" file should exist And the "_site/2020/12/31/entry1.html" file should exist

View File

@ -10,7 +10,8 @@ Feature: Draft Posts
| title | date | layout | content | | title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. | | Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll build --drafts When I run jekyll build --drafts
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Not baked yet." in "_site/recipe.html" And I should see "Not baked yet." in "_site/recipe.html"
Scenario: Don't preview a draft Scenario: Don't preview a draft
@ -21,7 +22,8 @@ Feature: Draft Posts
| title | date | layout | content | | title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. | | Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/recipe.html" file should not exist And the "_site/recipe.html" file should not exist
Scenario: Don't preview a draft that is not published Scenario: Don't preview a draft that is not published
@ -32,7 +34,8 @@ Feature: Draft Posts
| title | date | layout | published | content | | title | date | layout | published | content |
| Recipe | 2009-03-27 | default | false | Not baked yet. | | Recipe | 2009-03-27 | default | false | Not baked yet. |
When I run jekyll build --drafts When I run jekyll build --drafts
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/recipe.html" file should not exist And the "_site/recipe.html" file should not exist
Scenario: Use page.path variable Scenario: Use page.path variable
@ -42,5 +45,6 @@ Feature: Draft Posts
| title | date | layout | content | | title | date | layout | content |
| Recipe | 2009-03-27 | simple | Post path: {{ page.path }} | | Recipe | 2009-03-27 | simple | Post path: {{ page.path }} |
When I run jekyll build --drafts When I run jekyll build --drafts
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post path: _drafts/recipe.markdown" in "_site/recipe.html" And I should see "Post path: _drafts/recipe.markdown" in "_site/recipe.html"

View File

@ -11,7 +11,8 @@ Feature: Embed filters
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ site.time | date_to_xmlschema }}" And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see today's date in "_site/2009/03/27/star-wars.html" And I should see today's date in "_site/2009/03/27/star-wars.html"
Scenario: Escape text for XML Scenario: Escape text for XML
@ -22,7 +23,8 @@ Feature: Embed filters
| Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. | | Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.title | xml_escape }}" And I have a default layout that contains "{{ page.title | xml_escape }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Star &amp; Wars" in "_site/2009/03/27/star-wars.html" And I should see "Star &amp; Wars" in "_site/2009/03/27/star-wars.html"
Scenario: Calculate number of words Scenario: Calculate number of words
@ -33,7 +35,8 @@ Feature: Embed filters
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ content | number_of_words }}" And I have a default layout that contains "{{ content | number_of_words }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "7" in "_site/2009/03/27/star-wars.html" And I should see "7" in "_site/2009/03/27/star-wars.html"
Scenario: Convert an array into a sentence Scenario: Convert an array into a sentence
@ -44,7 +47,8 @@ Feature: Embed filters
| Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. | | Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}" And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html" And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
Scenario: Markdownify a given string Scenario: Markdownify a given string
@ -55,7 +59,8 @@ Feature: Embed filters
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "By {{ '_Obi-wan_' | markdownify }}" And I have a default layout that contains "By {{ '_Obi-wan_' | markdownify }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "By <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html" And I should see "By <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html"
Scenario: Sort by an arbitrary variable Scenario: Sort by an arbitrary variable
@ -68,38 +73,37 @@ Feature: Embed filters
| Page-2 | default | 6 | Something | | Page-2 | default | 6 | Something |
And I have a default layout that contains "{{ site.pages | sort:'value' | map:'title' | join:', ' }}" And I have a default layout that contains "{{ site.pages | sort:'value' | map:'title' | join:', ' }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "Page-2, Page-1" in "_site/page-1.html" And I should see exactly "Page-2, Page-1" in "_site/page-1.html"
And I should see exactly "Page-2, Page-1" in "_site/page-2.html" And I should see exactly "Page-2, Page-1" in "_site/page-2.html"
Scenario: Sort pages by the title Scenario: Sort pages by the title
Given I have a _layouts directory Given I have a _layouts directory
And I have the following page: And I have the following pages:
| title | layout | content | | title | layout | content |
| Dog | default | Run | | Dog | default | Run |
And I have the following page:
| title | layout | content |
| Bird | default | Fly | | Bird | default | Fly |
And I have the following page: And I have the following page:
| layout | content | | layout | content |
| default | Jump | | default | Jump |
And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}" And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "The rule of 3: Jump, Fly, Run," in "_site/bird.html" And I should see exactly "The rule of 3: Jump, Fly, Run," in "_site/bird.html"
Scenario: Sort pages by the title ordering pages without title last Scenario: Sort pages by the title ordering pages without title last
Given I have a _layouts directory Given I have a _layouts directory
And I have the following page: And I have the following pages:
| title | layout | content | | title | layout | content |
| Dog | default | Run | | Dog | default | Run |
And I have the following page:
| title | layout | content |
| Bird | default | Fly | | Bird | default | Fly |
And I have the following page: And I have the following page:
| layout | content | | layout | content |
| default | Jump | | default | Jump |
And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title', 'last' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}" And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title', 'last' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "The rule of 3: Fly, Run, Jump," in "_site/bird.html" And I should see exactly "The rule of 3: Fly, Run, Jump," in "_site/bird.html"

View File

@ -12,7 +12,8 @@ Feature: frontmatter defaults
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {layout: "pretty"}}]" And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {layout: "pretty"}}]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "THIS IS THE LAYOUT: <p>just some post</p>" in "_site/2013/09/11/default-layout.html" And I should see "THIS IS THE LAYOUT: <p>just some post</p>" in "_site/2013/09/11/default-layout.html"
And I should see "THIS IS THE LAYOUT: just some page" in "_site/index.html" And I should see "THIS IS THE LAYOUT: just some page" in "_site/index.html"
@ -24,7 +25,8 @@ Feature: frontmatter defaults
And I have an "index.html" page that contains "just {{page.custom}} by {{page.author}}" And I have an "index.html" page that contains "just {{page.custom}} by {{page.author}}"
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {custom: "some special data", author: "Ben"}}]" And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {custom: "some special data", author: "Ben"}}]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<p>some special data</p>\n<div>Ben</div>" in "_site/2013/09/11/default-data.html" And I should see "<p>some special data</p>\n<div>Ben</div>" in "_site/2013/09/11/default-data.html"
And I should see "just some special data by Ben" in "_site/index.html" And I should see "just some special data by Ben" in "_site/index.html"
@ -48,7 +50,8 @@ Feature: frontmatter defaults
And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "subfolder", description: "the special section"}}, {scope: {path: ""}, values: {layout: "root", description: "the webpage"}}]" And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "subfolder", description: "the special section"}}, {scope: {path: ""}, values: {layout: "root", description: "the webpage"}}]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "root: <p>info on the webpage</p>" in "_site/2013/10/14/about.html" And I should see "root: <p>info on the webpage</p>" in "_site/2013/10/14/about.html"
And I should see "subfolder: <p>info on the special section</p>" in "_site/special/2013/10/14/about.html" And I should see "subfolder: <p>info on the special section</p>" in "_site/special/2013/10/14/about.html"
And I should see "root: Overview for the webpage" in "_site/index.html" And I should see "root: Overview for the webpage" in "_site/index.html"
@ -71,7 +74,8 @@ Feature: frontmatter defaults
And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "main"}}, {scope: {path: "special/_posts"}, values: {layout: "main"}}, {scope: {path: "_posts"}, values: {layout: "main"}}]" And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "main"}}, {scope: {path: "special/_posts"}, values: {layout: "main"}}, {scope: {path: "_posts"}, values: {layout: "main"}}]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "main: <p>content of site/2013/10/14/about.html</p>" in "_site/2013/10/14/about.html" And I should see "main: <p>content of site/2013/10/14/about.html</p>" in "_site/2013/10/14/about.html"
And I should see "main: <p>content of site/special/2013/10/14/about1.html</p>" in "_site/special/2013/10/14/about1.html" And I should see "main: <p>content of site/special/2013/10/14/about1.html</p>" in "_site/special/2013/10/14/about1.html"
And I should see "main: <p>content of site/special/2013/10/14/about2.html</p>" in "_site/special/2013/10/14/about2.html" And I should see "main: <p>content of site/special/2013/10/14/about2.html</p>" in "_site/special/2013/10/14/about2.html"
@ -132,7 +136,8 @@ Feature: frontmatter defaults
myval: "Test" myval: "Test"
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Value: Test" in "_site/slides/slide1.html" And I should see "Value: Test" in "_site/slides/slide1.html"
Scenario: Override frontmatter defaults inside a collection Scenario: Override frontmatter defaults inside a collection
@ -159,7 +164,8 @@ Feature: frontmatter defaults
myval: "Test" myval: "Test"
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Value: Override" in "_site/slides/slide2.html" And I should see "Value: Override" in "_site/slides/slide2.html"
Scenario: Deep merge frontmatter defaults Scenario: Deep merge frontmatter defaults

View File

@ -24,7 +24,8 @@ Feature: Hooks
end end
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "mytinypage" in "_site/foo.html" And I should see "mytinypage" in "_site/foo.html"
Scenario: Modify the payload before rendering the site Scenario: Modify the payload before rendering the site
@ -37,7 +38,8 @@ Feature: Hooks
end end
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "myparam!" in "_site/index.html" And I should see "myparam!" in "_site/index.html"
Scenario: Modify the site contents after reading Scenario: Modify the site contents after reading
@ -51,7 +53,8 @@ Feature: Hooks
end end
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/page1.html" file should not exist And the "_site/page1.html" file should not exist
And I should see "page2" in "_site/page2.html" And I should see "page2" in "_site/page2.html"
@ -67,7 +70,8 @@ Feature: Hooks
""" """
And I have a "page1.html" page that contains "page1" And I have a "page1.html" page that contains "page1"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "page1" in "_site/firstpage.html" And I should see "page1" in "_site/firstpage.html"
Scenario: Alter a page right after it is initialized Scenario: Alter a page right after it is initialized
@ -81,7 +85,8 @@ Feature: Hooks
""" """
And I have a "page1.html" page that contains "page1" And I have a "page1.html" page that contains "page1"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "page1" in "_site/renamed.html" And I should see "page1" in "_site/renamed.html"
Scenario: Alter the payload for one page but not another Scenario: Alter the payload for one page but not another
@ -138,7 +143,8 @@ Feature: Hooks
| title | date | layout | content | | title | date | layout | content |
| entry1 | 2015-03-14 | nil | {{ page.harold }} | | entry1 | 2015-03-14 | nil | {{ page.harold }} |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "pbagrag sbe ragel1." in "_site/2015/03/14/entry1.html" And I should see "pbagrag sbe ragel1." in "_site/2015/03/14/entry1.html"
Scenario: Alter the payload for certain posts Scenario: Alter the payload for certain posts
@ -268,7 +274,8 @@ Feature: Hooks
{{ site.memes.first.text }} {{ site.memes.first.text }}
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "all your base are belong to us" in "_site/index.html" And I should see "all your base are belong to us" in "_site/index.html"
Scenario: Update a document after rendering it, but before writing it to disk Scenario: Update a document after rendering it, but before writing it to disk
@ -294,7 +301,8 @@ Feature: Hooks
{{ page.text }} {{ page.text }}
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<p class=\"meme\">all your base are belong to us" in "_site/memes/doc1.html" And I should see "<p class=\"meme\">all your base are belong to us" in "_site/memes/doc1.html"
Scenario: Perform an action after every document is written Scenario: Perform an action after every document is written
@ -322,5 +330,6 @@ Feature: Hooks
{{ page.text }} {{ page.text }}
""" """
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Wrote document 0" in "_site/document-build.log" And I should see "Wrote document 0" in "_site/document-build.log"

View File

@ -19,7 +19,8 @@ Feature: Include tags
| Parameter syntax | 2013-04-12 | html | {% include params.html param1_or_2="value" %} | | Parameter syntax | 2013-04-12 | html | {% include params.html param1_or_2="value" %} |
| Pass a variable | 2013-06-22 | html | {% assign var = 'some text' %}{% include params.html local=var title=page.title %} | | Pass a variable | 2013-06-22 | html | {% assign var = 'some text' %}{% include params.html local=var title=page.title %} |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<header>My awesome blog header: myparam</header>" in "_site/2013/03/21/include-files.html" And I should see "<header>My awesome blog header: myparam</header>" in "_site/2013/03/21/include-files.html"
And I should not see "myparam" in "_site/2013/03/21/ignore-params-if-unused.html" And I should not see "myparam" in "_site/2013/03/21/ignore-params-if-unused.html"
And I should see "<li>date = today</li>" in "_site/2013/03/21/list-multiple-parameters.html" And I should see "<li>date = today</li>" in "_site/2013/03/21/list-multiple-parameters.html"
@ -44,7 +45,8 @@ Feature: Include tags
| include_file2 | parametrized.html | | include_file2 | parametrized.html |
And I have an "index.html" page that contains "{% include {{site.include_file1}} %} that {% include {{site.include_file2}} what='parameters' %}" And I have an "index.html" page that contains "{% include {{site.include_file1}} %} that {% include {{site.include_file2}} what='parameters' %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "a snippet that works with parameters" in "_site/index.html" And I should see "a snippet that works with parameters" in "_site/index.html"
Scenario: Include a variable file in a loop Scenario: Include a variable file in a loop
@ -53,7 +55,8 @@ Feature: Include tags
And I have an "_includes/two.html" file that contains "two" And I have an "_includes/two.html" file that contains "two"
And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}" And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "one two" in "_site/index.html" And I should see "one two" in "_site/index.html"
Scenario: Include a file with variables and filters Scenario: Include a file with variables and filters
@ -64,7 +67,8 @@ Feature: Include tags
| include_file | one | | include_file | one |
And I have an "index.html" page that contains "{% include {{ site.include_file | append: '.html' }} %}" And I have an "index.html" page that contains "{% include {{ site.include_file | append: '.html' }} %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "one included" in "_site/index.html" And I should see "one included" in "_site/index.html"
Scenario: Include a file with partial variables Scenario: Include a file with partial variables
@ -75,7 +79,8 @@ Feature: Include tags
| include_file | one | | include_file | one |
And I have an "index.html" page that contains "{% include {{ site.include_file }}.html %}" And I have an "index.html" page that contains "{% include {{ site.include_file }}.html %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "one included" in "_site/index.html" And I should see "one included" in "_site/index.html"
Scenario: Include a file and rebuild when include content is changed Scenario: Include a file and rebuild when include content is changed
@ -83,7 +88,8 @@ Feature: Include tags
And I have an "_includes/one.html" file that contains "include" And I have an "_includes/one.html" file that contains "include"
And I have an "index.html" page that contains "{% include one.html %}" And I have an "index.html" page that contains "{% include one.html %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "include" in "_site/index.html" And I should see "include" in "_site/index.html"
When I wait 1 second When I wait 1 second
Then I have an "_includes/one.html" file that contains "include content changed" Then I have an "_includes/one.html" file that contains "include content changed"
@ -95,5 +101,6 @@ Feature: Include tags
And I have an "_includes/header-en.html" file that contains "include" And I have an "_includes/header-en.html" file that contains "include"
And I have an "index.html" page that contains "{% assign name = 'header' %}{% assign locale = 'en' %}{% include {{name}}-{{locale}}.html %}" And I have an "index.html" page that contains "{% assign name = 'header' %}{% assign locale = 'en' %}{% include {{name}}-{{locale}}.html %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "include" in "_site/index.html" And I should see "include" in "_site/index.html"

View File

@ -11,10 +11,12 @@ Feature: Incremental rebuild
| Wargames | 2009-03-27 | default | The only winning move is not to play. | | Wargames | 2009-03-27 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}" And I have a default layout that contains "Post Layout: {{ content }}"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html" And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html" And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
Scenario: Generate a metadata file Scenario: Generate a metadata file
@ -25,12 +27,14 @@ Feature: Incremental rebuild
Scenario: Rebuild when content is changed Scenario: Rebuild when content is changed
Given I have an "index.html" file that contains "Basic Site" Given I have an "index.html" file that contains "Basic Site"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site" in "_site/index.html" And I should see "Basic Site" in "_site/index.html"
When I wait 1 second When I wait 1 second
Then I have an "index.html" file that contains "Bacon Site" Then I have an "index.html" file that contains "Bacon Site"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Bacon Site" in "_site/index.html" And I should see "Bacon Site" in "_site/index.html"
Scenario: Rebuild when layout is changed Scenario: Rebuild when layout is changed
@ -38,12 +42,14 @@ Feature: Incremental rebuild
And I have an "index.html" page with layout "default" that contains "Basic Site with Layout" And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
And I have a default layout that contains "Page Layout: {{ content }}" And I have a default layout that contains "Page Layout: {{ content }}"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
When I wait 1 second When I wait 1 second
Then I have a default layout that contains "Page Layout Changed: {{ content }}" Then I have a default layout that contains "Page Layout Changed: {{ content }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout Changed: Basic Site with Layout" in "_site/index.html" And I should see "Page Layout Changed: Basic Site with Layout" in "_site/index.html"
Scenario: Rebuild when an include is changed Scenario: Rebuild when an include is changed
@ -51,10 +57,12 @@ Feature: Incremental rebuild
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
And I have an "_includes/about.textile" file that contains "Generated by Jekyll" And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
When I wait 1 second When I wait 1 second
Then I have an "_includes/about.textile" file that contains "Regenerated by Jekyll" Then I have an "_includes/about.textile" file that contains "Regenerated by Jekyll"
When I run jekyll build -I When I run jekyll build -I
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html" And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"

View File

@ -11,7 +11,8 @@ Feature: Markdown
| title | date | content | type | | title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown | | Hackers | 2009-03-27 | # My Title | markdown |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Index" in "_site/index.html" And I should see "Index" in "_site/index.html"
And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/2009/03/27/hackers.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/2009/03/27/hackers.html"
And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html"
@ -27,6 +28,7 @@ Feature: Markdown
| title | date | content | type | | title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown | | Hackers | 2009-03-27 | # My Title | markdown |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Index" in "_site/index.html" And I should see "Index" in "_site/index.html"
And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html"

View File

@ -10,7 +10,8 @@ Feature: Fancy permalinks
| None Permalink Schema | 2009-03-27 | Totally nothing. | | None Permalink Schema | 2009-03-27 | Totally nothing. |
And I have a configuration file with "permalink" set to "none" And I have a configuration file with "permalink" set to "none"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally nothing." in "_site/none-permalink-schema.html" And I should see "Totally nothing." in "_site/none-permalink-schema.html"
Scenario: Use pretty permalink schema Scenario: Use pretty permalink schema
@ -20,7 +21,8 @@ Feature: Fancy permalinks
| Pretty Permalink Schema | 2009-03-27 | Totally wordpress. | | Pretty Permalink Schema | 2009-03-27 | Totally wordpress. |
And I have a configuration file with "permalink" set to "pretty" And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html" And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
Scenario: Use pretty permalink schema for pages Scenario: Use pretty permalink schema for pages
@ -29,7 +31,8 @@ Feature: Fancy permalinks
And I have an "sitemap.xml" page that contains "Totally uhm, sitemap" And I have an "sitemap.xml" page that contains "Totally uhm, sitemap"
And I have a configuration file with "permalink" set to "pretty" And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally index" in "_site/index.html" And I should see "Totally index" in "_site/index.html"
And I should see "Totally awesome" in "_site/awesome/index.html" And I should see "Totally awesome" in "_site/awesome/index.html"
And I should see "Totally uhm, sitemap" in "_site/sitemap.xml" And I should see "Totally uhm, sitemap" in "_site/sitemap.xml"
@ -41,7 +44,8 @@ Feature: Fancy permalinks
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title/" And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title/"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html" And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html"
Scenario: Use custom permalink schema with category Scenario: Use custom permalink schema with category
@ -51,7 +55,8 @@ Feature: Fancy permalinks
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/:categories/:title.html" And I have a configuration file with "permalink" set to "/:categories/:title.html"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html" And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html"
Scenario: Use custom permalink schema with squished date Scenario: Use custom permalink schema with squished date
@ -61,7 +66,8 @@ Feature: Fancy permalinks
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html" And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html" And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
Scenario: Use custom permalink schema with date and time Scenario: Use custom permalink schema with date and time
@ -74,7 +80,8 @@ Feature: Fancy permalinks
| permalink | "/:year:month:day:hour:minute:second.html" | | permalink | "/:year:month:day:hour:minute:second.html" |
| timezone | UTC | | timezone | UTC |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/20090327223107.html" And I should see "Totally custom." in "_site/20090327223107.html"
Scenario: Use per-post permalink Scenario: Use per-post permalink
@ -83,7 +90,8 @@ Feature: Fancy permalinks
| title | date | permalink | content | | title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/1/ | bla bla | | Some post | 2013-04-14 | /custom/posts/1/ | bla bla |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the _site/custom/posts/1 directory should exist And the _site/custom/posts/1 directory should exist
And I should see "bla bla" in "_site/custom/posts/1/index.html" And I should see "bla bla" in "_site/custom/posts/1/index.html"
@ -93,7 +101,8 @@ Feature: Fancy permalinks
| title | date | permalink | content | | title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/some.html | bla bla | | Some post | 2013-04-14 | /custom/posts/some.html | bla bla |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the _site/custom/posts directory should exist And the _site/custom/posts directory should exist
And I should see "bla bla" in "_site/custom/posts/some.html" And I should see "bla bla" in "_site/custom/posts/some.html"
@ -102,7 +111,8 @@ Feature: Fancy permalinks
And I have an "_posts/2009-03-27-Pretty-Permalink-Schema.md" page that contains "Totally wordpress" And I have an "_posts/2009-03-27-Pretty-Permalink-Schema.md" page that contains "Totally wordpress"
And I have a configuration file with "permalink" set to "pretty" And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally wordpress." in "_site/2009/03/27/Pretty-Permalink-Schema/index.html" And I should see "Totally wordpress." in "_site/2009/03/27/Pretty-Permalink-Schema/index.html"
Scenario: Use custom permalink schema with cased file name Scenario: Use custom permalink schema with cased file name
@ -110,7 +120,8 @@ Feature: Fancy permalinks
And I have an "_posts/2009-03-27-Custom-Schema.md" page with title "Custom Schema" that contains "Totally awesome" And I have an "_posts/2009-03-27-Custom-Schema.md" page with title "Custom Schema" that contains "Totally awesome"
And I have a configuration file with "permalink" set to "/:year/:month/:day/:slug/" And I have a configuration file with "permalink" set to "/:year/:month/:day/:slug/"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally awesome" in "_site/2009/03/27/custom-schema/index.html" And I should see "Totally awesome" in "_site/2009/03/27/custom-schema/index.html"
Scenario: Use pretty permalink schema with title containing underscore Scenario: Use pretty permalink schema with title containing underscore
@ -118,5 +129,16 @@ Feature: Fancy permalinks
And I have an "_posts/2009-03-27-Custom_Schema.md" page with title "Custom Schema" that contains "Totally awesome" And I have an "_posts/2009-03-27-Custom_Schema.md" page with title "Custom Schema" that contains "Totally awesome"
And I have a configuration file with "permalink" set to "pretty" And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally awesome" in "_site/2009/03/27/Custom_Schema/index.html" And I should see "Totally awesome" in "_site/2009/03/27/Custom_Schema/index.html"
Scenario: Use a non-HTML file extension in the permalink
Given I have a _posts directory
And I have an "_posts/2016-01-18-i-am-php.md" page with permalink "/2016/i-am-php.php" that contains "I am PHP"
And I have a "i-am-also-php.md" page with permalink "/i-am-also-php.php" that contains "I am also PHP"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "I am PHP" in "_site/2016/i-am-php.php"
And I should see "I am also PHP" in "_site/i-am-also-php.php"

View File

@ -6,7 +6,8 @@ Feature: Configuring and using plugins
Given I have an "index.html" file that contains "Whatever" Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with "gems" set to "[jekyll_test_plugin]" And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html" And I should see "Whatever" in "_site/index.html"
And I should see "this is a test" in "_site/test.txt" And I should see "this is a test" in "_site/test.txt"
@ -17,7 +18,8 @@ Feature: Configuring and using plugins
| gems | [jekyll_test_plugin] | | gems | [jekyll_test_plugin] |
| whitelist | [] | | whitelist | [] |
When I run jekyll build --safe When I run jekyll build --safe
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html" And I should see "Whatever" in "_site/index.html"
And the "_site/test.txt" file should not exist And the "_site/test.txt" file should not exist
@ -28,7 +30,8 @@ Feature: Configuring and using plugins
| gems | [jekyll_test_plugin, jekyll_test_plugin_malicious] | | gems | [jekyll_test_plugin, jekyll_test_plugin_malicious] |
| whitelist | [jekyll_test_plugin] | | whitelist | [jekyll_test_plugin] |
When I run jekyll build --safe When I run jekyll build --safe
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html" And I should see "Whatever" in "_site/index.html"
And the "_site/test.txt" file should exist And the "_site/test.txt" file should exist
And I should see "this is a test" in "_site/test.txt" And I should see "this is a test" in "_site/test.txt"

View File

@ -11,7 +11,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post title: {{ page.title }}" And I have a simple layout that contains "Post title: {{ page.title }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html" And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.url variable Scenario: Use post.url variable
@ -22,7 +23,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post url: {{ page.url }}" And I have a simple layout that contains "Post url: {{ page.url }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html" And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.date variable Scenario: Use post.date variable
@ -33,7 +35,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}" And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html" And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.id variable Scenario: Use post.id variable
@ -44,7 +47,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post id: {{ page.id }}" And I have a simple layout that contains "Post id: {{ page.id }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html" And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.content variable Scenario: Use post.content variable
@ -55,7 +59,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post content: {{ content }}" And I have a simple layout that contains "Post content: {{ content }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post content: <p>Luke, I am your father.</p>" in "_site/2009/03/27/star-wars.html" And I should see "Post content: <p>Luke, I am your father.</p>" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder Scenario: Use post.categories variable when category is in a folder
@ -67,7 +72,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and has category in YAML Scenario: Use post.categories variable when category is in a folder and has category in YAML
@ -79,7 +85,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | film | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | film | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and has categories in YAML Scenario: Use post.categories variable when category is in a folder and has categories in YAML
@ -91,7 +98,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML
@ -103,7 +111,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.tags variable Scenario: Use post.tags variable
@ -114,7 +123,8 @@ Feature: Post data
| Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. | | Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. |
And I have a simple layout that contains "Post tags: {{ page.tags }}" And I have a simple layout that contains "Post tags: {{ page.tags }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html"
Scenario: Use post.categories variable when categories are in folders Scenario: Use post.categories variable when categories are in folders
@ -127,7 +137,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in folders with mixed case Scenario: Use post.categories variable when categories are in folders with mixed case
@ -140,7 +151,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML Scenario: Use post.categories variable when category is in YAML
@ -151,7 +163,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML and is mixed-case Scenario: Use post.categories variable when category is in YAML and is mixed-case
@ -162,7 +175,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: Movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: Movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML Scenario: Use post.categories variable when categories are in YAML
@ -173,7 +187,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML and are duplicated Scenario: Use post.categories variable when categories are in YAML and are duplicated
@ -184,7 +199,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Superdirectories of _posts applied to post.categories Scenario: Superdirectories of _posts applied to post.categories
@ -193,7 +209,8 @@ Feature: Post data
And I have a _layouts directory And I have a _layouts directory
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Subdirectories of _posts not applied to post.categories Scenario: Subdirectories of _posts not applied to post.categories
@ -202,7 +219,8 @@ Feature: Post data
And I have a _layouts directory And I have a _layouts directory
And I have a simple layout that contains "Post category: {{ page.categories }}" And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML with mixed case Scenario: Use post.categories variable when categories are in YAML with mixed case
@ -214,7 +232,8 @@ Feature: Post data
| Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. | | Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html" And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
And I should see "Post categories: SciFi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html" And I should see "Post categories: SciFi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html"
@ -224,7 +243,8 @@ Feature: Post data
| title | type | date | content | | title | type | date | content |
| my-post | html | 2013-04-12 | Source path: {{ page.path }} | | my-post | html | 2013-04-12 | Source path: {{ page.path }} |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Source path: <path_prefix>_posts/2013-04-12-my-post.html" in "_site/<dir>/2013/04/12/my-post.html" And I should see "Source path: <path_prefix>_posts/2013-04-12-my-post.html" in "_site/<dir>/2013/04/12/my-post.html"
Examples: Examples:
@ -239,7 +259,8 @@ Feature: Post data
| title | date | path | content | | title | date | path | content |
| override | 2013-04-12 | override-path.html | Non-custom path: {{ page.path }} | | override | 2013-04-12 | override-path.html | Non-custom path: {{ page.path }} |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Non-custom path: _posts/2013-04-12-override.markdown" in "_site/2013/04/12/override.html" And I should see "Non-custom path: _posts/2013-04-12-override.markdown" in "_site/2013/04/12/override.html"
Scenario: Disable a post from being published Scenario: Disable a post from being published
@ -249,7 +270,8 @@ Feature: Post data
| title | date | layout | published | content | | title | date | layout | published | content |
| Star Wars | 2009-03-27 | simple | false | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | false | Luke, I am your father. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/2009/03/27/star-wars.html" file should not exist And the "_site/2009/03/27/star-wars.html" file should not exist
And I should see "Published!" in "_site/index.html" And I should see "Published!" in "_site/index.html"
@ -261,7 +283,8 @@ Feature: Post data
| Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. | | Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. |
And I have a simple layout that contains "Post author: {{ page.author }}" And I have a simple layout that contains "Post author: {{ page.author }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html" And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
Scenario: Previous and next posts title Scenario: Previous and next posts title
@ -274,6 +297,7 @@ Feature: Post data
| Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby | | Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby |
And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}" And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html" And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html"
And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html" And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html"

View File

@ -12,7 +12,8 @@ Feature: Post excerpts
| title | date | layout | content | | title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "<p>content for entry1.</p>" in "_site/index.html" And I should see exactly "<p>content for entry1.</p>" in "_site/index.html"
Scenario: An excerpt from a post with a layout Scenario: An excerpt from a post with a layout
@ -24,7 +25,8 @@ Feature: Post excerpts
| title | date | layout | content | | title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the _site/2007 directory should exist And the _site/2007 directory should exist
And the _site/2007/12 directory should exist And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist And the _site/2007/12/31 directory should exist
@ -41,7 +43,8 @@ Feature: Post excerpts
| title | date | layout | content | | title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the _site/2007 directory should exist And the _site/2007 directory should exist
And the _site/2007/12 directory should exist And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist And the _site/2007/12/31 directory should exist

View File

@ -16,7 +16,8 @@ Feature: Rendering
Given I have a "index.html" page with layout "simple" that contains "Hi there, Jekyll {{ jekyll.environment }}!" Given I have a "index.html" page with layout "simple" that contains "Hi there, Jekyll {{ jekyll.environment }}!"
And I have a simple layout that contains "{{ content }}Ahoy, indeed!" And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Hi there, Jekyll development!\nAhoy, indeed" in "_site/index.html" And I should see "Hi there, Jekyll development!\nAhoy, indeed" in "_site/index.html"
Scenario: Don't place asset files in layout Scenario: Don't place asset files in layout
@ -25,7 +26,8 @@ Feature: Rendering
And I have a configuration file with "gems" set to "[jekyll-coffeescript]" And I have a configuration file with "gems" set to "[jekyll-coffeescript]"
And I have a simple layout that contains "{{ content }}Ahoy, indeed!" And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should not see "Ahoy, indeed!" in "_site/index.css" And I should not see "Ahoy, indeed!" in "_site/index.css"
And I should not see "Ahoy, indeed!" in "_site/index.js" And I should not see "Ahoy, indeed!" in "_site/index.js"
@ -33,18 +35,21 @@ Feature: Rendering
Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }" Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }"
And I have a configuration file with "color" set to "red" And I have a configuration file with "color" set to "red"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see ".foo-bar {\n color: red; }" in "_site/index.css" And I should see ".foo-bar {\n color: red; }" in "_site/index.css"
Scenario: Not render liquid in CoffeeScript without explicitly including jekyll-coffeescript 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}}'" Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.js" file should not exist And the "_site/index.js" file should not exist
Scenario: Render liquid in CoffeeScript with jekyll-coffeescript enabled Scenario: Render liquid in CoffeeScript with jekyll-coffeescript enabled
Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'"
And I have a configuration file with "gems" set to "[jekyll-coffeescript]" And I have a configuration file with "gems" set to "[jekyll-coffeescript]"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "hey = 'for cicada';" in "_site/index.js" And I should see "hey = 'for cicada';" in "_site/index.js"

View File

@ -8,7 +8,8 @@ Feature: Site configuration
And I have an "_sourcedir/index.html" file that contains "Changing source directory" And I have an "_sourcedir/index.html" file that contains "Changing source directory"
And I have a configuration file with "source" set to "_sourcedir" And I have a configuration file with "source" set to "_sourcedir"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Changing source directory" in "_site/index.html" And I should see "Changing source directory" in "_site/index.html"
Scenario: Change destination directory Scenario: Change destination directory
@ -66,27 +67,31 @@ Feature: Site configuration
Given I have an "index.markdown" page that contains "[Google](http://google.com)" Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "rdiscount" And I have a configuration file with "markdown" set to "rdiscount"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html" And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Use Kramdown for markup Scenario: Use Kramdown for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)" Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "kramdown" And I have a configuration file with "markdown" set to "kramdown"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html" And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Use Redcarpet for markup Scenario: Use Redcarpet for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)" Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "redcarpet" And I have a configuration file with "markdown" set to "redcarpet"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html" And I should see "<a href=\"http://google.com\">Google</a>" in "_site/index.html"
Scenario: Highlight code with pygments Scenario: Highlight code with pygments
Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}" Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Hello world!" in "_site/index.html" And I should see "Hello world!" in "_site/index.html"
And I should see "class=\"highlight\"" in "_site/index.html" And I should see "class=\"highlight\"" in "_site/index.html"
@ -94,7 +99,8 @@ Feature: Site configuration
Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}" Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
And I have a configuration file with "highlighter" set to "rouge" And I have a configuration file with "highlighter" set to "rouge"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Hello world!" in "_site/index.html" And I should see "Hello world!" in "_site/index.html"
And I should see "class=\"highlight\"" in "_site/index.html" And I should see "class=\"highlight\"" in "_site/index.html"
@ -122,7 +128,8 @@ Feature: Site configuration
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. | | entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html" And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html" And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And the "_site/2020/01/31/entry2.html" file should not exist And the "_site/2020/01/31/entry2.html" file should not exist
@ -142,7 +149,8 @@ Feature: Site configuration
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. | | entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html" And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html" And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
@ -161,7 +169,8 @@ Feature: Site configuration
| entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. | | entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. | | entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html" And I should see "Page Layout: 2" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>\n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" And I should see "Post Layout: <p>content for entry1.</p>\n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>\n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" And I should see "Post Layout: <p>content for entry2.</p>\n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html"
@ -180,7 +189,8 @@ Feature: Site configuration
| entry1 | 2013-04-09 23:22 +0400 | post | content for entry1. | | entry1 | 2013-04-09 23:22 +0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 +0400 | post | content for entry2. | | entry2 | 2013-04-10 03:14 +0400 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html" And I should see "Page Layout: 2" in "_site/index.html"
And the "_site/2013/04/09/entry1.html" file should exist And the "_site/2013/04/09/entry1.html" file should exist
And the "_site/2013/04/09/entry2.html" file should exist And the "_site/2013/04/09/entry2.html" file should exist
@ -198,7 +208,8 @@ Feature: Site configuration
| Oranges | 2009-04-01 | An article about oranges | | Oranges | 2009-04-01 | An article about oranges |
| Bananas | 2009-04-05 | An article about bananas | | Bananas | 2009-04-05 | An article about bananas |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And the "_site/2009/04/05/bananas.html" file should exist And the "_site/2009/04/05/bananas.html" file should exist
And the "_site/2009/04/01/oranges.html" file should exist And the "_site/2009/04/01/oranges.html" file should exist
And the "_site/2009/03/27/apples.html" file should not exist And the "_site/2009/03/27/apples.html" file should not exist
@ -211,7 +222,8 @@ Feature: Site configuration
| .gitignore | | .gitignore |
| .foo | | .foo |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see ".DS_Store" in "_site/.gitignore" And I should see ".DS_Store" in "_site/.gitignore"
And the "_site/.htaccess" file should not exist And the "_site/.htaccess" file should not exist
@ -231,7 +243,8 @@ Feature: Site configuration
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. | | entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html" And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html" And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
@ -240,6 +253,7 @@ Feature: Site configuration
Given I have an "index.html" page with layout "page" that contains "FOO" Given I have an "index.html" page with layout "page" that contains "FOO"
And I have a "_config.yml" file that contains "layouts: '../../../../../../../../../../../../../../usr/include'" And I have a "_config.yml" file that contains "layouts: '../../../../../../../../../../../../../../usr/include'"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "FOO" in "_site/index.html" And I should see "FOO" in "_site/index.html"
And I should not see " " in "_site/index.html" And I should not see " " in "_site/index.html"

View File

@ -6,14 +6,16 @@ Feature: Site data
Scenario: Use page variable in a page Scenario: Use page variable in a page
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com" Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Contact: email@example.com" in "_site/contact.html" And I should see "Contact: email@example.com" in "_site/contact.html"
Scenario Outline: Use page.path variable in a page Scenario Outline: Use page.path variable in a page
Given I have a <dir> directory Given I have a <dir> directory
And I have a "<path>" page that contains "Source path: {{ page.path }}" And I have a "<path>" page that contains "Source path: {{ page.path }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Source path: <path>" in "_site/<path>" And I should see "Source path: <path>" in "_site/<path>"
Examples: Examples:
@ -25,13 +27,15 @@ Feature: Site data
Scenario: Override page.path Scenario: Override page.path
Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}" Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Custom path: custom-override.html" in "_site/override.html" And I should see "Custom path: custom-override.html" in "_site/override.html"
Scenario: Use site.time variable Scenario: Use site.time variable
Given I have an "index.html" page that contains "{{ site.time }}" Given I have an "index.html" page that contains "{{ site.time }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see today's time in "_site/index.html" And I should see today's time in "_site/index.html"
Scenario: Use site.posts variable for latest post Scenario: Use site.posts variable for latest post
@ -43,7 +47,8 @@ Feature: Site data
| Second Post | 2009-03-26 | My Second Post | | Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post | | Third Post | 2009-03-27 | My Third Post |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html" And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html"
Scenario: Use site.posts variable in a loop Scenario: Use site.posts variable in a loop
@ -55,7 +60,8 @@ Feature: Site data
| Second Post | 2009-03-26 | My Second Post | | Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post | | Third Post | 2009-03-27 | My Third Post |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Third Post Second Post First Post" in "_site/index.html" And I should see "Third Post Second Post First Post" in "_site/index.html"
Scenario: Use site.categories.code variable Scenario: Use site.categories.code variable
@ -66,7 +72,8 @@ Feature: Site data
| Awesome Hack | 2009-03-26 | code | puts 'Hello World' | | Awesome Hack | 2009-03-26 | code | puts 'Hello World' |
| Delicious Beer | 2009-03-26 | food | 1) Yuengling | | Delicious Beer | 2009-03-26 | food | 1) Yuengling |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Awesome Hack" in "_site/index.html" And I should see "Awesome Hack" in "_site/index.html"
Scenario: Use site.tags variable Scenario: Use site.tags variable
@ -76,7 +83,8 @@ Feature: Site data
| title | date | tag | content | | title | date | tag | content |
| Delicious Beer | 2009-03-26 | beer | 1) Yuengling | | Delicious Beer | 2009-03-26 | beer | 1) Yuengling |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "Yuengling" in "_site/index.html" And I should see "Yuengling" in "_site/index.html"
Scenario: Order Posts by name when on the same date Scenario: Order Posts by name when on the same date
@ -90,18 +98,21 @@ Feature: Site data
| C | 2009-03-26 | C | | C | 2009-03-26 | C |
| last | 2009-04-26 | last | | last | 2009-04-26 | last |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html" And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html"
Scenario: Use configuration date in site payload Scenario: Use configuration date in site payload
Given I have an "index.html" page that contains "{{ site.url }}" Given I have an "index.html" page that contains "{{ site.url }}"
And I have a configuration file with "url" set to "http://example.com" And I have a configuration file with "url" set to "http://example.com"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "http://example.com" in "_site/index.html" And I should see "http://example.com" in "_site/index.html"
Scenario: Access Jekyll version via jekyll.version Scenario: Access Jekyll version via jekyll.version
Given I have an "index.html" page that contains "{{ jekyll.version }}" Given I have an "index.html" page that contains "{{ jekyll.version }}"
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then I should get a zero exit status
And the _site directory should exist
And I should see "\d+\.\d+\.\d+" in "_site/index.html" And I should see "\d+\.\d+\.\d+" in "_site/index.html"

View File

@ -93,16 +93,20 @@ end
# #
Given %r{^I have a configuration file with "(.*)" set to "(.*)"$} do |key, value| Given %r{^I have a configuration file with "(.*)" set to "(.*)"$} do |key, value|
File.write("_config.yml", "#{key}: #{value}\n") config = if source_dir.join("_config.yml").exist?
SafeYAML.load_file(source_dir.join("_config.yml"))
else
{}
end
config[key] = YAML.load(value)
File.write("_config.yml", YAML.dump(config))
end end
# #
Given %r{^I have a configuration file with:$} do |table| Given %r{^I have a configuration file with:$} do |table|
File.open("_config.yml", "w") do |f|
table.hashes.each do |row| table.hashes.each do |row|
f.write("#{row["key"]}: #{row["value"]}\n") step %(I have a configuration file with "#{row["key"]}" set to "#{row["value"]}")
end
end end
end end
@ -228,12 +232,17 @@ end
# #
Then %r{^I should see "(.*)" in the build output$} do |text| Then %r{^I should see "(.*)" in the build output$} do |text|
regexp = Regexp.new(text) expect(jekyll_run_output).to match Regexp.new(text)
expect(jekyll_run_output).to match regexp end
#
Then %r{^I should get a zero exit(?:\-| )status$} do
step %(I should see "EXIT STATUS: 0" in the build output)
end end
# #
Then %r{^I should get a non-zero exit(?:\-| )status$} do Then %r{^I should get a non-zero exit(?:\-| )status$} do
expect(jekyll_run_status.to_i).to be > 0 expect(jekyll_run_status.to_i).not_to match(%r{EXIT STATUS: 0})
end end

View File

@ -2,6 +2,7 @@ require "fileutils"
require "jekyll/utils" require "jekyll/utils"
require "open3" require "open3"
require "time" require "time"
require "safe_yaml/load"
class Paths class Paths
SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__)) SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__))
@ -100,8 +101,13 @@ def run_in_shell(*args)
end end
File.write(Paths.status_file, p.value.exitstatus) File.write(Paths.status_file, p.value.exitstatus)
File.write(Paths.output_file, out) if p.value.exitstatus == 0 File.open(Paths.output_file, "wb") do |f|
File.write(Paths.output_file, err) if p.value.exitstatus != 0 f.puts args.join(" ")
f.puts out
f.puts err
f.puts "EXIT STATUS: #{p.value.exitstatus}"
end
p.value p.value
end end

View File

@ -97,13 +97,7 @@ module Jekyll
# Returns the String extension for the output file. # Returns the String extension for the output file.
# e.g. ".html" for an HTML output file. # e.g. ".html" for an HTML output file.
def output_ext def output_ext
if converters.all? { |c| c.is_a?(Jekyll::Converters::Identity) } Jekyll::Renderer.new(site, self).output_ext
ext
else
converters.map do |c|
c.output_ext(ext) unless c.is_a?(Jekyll::Converters::Identity)
end.compact.last
end
end end
# Determine which converter to use based on this convertible's # Determine which converter to use based on this convertible's

View File

@ -59,7 +59,10 @@ module Jekyll
end end
Utils.deep_merge_hashes!(data, other) Utils.deep_merge_hashes!(data, other)
if data.key?('date') && !data['date'].is_a?(Time) if data.key?('date') && !data['date'].is_a?(Time)
data['date'] = Utils.parse_date(data['date'].to_s, "Document '#{relative_path}' does not have a valid date in the YAML front matter.") data['date'] = Utils.parse_date(
data['date'].to_s,
"Document '#{relative_path}' does not have a valid date in the YAML front matter."
)
end end
data data
end end

View File

@ -7,6 +7,8 @@ module Jekyll
attr_accessor :name, :ext, :basename attr_accessor :name, :ext, :basename
attr_accessor :data, :content, :output attr_accessor :data, :content, :output
alias_method :extname, :ext
# Attributes for Liquid templates # Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w( ATTRIBUTES_FOR_LIQUID = %w(
content content
@ -160,5 +162,13 @@ module Jekyll
def index? def index?
basename == 'index' basename == 'index'
end end
def trigger_hooks(hook_name, *args)
Jekyll::Hooks.trigger :pages, hook_name, self, *args
end
def write?
true.freeze
end
end end
end end

View File

@ -22,11 +22,7 @@ module Jekyll
# #
# Returns the output extname including the leading period. # Returns the output extname including the leading period.
def output_ext def output_ext
@output_ext ||= if document.permalink @output_ext ||= (permalink_ext || converter_output_ext)
File.extname(document.permalink)
else
converters.first.output_ext(document.extname)
end
end end
###################### ######################
@ -38,10 +34,18 @@ module Jekyll
payload["page"] = document.to_liquid payload["page"] = document.to_liquid
if document.collection.label == 'posts' && document.is_a?(Document) if document.respond_to? :pager
payload["paginator"] = document.pager.to_liquid
end
if document.is_a?(Document) && document.collection.label == 'posts'
payload['site']['related_posts'] = document.related_posts payload['site']['related_posts'] = document.related_posts
end end
# render and transform content (this becomes the final content of the object)
payload['highlighter_prefix'] = converters.first.highlighter_prefix
payload['highlighter_suffix'] = converters.first.highlighter_suffix
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
document.trigger_hooks(:pre_render, payload) document.trigger_hooks(:pre_render, payload)
@ -50,10 +54,6 @@ module Jekyll
:registers => { :site => site, :page => payload['page'] } :registers => { :site => site, :page => payload['page'] }
} }
# render and transform content (this becomes the final content of the object)
payload['highlighter_prefix'] = converters.first.highlighter_prefix
payload['highlighter_suffix'] = converters.first.highlighter_suffix
output = document.content output = document.content
if document.render_with_liquid? if document.render_with_liquid?
@ -164,5 +164,28 @@ module Jekyll
output output
end end
private
def permalink_ext
if document.permalink
permalink_ext = File.extname(document.permalink)
permalink_ext unless permalink_ext.empty?
end
end
def converter_output_ext
if output_exts.size == 1
output_exts.last
else
output_exts[-2]
end
end
def output_exts
@output_exts ||= converters.map do |c|
c.output_ext(document.extname)
end.compact
end
end end
end end

View File

@ -176,7 +176,8 @@ module Jekyll
pages.flatten.each do |page| pages.flatten.each do |page|
if regenerator.regenerate?(page) if regenerator.regenerate?(page)
page.render(layouts, payload) page.output = Jekyll::Renderer.new(self, page, payload).run
page.trigger_hooks(:post_render)
end end
end end

View File

@ -42,6 +42,22 @@ Minitest::Reporters.use! [
) )
] ]
module Minitest::Assertions
def assert_exist(filename, msg = nil)
msg = message(msg) {
"Expected '#{filename}' to exist"
}
assert File.exist?(filename), msg
end
def refute_exist(filename, msg = nil)
msg = message(msg) {
"Expected '#{filename}' not to exist"
}
refute File.exist?(filename), msg
end
end
class JekyllUnitTest < Minitest::Test class JekyllUnitTest < Minitest::Test
include ::RSpec::Mocks::ExampleMethods include ::RSpec::Mocks::ExampleMethods

View File

@ -1,7 +1,7 @@
--- ---
layout: default layout: default
title : Page inside + title : Page inside +
permalink: /+/plus+in+url permalink: /+/plus+in+url.html
--- ---
Line 1 Line 1
{{ page.title }} {{ page.title }}

View File

@ -1,6 +1,5 @@
--- ---
title: Deal with dots title: Deal with dots
permalink: /deal.with.dots
--- ---
Let's test if jekyll deals properly with dots. Let's test if jekyll deals properly with dots.

View File

@ -21,19 +21,19 @@ class TestCleaner < JekyllUnitTest
end end
should "keep the parent directory" do should "keep the parent directory" do
assert File.exist?(dest_dir('to_keep')) assert_exist dest_dir('to_keep')
end end
should "keep the child directory" do should "keep the child directory" do
assert File.exist?(dest_dir('to_keep/child_dir')) assert_exist dest_dir('to_keep', 'child_dir')
end end
should "keep the file in the directory in keep_files" do should "keep the file in the directory in keep_files" do
assert File.exist?(File.join(dest_dir('to_keep/child_dir'), 'index.html')) assert_exist dest_dir('to_keep', 'child_dir', 'index.html')
end end
should "delete the file in the directory not in keep_files" do should "delete the file in the directory not in keep_files" do
assert !File.exist?(File.join(dest_dir('to_keep'), 'index.html')) refute_exist dest_dir('to_keep', 'index.html')
end end
end end
@ -41,8 +41,8 @@ class TestCleaner < JekyllUnitTest
setup do setup do
clear_dest clear_dest
FileUtils.mkdir_p(source_dir('no_files_inside/child_dir')) FileUtils.mkdir_p(source_dir('no_files_inside', 'child_dir'))
FileUtils.touch(File.join(source_dir('no_files_inside/child_dir'), 'index.html')) FileUtils.touch(source_dir('no_files_inside', 'child_dir', 'index.html'))
@site = fixture_site @site = fixture_site
@site.process @site.process
@ -57,15 +57,15 @@ class TestCleaner < JekyllUnitTest
end end
should "keep the parent directory" do should "keep the parent directory" do
assert File.exist?(dest_dir('no_files_inside')) assert_exist dest_dir('no_files_inside')
end end
should "keep the child directory" do should "keep the child directory" do
assert File.exist?(dest_dir('no_files_inside/child_dir')) assert_exist dest_dir('no_files_inside', 'child_dir')
end end
should "keep the file" do should "keep the file" do
assert File.exist?(File.join(dest_dir('no_files_inside/child_dir'), 'index.html')) assert_exist source_dir('no_files_inside', 'child_dir', 'index.html')
end end
end end
end end

View File

@ -37,7 +37,7 @@ JS
end end
should "write a JS file in place" do should "write a JS file in place" do
assert File.exist?(@test_coffeescript_file), "Can't find the converted CoffeeScript file in the dest_dir." assert_exist @test_coffeescript_file, "Can't find the converted CoffeeScript file in the dest_dir."
end end
should "produce JS" do should "produce JS" do

View File

@ -31,17 +31,22 @@ class TestGeneratedSite < JekyllUnitTest
end end
should "hide unpublished page" do should "hide unpublished page" do
assert !File.exist?(dest_dir('/unpublished.html')) refute_exist dest_dir('/unpublished.html')
end end
should "not copy _posts directory" do should "not copy _posts directory" do
assert !File.exist?(dest_dir('_posts')) refute_exist dest_dir('_posts')
end
should "process a page with a folder permalink properly" do
about = @site.pages.find {|page| page.name == 'about.html' }
assert_equal dest_dir('about', 'index.html'), about.destination(dest_dir)
assert_exist dest_dir('about', 'index.html')
end end
should "process other static files and generate correct permalinks" do should "process other static files and generate correct permalinks" do
assert File.exist?(dest_dir('/about/index.html')), "about/index.html should exist" assert_exist dest_dir('contacts.html')
assert File.exist?(dest_dir('/contacts.html')), "contacts.html should exist" assert_exist dest_dir('dynamic_file.php')
assert File.exist?(dest_dir('/dynamic_file.php')), "dynamic_file.php should exist"
end end
should "print a nice list of static files" do should "print a nice list of static files" do
@ -72,15 +77,22 @@ OUTPUT
should "ensure limit posts is 0 or more" do should "ensure limit posts is 0 or more" do
assert_raises ArgumentError do assert_raises ArgumentError do
clear_dest clear_dest
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1}) config = Jekyll::Configuration::DEFAULTS.merge({
'source' => source_dir,
'destination' => dest_dir,
'limit_posts' => -1
})
@site = fixture_site(config) @site = fixture_site(config)
end end
end end
should "acceptable limit post is 0" do should "acceptable limit post is 0" do
clear_dest clear_dest
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) config = Jekyll::Configuration::DEFAULTS.merge({
'source' => source_dir,
'destination' => dest_dir,
'limit_posts' => 0
})
assert Site.new(config), "Couldn't create a site with the given limit_posts." assert Site.new(config), "Couldn't create a site with the given limit_posts."
end end

View File

@ -24,9 +24,9 @@ class TestNewCommand < JekyllUnitTest
end end
should 'create a new directory' do should 'create a new directory' do
assert !File.exist?(@full_path) refute_exist @full_path
Jekyll::Commands::New.process(@args) Jekyll::Commands::New.process(@args)
assert File.exist?(@full_path) assert_exist @full_path
end end
should 'display a success message' do should 'display a success message' do
@ -96,9 +96,9 @@ class TestNewCommand < JekyllUnitTest
end end
should 'create a new directory' do should 'create a new directory' do
assert !File.exist?(@site_name_with_spaces) refute_exist @site_name_with_spaces
capture_stdout { Jekyll::Commands::New.process(@multiple_args) } capture_stdout { Jekyll::Commands::New.process(@multiple_args) }
assert File.exist?(@site_name_with_spaces) assert_exist @site_name_with_spaces
end end
end end

View File

@ -69,7 +69,6 @@ class TestPage < JekyllUnitTest
@dest_file = dest_dir("deal.with.dots.html") @dest_file = dest_dir("deal.with.dots.html")
assert_equal "deal.with.dots", @page.basename assert_equal "deal.with.dots", @page.basename
assert_equal "/deal.with.dots", @page.url
assert_equal @dest_file, @page.destination(dest_dir) assert_equal @dest_file, @page.destination(dest_dir)
end end
@ -214,7 +213,7 @@ class TestPage < JekyllUnitTest
do_render(page) do_render(page)
page.write(dest_dir) page.write(dest_dir)
assert !File.exist?(unexpected) refute_exist unexpected
end end
end end
@ -239,7 +238,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts.html')) assert_exist dest_dir('contacts.html')
end end
should "write even when the folder name is plus and permalink has +" do should "write even when the folder name is plus and permalink has +" do
@ -247,8 +246,8 @@ class TestPage < JekyllUnitTest
do_render(page) do_render(page)
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir), "#{dest_dir} should be a directory"
assert File.exist?(File.join(dest_dir, '+', 'plus+in+url.html')) assert_exist dest_dir('+', 'plus+in+url.html')
end end
should "write even when permalink has '%# +'" do should "write even when permalink has '%# +'" do
@ -257,7 +256,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, '+', '%# +.html')) assert_exist dest_dir('+', '%# +.html')
end end
should "write properly without html extension" do should "write properly without html extension" do
@ -267,7 +266,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'index.html')) assert_exist dest_dir('contacts', 'index.html')
end end
should "support .htm extension and respects that" do should "support .htm extension and respects that" do
@ -277,7 +276,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'index.htm')) assert_exist dest_dir('contacts', 'index.htm')
end end
should "support .xhtml extension and respects that" do should "support .xhtml extension and respects that" do
@ -287,7 +286,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'index.xhtml')) assert_exist dest_dir('contacts', 'index.xhtml')
end end
should "write properly with extension different from html" do should "write properly with extension different from html" do
@ -296,10 +295,10 @@ class TestPage < JekyllUnitTest
do_render(page) do_render(page)
page.write(dest_dir) page.write(dest_dir)
assert_equal("/sitemap.xml", page.url) assert_equal "/sitemap.xml", page.url
assert_nil(page.url[/\.html$/]) assert_nil page.url[/\.html$/]
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir,'sitemap.xml')) assert_exist dest_dir('sitemap.xml')
end end
should "write dotfiles properly" do should "write dotfiles properly" do
@ -308,7 +307,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, '.htaccess')) assert_exist dest_dir('.htaccess')
end end
context "in a directory hierarchy" do context "in a directory hierarchy" do
@ -318,7 +317,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'index.html')) assert_exist dest_dir('contacts', 'index.html')
end end
should "write properly" do should "write properly" do
@ -327,7 +326,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'bar.html')) assert_exist dest_dir('contacts', 'bar.html')
end end
should "write properly without html extension" do should "write properly without html extension" do
@ -337,7 +336,7 @@ class TestPage < JekyllUnitTest
page.write(dest_dir) page.write(dest_dir)
assert File.directory?(dest_dir) assert File.directory?(dest_dir)
assert File.exist?(File.join(dest_dir, 'contacts', 'bar', 'index.html')) assert_exist dest_dir('contacts', 'bar', 'index.html')
end end
end end
end end

View File

@ -112,7 +112,7 @@ class TestRegenerator < JekyllUnitTest
assert_equal 1, @regenerator.metadata.size assert_equal 1, @regenerator.metadata.size
path = @regenerator.metadata.keys[0] path = @regenerator.metadata.keys[0]
assert File.exist?(@layout_path) assert_exist @layout_path
@regenerator.add_dependency(path, @layout_path) @regenerator.add_dependency(path, @layout_path)
File.rename(@layout_path, @layout_path + ".tmp") File.rename(@layout_path, @layout_path + ".tmp")

View File

@ -275,25 +275,25 @@ class TestSite < JekyllUnitTest
should 'remove orphaned files in destination' do should 'remove orphaned files in destination' do
@site.process @site.process
assert !File.exist?(dest_dir('obsolete.html')) refute_exist dest_dir('obsolete.html')
assert !File.exist?(dest_dir('qux')) refute_exist dest_dir('qux')
assert !File.exist?(dest_dir('quux')) refute_exist dest_dir('quux')
assert File.exist?(dest_dir('.git')) assert_exist dest_dir('.git')
assert File.exist?(dest_dir('.git/HEAD')) assert_exist dest_dir('.git', 'HEAD')
end end
should 'remove orphaned files in destination - keep_files .svn' do should 'remove orphaned files in destination - keep_files .svn' do
config = site_configuration('keep_files' => %w{.svn}) config = site_configuration('keep_files' => %w{.svn})
@site = Site.new(config) @site = Site.new(config)
@site.process @site.process
assert !File.exist?(dest_dir('.htpasswd')) refute_exist dest_dir('.htpasswd')
assert !File.exist?(dest_dir('obsolete.html')) refute_exist dest_dir('obsolete.html')
assert !File.exist?(dest_dir('qux')) refute_exist dest_dir('qux')
assert !File.exist?(dest_dir('quux')) refute_exist dest_dir('quux')
assert !File.exist?(dest_dir('.git')) refute_exist dest_dir('.git')
assert !File.exist?(dest_dir('.git/HEAD')) refute_exist dest_dir('.git', 'HEAD')
assert File.exist?(dest_dir('.svn')) assert_exist dest_dir('.svn')
assert File.exist?(dest_dir('.svn/HEAD')) assert_exist dest_dir('.svn', 'HEAD')
end end
end end