Merge branch 'master' into patch-1
This commit is contained in:
commit
84e9ea82d1
14
.rubocop.yml
14
.rubocop.yml
|
@ -22,6 +22,8 @@ Metrics/BlockLength:
|
|||
Exclude:
|
||||
- test/**/*.rb
|
||||
- lib/jekyll/configuration.rb
|
||||
- rake/*.rake
|
||||
- jekyll.gemspec
|
||||
Metrics/ClassLength:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb$/
|
||||
|
@ -32,6 +34,8 @@ Metrics/CyclomaticComplexity:
|
|||
Metrics/LineLength:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb/
|
||||
- Rakefile
|
||||
- rake/*.rake
|
||||
Max: 90
|
||||
Severity: warning
|
||||
Metrics/MethodLength:
|
||||
|
@ -44,6 +48,14 @@ Metrics/ParameterLists:
|
|||
Max: 4
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 8
|
||||
Security/MarshalLoad:
|
||||
Exclude:
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
- lib/jekyll/regenerator.rb
|
||||
Security/YAMLLoad:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb/
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
Style/Alias:
|
||||
Enabled: false
|
||||
Style/AlignArray:
|
||||
|
@ -127,5 +139,7 @@ Style/StringLiterals:
|
|||
EnforcedStyle: double_quotes
|
||||
Style/StringLiteralsInInterpolation:
|
||||
EnforcedStyle: double_quotes
|
||||
Style/TrailingCommaInLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
Style/UnneededCapitalW:
|
||||
Enabled: false
|
||||
|
|
|
@ -5,10 +5,10 @@ language: ruby
|
|||
sudo: false
|
||||
|
||||
rvm:
|
||||
- &ruby1 2.3.1
|
||||
- &ruby2 2.2.5
|
||||
- &ruby1 2.3.3
|
||||
- &ruby2 2.2.6
|
||||
- &ruby3 2.1.9
|
||||
- &jruby jruby-9.1.2.0
|
||||
- &jruby jruby-9.1.7.0
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
|
6
Gemfile
6
Gemfile
|
@ -25,7 +25,7 @@ group :test do
|
|||
gem "nokogiri"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.44.1"
|
||||
gem "rubocop", "~> 0.47"
|
||||
gem "test-theme", :path => File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__))
|
||||
|
||||
gem "jruby-openssl" if RUBY_ENGINE == "jruby"
|
||||
|
@ -88,12 +88,12 @@ end
|
|||
|
||||
group :site do
|
||||
if ENV["PROOF"]
|
||||
gem "html-proofer", "~> 2.0"
|
||||
gem "html-proofer", "~> 3.4"
|
||||
end
|
||||
|
||||
gem "jekyll-avatar"
|
||||
gem "jekyll-mentions"
|
||||
gem "jekyll-seo-tag"
|
||||
gem "jekyll-sitemap"
|
||||
gem "jemoji", "0.5.1"
|
||||
gem "jemoji"
|
||||
end
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Use the current year for the LICENSE of theme (#5712)
|
||||
* Update License (#5713)
|
||||
* Use Addressable instead of URI to decode (#5726)
|
||||
* throw IncludeTagError if error occurs in included file (#5767)
|
||||
* Write Jekyll::Utils::Exec.run for running shell commands. (#5640)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -14,6 +16,9 @@
|
|||
* fix date parsing in file names to be stricter (#5609)
|
||||
* Add a module to re-define `ENV["TZ"]` in Windows (#5612)
|
||||
* Use each instead of map to actually return nothing (#5668)
|
||||
* include: fix 'no implicit conversion of nil to String' (#5750)
|
||||
* Don't include the theme's includes_path if it is nil. (#5780)
|
||||
* test double slash when input = '/' (#5542)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
|
@ -33,6 +38,10 @@
|
|||
* Docs: move permalinks from documents into config (#5544)
|
||||
* Sort gems in `docs/_config.yml` (#5746)
|
||||
* [site] Use defaults for docs and news-items (#5744)
|
||||
* Improve collections docs (#5691)
|
||||
* Fix #5730: add gcc and make to the list of requirements (#5731)
|
||||
* Add missing class (#5791)
|
||||
* Improve template docs (#5694)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
|
@ -46,6 +55,13 @@
|
|||
* Rubocop: fix Rakefile and gemspec (#5745)
|
||||
* Use `assert_nil` (#5725)
|
||||
* Sort gems in `jekyll.gemspec` (#5746)
|
||||
* Rubocop: Require consistent comma in multiline literals (#5761)
|
||||
* Bump rubocop (#5765)
|
||||
* New rubocop security checks (#5768)
|
||||
* test/helper: fix flaky plugin path test by removing calls to Dir.chdir without a block (#5779)
|
||||
* Use latest jemoji gem (#5782)
|
||||
* Bump htmlproofer (#5781)
|
||||
* Bump rubies we test against (#5784)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
@ -66,6 +82,12 @@
|
|||
* Fix a minor grammatical mistake on themes' document ### -dev (#5748)
|
||||
* Correct comments in data_reader.rb (#5621)
|
||||
* Add jekyll-pre-commit to plugins list (#5752)
|
||||
* Update quickstart.md (#5758)
|
||||
* Correct minor typo (#5764)
|
||||
* Fix a markdown link to look properly on the web (#5769)
|
||||
* [docs] Info about the help command usage (#5312)
|
||||
* Add missing merge labels for jekyllbot (#5753)
|
||||
* Fix broken links in documentation (#5736)
|
||||
|
||||
## 3.3.1 / 2016-11-14
|
||||
|
||||
|
|
|
@ -11,7 +11,13 @@ namespace.
|
|||
|
||||
## Using Collections
|
||||
|
||||
### Step 1: Tell Jekyll to read in your collection
|
||||
To start using collections, follow these 3 steps:
|
||||
|
||||
* [Step 1: Tell Jekyll to read in your collection](#step1)
|
||||
* [Step 2: Add your content](#step2)
|
||||
* [Step 3: Optionally render your collection's documents into independent files](#step3)
|
||||
|
||||
### Step 1: Tell Jekyll to read in your collection {#step1}
|
||||
|
||||
Add the following to your site's `_config.yml` file, replacing `my_collection`
|
||||
with the name of your collection:
|
||||
|
@ -40,12 +46,12 @@ defaults:
|
|||
layout: page
|
||||
```
|
||||
|
||||
### Step 2: Add your content
|
||||
### Step 2: Add your content {#step2}
|
||||
|
||||
Create a corresponding folder (e.g. `<source>/_my_collection`) and add
|
||||
documents. YAML Front Matter is read in as data if it exists, and everything
|
||||
after it is stuck in the Document's `content` attribute. If no YAML Front
|
||||
Matter is provided, Jekyll will not generate the file in your collection.
|
||||
documents. YAML front matter is processed if the front matter exists, and everything
|
||||
after the front matter is pushed into the document's `content` attribute. If no YAML front
|
||||
matter is provided, Jekyll will not generate the file in your collection.
|
||||
|
||||
<div class="note info">
|
||||
<h5>Be sure to name your directories correctly</h5>
|
||||
|
@ -55,7 +61,7 @@ your <code>_config.yml</code> file, with the addition of the preceding <code>_</
|
|||
</p>
|
||||
</div>
|
||||
|
||||
### Step 3: Optionally render your collection's documents into independent files
|
||||
### Step 3: Optionally render your collection's documents into independent files {#step3}
|
||||
|
||||
If you'd like Jekyll to create a public-facing, rendered version of each
|
||||
document in your collection, set the `output` key to `true` in your collection
|
||||
|
@ -72,19 +78,6 @@ For example, if you have `_my_collection/some_subdir/some_doc.md`,
|
|||
it will be rendered using Liquid and the Markdown converter of your
|
||||
choice and written out to `<dest>/my_collection/some_subdir/some_doc.html`.
|
||||
|
||||
As for posts with [Permalinks](../permalinks/), the document
|
||||
URL can be customized by setting `permalink` metadata for the collection:
|
||||
|
||||
```yaml
|
||||
collections:
|
||||
my_collection:
|
||||
output: true
|
||||
permalink: /awesome/:path/
|
||||
```
|
||||
|
||||
For example, if you have `_my_collection/some_subdir/some_doc.md`, it will be
|
||||
written out to `<dest>/awesome/some_subdir/some_doc/index.html`.
|
||||
|
||||
<div class="note info">
|
||||
<h5>Don't forget to add YAML for processing</h5>
|
||||
<p>
|
||||
|
@ -94,6 +87,21 @@ written out to `<dest>/awesome/some_subdir/some_doc/index.html`.
|
|||
</p>
|
||||
</div>
|
||||
|
||||
## Configuring permalinks for collections {#permalinks}
|
||||
|
||||
You can customize the [Permalinks](../permalinks/) for your collection's documents by setting `permalink` property in the collection's configuration as follows:
|
||||
|
||||
```yaml
|
||||
collections:
|
||||
my_collection:
|
||||
output: true
|
||||
permalink: /awesome/:path/:title.:output_ext
|
||||
```
|
||||
|
||||
In this example, the collection documents will the have the URL of `awesome` followed by the path to the document and its file extension.
|
||||
|
||||
Collections have the following template variables available for permalinks:
|
||||
|
||||
<div class="mobile-side-scroller">
|
||||
<table>
|
||||
<thead>
|
||||
|
@ -148,15 +156,92 @@ written out to `<dest>/awesome/some_subdir/some_doc/index.html`.
|
|||
</table>
|
||||
</div>
|
||||
|
||||
## Permalink examples for collections
|
||||
|
||||
Depending on how you declare the permalinks in your configuration file, the permalinks and paths get written differently in the `_site` folder. A few examples will help clarify the options.
|
||||
|
||||
Let's say your collection is called `apidocs` with `doc1.md` in your collection. `doc1.md` is grouped inside a folder called `mydocs`. Your project's source directory for the collection looks this:
|
||||
|
||||
```
|
||||
├── \_apidocs
|
||||
│ └── mydocs
|
||||
│ └── doc1.md
|
||||
```
|
||||
|
||||
Based on this scenario, here are a few permalink options.
|
||||
|
||||
**Permalink configuration 1**: [Nothing configured] <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── apidocs
|
||||
│ └── mydocs
|
||||
│ └── doc1.html
|
||||
```
|
||||
|
||||
**Permalink configuration 2**: `/:collection/:path/:title:output_ext` <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── apidocs
|
||||
│ └── mydocs
|
||||
│ └── doc1.html
|
||||
```
|
||||
|
||||
**Permalink configuration 3**: No collection permalinks configured, but `pretty` configured for pages/posts. <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── apidocs
|
||||
│ └── mydocs
|
||||
│ └── doc1
|
||||
│ └── index.html
|
||||
```
|
||||
|
||||
**Permalink configuration 4**: `/awesome/:path/:title.html` <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── awesome
|
||||
│ └── mydocs
|
||||
│ └── doc1.html
|
||||
```
|
||||
|
||||
**Permalink configuration 5**: `/awesome/:path/:title/` <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── awesome
|
||||
│ └── mydocs
|
||||
│ └── doc1
|
||||
│ └── index.html
|
||||
```
|
||||
|
||||
**Permalink configuration 6**: `/awesome/:title.html` <br/>
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── awesome
|
||||
│ └── doc1.html
|
||||
```
|
||||
|
||||
**Permalink configuration 7**: `:title.html`
|
||||
**Output**:
|
||||
|
||||
```
|
||||
├── doc1.html
|
||||
```
|
||||
|
||||
## Liquid Attributes
|
||||
|
||||
### Collections
|
||||
|
||||
Each collection is accessible via the `site` Liquid variable. For example, if
|
||||
Each collection is accessible as a field on the `site` variable. For example, if
|
||||
you want to access the `albums` collection found in `_albums`, you'd use
|
||||
`site.albums`. Each collection is itself an array of documents
|
||||
(e.g. `site.albums` is an array of documents, much like `site.pages` and
|
||||
`site.posts`). See below for how to access attributes of those documents.
|
||||
`site.albums`.
|
||||
|
||||
Each collection is itself an array of documents (e.g., `site.albums` is an array of documents, much like `site.pages` and
|
||||
`site.posts`). See the table below for how to access attributes of those documents.
|
||||
|
||||
The collections are also available under `site.collections`, with the metadata
|
||||
you specified in your `_config.yml` (if present) and the following information:
|
||||
|
@ -334,7 +419,7 @@ file, each document has the following attributes:
|
|||
|
||||
Attributes from the YAML front matter can be accessed as data anywhere in the
|
||||
site. Using the above example for configuring a collection as `site.albums`,
|
||||
one might have front matter in an individual file structured as follows (which
|
||||
you might have front matter in an individual file structured as follows (which
|
||||
must use a supported markup format, and cannot be saved with a `.yaml`
|
||||
extension):
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ script executes.
|
|||
|
||||
[Rack-Jekyll](https://github.com/adaoraul/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](https://github.com/rtomayko/shotgun/), [rackup](https://github.com/rack/rack), [mongrel](https://github.com/mongrel/mongrel), [unicorn](https://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme).
|
||||
|
||||
Read [this post](http://andycroll.com/ruby/serving-a-jekyll-blog-using-heroku) on how to deploy to Heroku using Rack-Jekyll.
|
||||
Read [this post](http://andycroll.com/ruby/serving-a-jekyll-blog-using-heroku/) on how to deploy to Heroku using Rack-Jekyll.
|
||||
|
||||
## Jekyll-Admin for Rails
|
||||
|
||||
|
@ -206,4 +206,3 @@ Setting up Kickster is very easy, just install the gem and you are good to go. M
|
|||
[Aerobatic](https://www.aerobatic.com) is an add-on for Bitbucket that brings GitHub Pages style functionality to Bitbucket users. It includes continuous deployment, custom domains with a wildcard SSL cert, CDN, basic auth, and staging branches all in the box.
|
||||
|
||||
Automating the build and deployment of a Jekyll site is just as simple as GitHub Pages - push your changes to your repo (excluding the `_site` directory) and within seconds a build will be triggered and your built site deployed to our highly- available, globally distributed hosting service. The build process will even install and execute custom Ruby plugins. See our [Jekyll docs](https://www.aerobatic.com/docs/static-generators#jekyll) for more details.
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Kramdown comes with optional support for LaTeX to PNG rendering via [MathJax](ht
|
|||
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
For more information about getting started, check out [this excellent blog post](https://web.archive.org/web/20160522225559/http://gastonsanchez.com/opinion/2014/02/16/Mathjax-with-jekyll).
|
||||
For more information about getting started, check out [this excellent blog post](http://gastonsanchez.com/visually-enforced/opinion/2014/02/16/Mathjax-with-jekyll/).
|
||||
|
||||
## Alternative Markdown Processors
|
||||
|
||||
|
|
|
@ -11,15 +11,13 @@ content, they’re also a great way to host your Jekyll-powered website for free
|
|||
|
||||
Never built a website with GitHub Pages before? [See this marvelous guide by
|
||||
Jonathan McGlone to get you up and running](http://jmcglone.com/guides/github-pages/).
|
||||
This guide will teach you what you need to know about Git, GitHub, and Jekyll to
|
||||
create your very own website on GitHub Pages.
|
||||
This guide will teach you what you need to know about Git, GitHub, and Jekyll to create your very own website on GitHub Pages.
|
||||
|
||||
### Project Page URL Structure
|
||||
|
||||
Sometimes it's nice to preview your Jekyll site before you push your `gh-pages`
|
||||
branch to GitHub. However, the subdirectory-like URL structure GitHub uses for
|
||||
Project Pages complicates the proper resolution of URLs. In order to assure your
|
||||
site builds properly, use `site.github.url` in your URL's.
|
||||
Project Pages complicates the proper resolution of URLs. In order to assure your site builds properly, use `site.github.url` in your URL's.
|
||||
|
||||
```html
|
||||
{% raw %}
|
||||
|
@ -90,7 +88,7 @@ gem 'github-pages'
|
|||
And be sure to run `bundle update` often.
|
||||
|
||||
If you like to install `pages-gem` on Windows you can find instructions by Jens Willmer on
|
||||
[how to install github-pages gem on Windows (x64)]("https://jwillmer.de/blog/tutorial/how-to-install-jekyll-and-pages-gem-on-windows-10-x46#github-pages-and-plugins").
|
||||
[how to install github-pages gem on Windows (x64)](https://jwillmer.de/blog/tutorial/how-to-install-jekyll-and-pages-gem-on-windows-10-x46#github-pages-and-plugins).
|
||||
</div>
|
||||
|
||||
<div class="note info">
|
||||
|
@ -138,7 +136,7 @@ looking at right now is contained in the [docs
|
|||
folder]({{ site.repository }}/tree/master/docs) of the same repository.
|
||||
|
||||
Please refer to GitHub official documentation on
|
||||
[user, organization and projets pages](https://help.github.com/articles/user-organization-and-project-pages/)
|
||||
[user, organization and project pages](https://help.github.com/articles/user-organization-and-project-pages/)
|
||||
to see more detailed examples.
|
||||
|
||||
<div class="note warning">
|
||||
|
|
|
@ -13,12 +13,14 @@ encountered and how we might make the process easier.
|
|||
Installing Jekyll ought to be straight-forward if all requirements are met.
|
||||
Before you start, make sure your system has the following:
|
||||
|
||||
- Linux, Unix, or macOS
|
||||
- [Ruby](https://www.ruby-lang.org/en/downloads/) (including all development
|
||||
headers, v1.9.3 or above for Jekyll 2 and v2 or above for Jekyll 3)
|
||||
- GNU/Linux, Unix, or macOS
|
||||
- [Ruby](https://www.ruby-lang.org/en/downloads/) version 2.0 or above, including all development
|
||||
headers
|
||||
- [RubyGems](https://rubygems.org/pages/download)
|
||||
- [GCC](https://gcc.gnu.org/install/) and [Make](https://www.gnu.org/software/make/) (in case your system doesn't have them installed, which you can check by running `gcc -v` and `make -v` in your system's command line interface)
|
||||
|
||||
#### Only required for Jekyll 2 and earlier
|
||||
|
||||
- [NodeJS](https://nodejs.org/), or another JavaScript runtime (for CoffeeScript support).
|
||||
- [Python 2.7](https://www.python.org/downloads/)
|
||||
|
||||
|
|
|
@ -37,8 +37,10 @@ The categories match the H3's in the history/changelog file, and they are:
|
|||
1. Major Enhancements (`+major`) – major updates or breaking changes to the code which necessitate a major version bump (v3 ~> v4)
|
||||
2. Minor Enhancements (`+minor`) – minor updates (feature, enhancement) which necessitate a minor version bump (v3.1 ~> v3.2)
|
||||
3. Bug Fixes (`+bug`) – corrections to code which do not change or add functionality, which necessitate a patch version bump (v3.1.0 ~> v3.1.1)
|
||||
4. Site Enhancements (`+site`) – changes to the source of https://jekyllrb.com, found in `site/`
|
||||
5. Development Fixes (`+dev`) – changes which do not affect user-facing functionality or documentation, such as test fixes or bumping internal dependencies
|
||||
4. Documentation (`+doc`) - changes to the documentation found in `docs/_docs/`
|
||||
5. Site Enhancements (`+site`) – changes to the source of [https://jekyllrb.com](https://jekyllrb.com) found in `docs/`
|
||||
6. Development Fixes (`+dev`) – changes which do not affect user-facing functionality or documentation, such as test fixes or bumping internal dependencies
|
||||
7. Forward Ports (`+port`) — bug fixes applied to a previous version of Jekyll pulled onto `master`, e.g. cherry-picked commits from `3-1-stable` to `master`
|
||||
|
||||
Once @jekyllbot has merged the pull request, you should see three things:
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ As with posts, if you use a permalink style that omits the `.html` file extensio
|
|||
|
||||
By default, collections follow a similar structure in the `_site` folder as pages, except that the path is prefaced by the collection name. For example: `collectionname/mypage.html`. For permalink settings that omit the file extension, the path would be `collection_name/mypage/index.html`.
|
||||
|
||||
Collections have their own way of setting permalinks. Additionally, collections have unique template variables available available (such as `path` and `output_ext`). See the [Configuring permalinks for collections]( ../collections#permalinks ) in Collections for more information.
|
||||
Collections have their own way of setting permalinks. Additionally, collections have unique template variables available available (such as `path` and `output_ext`). See the [Configuring permalinks for collections](../collections/#permalinks) in Collections for more information.
|
||||
|
||||
## Flattening pages in \_site on build
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ title: Quick-start guide
|
|||
permalink: /docs/quickstart/
|
||||
---
|
||||
|
||||
If you already have [Ruby](https://www.ruby-lang.org/en/downloads/) and [RubyGems](https://rubygems.org/pages/download) installed (see Jekyll's [requirements](/docs/installation/#requirements/)), you can create a new Jekyll site by doing the following:
|
||||
|
||||
If you already have a full [Ruby](https://www.ruby-lang.org/en/downloads/) development environment with all headers and [RubyGems](https://rubygems.org/pages/download) installed (see Jekyll's [requirements](/docs/installation/#requirements/)), you can create a new Jekyll site by doing the following:
|
||||
|
||||
```sh
|
||||
# Install Jekyll and Bundler gems through RubyGems
|
||||
|
@ -21,6 +22,8 @@ If you already have [Ruby](https://www.ruby-lang.org/en/downloads/) and [RubyGem
|
|||
# Now browse to http://localhost:4000
|
||||
```
|
||||
|
||||
If you encounter any unexpected errors during the above, please refer to the already-mentioned [requirements](/docs/installation/#requirements/) page, as you might be missing development headers or other prerequisites.
|
||||
|
||||
## About Bundler
|
||||
|
||||
`gem install jekyll bundler` installs the [jekyll](https://rubygems.org/gems/jekyll/) and [bundler](https://rubygems.org/gems/bundler) gems through [RubyGems](https://rubygems.org/). You need only to install the gems one time — not every time you create a new Jekyll project. Here are some additional details:
|
||||
|
@ -39,6 +42,9 @@ If you already have [Ruby](https://www.ruby-lang.org/en/downloads/) and [RubyGem
|
|||
* By default, the Jekyll site installed by `jekyll new` uses a gem-based theme called [Minima](https://github.com/jekyll/minima). With [gem-based themes](../themes), some of the directories and files are stored in the theme-gem, hidden from your immediate view.
|
||||
* To learn about other parameters you can include with `jekyll new`, type `jekyll new --help`.
|
||||
|
||||
When in doubt, use the <code>help</code> command to remind you of all available options and usage, it also works with the <code>new</code>, <code>build</code> and <code>serve</code> subcommands, e.g. <code>jekyll help new</code> or <code>jekyll help build</code>.
|
||||
{: .note .info }
|
||||
|
||||
## Next steps
|
||||
|
||||
Building a Jekyll site with the default theme is just the first step. The real magic happens when you start creating blog posts, using the front matter to control templates and layouts, and taking advantage of all the awesome configuration options Jekyll makes available.
|
||||
|
|
|
@ -420,56 +420,15 @@ The default is `default`. They are as follows (with what they filter):
|
|||
|
||||
### Includes
|
||||
|
||||
If you have small page fragments that you wish to include in multiple places on
|
||||
your site, you can use the `include` tag.
|
||||
If you have small page snippets that you want to include in multiple places on your site, save the snippets as *include files* and insert them where required, by using the `include` tag:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% include footer.html %}{% endraw %}
|
||||
```
|
||||
|
||||
Jekyll expects all include files to be placed in an `_includes` directory at the
|
||||
root of your source directory. This will embed the contents of
|
||||
`<source>/_includes/footer.html` into the calling file.
|
||||
Jekyll expects all *include files* to be placed in an `_includes` directory at the root of your source directory. In the above example, this will embed the contents of `_includes/footer.html` into the calling file.
|
||||
|
||||
<div class="note">
|
||||
<h5>ProTip™: Use variables as file name</h5>
|
||||
<p>
|
||||
|
||||
The name of the file you wish to embed can be literal (as in the example above),
|
||||
or you can use a variable, using liquid-like variable syntax as in
|
||||
<code>{% raw %}{% include {{my_variable}} %}{% endraw %}</code>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
You can also pass parameters to an include. Omit the quotation marks to send a variable's value. Liquid curly brackets should not be used here:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% include footer.html param="value" variable-param=page.variable %}{% endraw %}
|
||||
```
|
||||
|
||||
These parameters are available via Liquid in the include:
|
||||
|
||||
```liquid
|
||||
{% raw %}{{ include.param }}{% endraw %}
|
||||
```
|
||||
|
||||
#### Including files relative to another file
|
||||
|
||||
You can also choose to include file fragments relative to the current file:
|
||||
|
||||
```liquid
|
||||
{% raw %}{% include_relative somedir/footer.html %}{% endraw %}
|
||||
```
|
||||
|
||||
You won't need to place your included content within the `_includes` directory. Instead,
|
||||
the inclusion is specifically relative to the file where the tag is being used. For example,
|
||||
if `_posts/2014-09-03-my-file.markdown` uses the `include_relative` tag, the included file
|
||||
must be within the `_posts` directory, or one of its subdirectories. You cannot include
|
||||
files in other locations.
|
||||
|
||||
All the other capabilities of the `include` tag are available to the `include_relative` tag,
|
||||
such as using variables.
|
||||
For more advanced information on using includes, see [Includes](../includes).
|
||||
|
||||
### Code snippet highlighting
|
||||
|
||||
|
@ -529,64 +488,6 @@ site. If you use `linenos`, you might want to include an additional CSS class
|
|||
definition for the `.lineno` class in `syntax.css` to distinguish the line
|
||||
numbers from the highlighted code.
|
||||
|
||||
### Link
|
||||
|
||||
If you want to include a link to a collection's document, a post, a page
|
||||
or a file the `link` tag will generate the correct permalink URL for the path
|
||||
you specify.
|
||||
|
||||
You must include the file extension when using the `link` tag.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% link _collection/name-of-document.md %}
|
||||
{{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %}
|
||||
{{ site.baseurl }}{% link news/index.html %}
|
||||
{{ site.baseurl }}{% link /assets/files/doc.pdf %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
You can also use this tag to create a link in Markdown as follows:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
[Link to a document]({{ site.baseurl }}{% link _collection/name-of-document.md %})
|
||||
[Link to a post]({{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %})
|
||||
[Link to a page]({{ site.baseurl }}{% link news/index.html %})
|
||||
[Link to a file]({{ site.baseurl }}{% link /assets/files/doc.pdf %})
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
### Post URL
|
||||
|
||||
If you would like to include a link to a post on your site, the `post_url` tag
|
||||
will generate the correct permalink URL for the post you specify.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% post_url 2010-07-21-name-of-post %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
If you organize your posts in subdirectories, you need to include subdirectory
|
||||
path to the post:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% post_url /subdir/2010-07-21-name-of-post %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
There is no need to include the file extension when using the `post_url` tag.
|
||||
|
||||
You can also use this tag to create a link to a post in Markdown as follows:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
[Name of Link]({{ site.baseurl }}{% post_url 2010-07-21-name-of-post %})
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
### Gist
|
||||
|
||||
Use the `gist` tag to easily embed a GitHub Gist onto your site. This works
|
||||
|
@ -608,3 +509,71 @@ You may also optionally specify the filename in the gist to display:
|
|||
|
||||
To use the `gist` tag, you'll need to add the
|
||||
[jekyll-gist](https://github.com/jekyll/jekyll-gist) gem to your project.
|
||||
|
||||
## Links
|
||||
|
||||
### Linking to pages {#link}
|
||||
|
||||
To link to a post, a page, collection item, or file, the `link` tag will generate the correct permalink URL for the path you specify. For example, if you use the `link` tag to link to `mypage.html`, even if you change your permalink style to include the file extension or omit it, the URL formed by the `link` tag will always be valid.
|
||||
|
||||
You must include the file's original extension when using the `link` tag. Here are some examples:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% link _collection/name-of-document.md %}
|
||||
{{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %}
|
||||
{{ site.baseurl }}{% link news/index.html %}
|
||||
{{ site.baseurl }}{% link /assets/files/doc.pdf %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
You can also use the `link` tag to create a link in Markdown as follows:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
[Link to a document]({{ site.baseurl }}{% link _collection/name-of-document.md %})
|
||||
[Link to a post]({{ site.baseurl }}{% link _posts/2016-07-26-name-of-post.md %})
|
||||
[Link to a page]({{ site.baseurl }}{% link news/index.html %})
|
||||
[Link to a file]({{ site.baseurl }}{% link /assets/files/doc.pdf %})
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
(Including `{% raw %}{{ site.baseurl }}{% endraw %}` is optional — it depends on whether you want to preface the page URL with the `baseurl` value.)
|
||||
|
||||
The path to the post, page, or collection is defined as the path relative to the root directory (where your config file is) to the file, not the path from your existing page to the other page.
|
||||
|
||||
For example, suppose you're creating a link `page_a.md` (stored in `pages/folder1/folder2`) to `page_b.md` (stored in `pages/folder1`). Your path in the link would not be `../page_b.html`. Instead, it would be `/pages/folder1/page_b.md`.
|
||||
|
||||
If you're unsure of the path, add `{% raw %}{{ page.path }}{% endraw %}` to the page and it will display the path.
|
||||
|
||||
One major benefit of using the `link` tag is link validation. If the link doesn't exist, Jekyll won't build your site. This is a good thing, as it will alert you to a broken link so you can fix it (rather than allowing you to build and deploy a site with broken links).
|
||||
|
||||
Note you cannot add filters to `link` tags. For example, you cannot append a string using Liquid filters, such as `{% raw %}{% link mypage.html | append: "#section1" %} {% endraw %}`. To link to sections on a page, you will need to use regular HTML or Markdown linking techniques.
|
||||
|
||||
### Linking to posts
|
||||
|
||||
If you want like to include a link to a post on your site, the `post_url` tag will generate the correct permalink URL for the post you specify.
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% post_url 2010-07-21-name-of-post %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
If you organize your posts in subdirectories, you need to include subdirectory path to the post:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{{ site.baseurl }}{% post_url /subdir/2010-07-21-name-of-post %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
There is no need to include the file extension when using the `post_url` tag.
|
||||
|
||||
You can also use this tag to create a link to a post in Markdown as follows:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
[Name of Link]({{ site.baseurl }}{% post_url 2010-07-21-name-of-post %})
|
||||
{% endraw %}
|
||||
```
|
||||
|
|
|
@ -96,5 +96,12 @@ $ jekyll build --source _source --destination _deploy
|
|||
For more about the possible configuration options, see the
|
||||
[configuration](../configuration/) page.
|
||||
|
||||
<div class="note info">
|
||||
<h5>Call for help</h5>
|
||||
<p>
|
||||
The <code>help</code> command is always here to remind you of all available options and usage, and also works with the <code>build</code>, <code>serve</code> and <code>new</code> subcommands, e.g <code>jekyll help new</code> or <code>jekyll help build</code>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
If you're interested in browsing these docs on-the-go, install the
|
||||
`jekyll-docs` gem and run `jekyll docs` in your terminal.
|
||||
|
|
|
@ -15,7 +15,8 @@ A quick way to install Jekyll is to follow the [installation instructions by Dav
|
|||
2. Install Ruby via Chocolatey: `choco install ruby -y`
|
||||
3. Reopen a command prompt and install Jekyll: `gem install jekyll`
|
||||
|
||||
Updates in the infrastructure of Ruby may cause SSL errors when attempting to use `gem install` with versions of the RubyGems package older than 2.6. (The RubyGems package installed via the Chocolatey tool is version 2.3) If you have installed an older version, you can update the RubyGems package using the directions [here.][ssl-certificate-update]
|
||||
Updates in the infrastructure of Ruby may cause SSL errors when attempting to use `gem install` with versions of the RubyGems package older than 2.6. (The RubyGems package installed via the Chocolatey tool is version 2.3) If you have installed an older version, you can update the RubyGems package using the directions [here][ssl-certificate-update].
|
||||
|
||||
[ssl-certificate-update]: http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
|
||||
|
||||
For a more conventional way of installing Jekyll you can follow this [complete guide to install Jekyll 3 on Windows by Sverrir Sigmundarson][windows-installjekyll3].
|
||||
|
|
|
@ -12,6 +12,15 @@ Feature: Rendering
|
|||
Then I should get a non-zero exit-status
|
||||
And I should see "Liquid Exception" in the build output
|
||||
|
||||
Scenario: When receiving bad Liquid in included file
|
||||
Given I have a _includes directory
|
||||
And I have a "_includes/invalid.html" file that contains "{% INVALID %}"
|
||||
And I have a "index.html" page with layout "simple" that contains "{% include invalid.html %}"
|
||||
And I have a simple layout that contains "{{ content }}"
|
||||
When I run jekyll build
|
||||
Then I should get a non-zero exit-status
|
||||
And I should see "Liquid Exception.*Unknown tag 'INVALID' in.*_includes/invalid\.html" in the build output
|
||||
|
||||
Scenario: Render Liquid and place in layout
|
||||
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!"
|
||||
|
|
|
@ -16,7 +16,7 @@ module Jekyll
|
|||
:pending => "\u203D".yellow,
|
||||
:undefined => "\u2718".red,
|
||||
:passed => "\u2714".green,
|
||||
:skipped => "\u203D".blue
|
||||
:skipped => "\u203D".blue,
|
||||
}.freeze
|
||||
|
||||
#
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require "fileutils"
|
||||
require "jekyll"
|
||||
require "open3"
|
||||
require "time"
|
||||
require "safe_yaml/load"
|
||||
|
||||
|
@ -103,26 +102,18 @@ def run_jekyll(args)
|
|||
end
|
||||
|
||||
#
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def run_in_shell(*args)
|
||||
i, o, e, p = Open3.popen3(*args)
|
||||
out = o.read.strip
|
||||
err = e.read.strip
|
||||
p, output = Jekyll::Utils::Exec.run(*args)
|
||||
|
||||
[i, o, e].each(&:close)
|
||||
|
||||
File.write(Paths.status_file, p.value.exitstatus)
|
||||
File.write(Paths.status_file, p.exitstatus)
|
||||
File.open(Paths.output_file, "wb") do |f|
|
||||
f.puts "$ " << args.join(" ")
|
||||
f.puts out
|
||||
f.puts err
|
||||
f.puts "EXIT STATUS: #{p.value.exitstatus}"
|
||||
f.puts output
|
||||
f.puts "EXIT STATUS: #{p.exitstatus}"
|
||||
end
|
||||
|
||||
p.value
|
||||
p
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
#
|
||||
|
||||
|
@ -142,7 +133,7 @@ def location(folder, direction)
|
|||
end
|
||||
|
||||
[before || ".",
|
||||
after || "."]
|
||||
after || ".",]
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -160,7 +151,7 @@ def seconds_agnostic_datetime(datetime = Time.now)
|
|||
[
|
||||
Regexp.escape(date),
|
||||
"#{time}:\\d{2}",
|
||||
Regexp.escape(zone)
|
||||
Regexp.escape(zone),
|
||||
] \
|
||||
.join("\\ ")
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ module Jekyll
|
|||
fsnotify_buggy?(site),
|
||||
!deprecated_relative_permalinks(site),
|
||||
!conflicting_urls(site),
|
||||
!urls_only_differ_by_case(site)
|
||||
!urls_only_differ_by_case(site),
|
||||
].all?
|
||||
end
|
||||
|
||||
|
|
|
@ -125,23 +125,23 @@ RUBY
|
|||
# unless the user opts to generate a blank blog or skip 'bundle install'.
|
||||
|
||||
def after_install(path, options = {})
|
||||
Jekyll.logger.info "New jekyll site installed in #{path.cyan}."
|
||||
Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"]
|
||||
|
||||
unless options["blank"] || options["skip-bundle"]
|
||||
bundle_install path
|
||||
end
|
||||
|
||||
Jekyll.logger.info "New jekyll site installed in #{path.cyan}."
|
||||
Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"]
|
||||
end
|
||||
|
||||
def bundle_install(path)
|
||||
Jekyll::External.require_with_graceful_fail "bundler"
|
||||
Jekyll.logger.info "Running bundle install in #{path.cyan}..."
|
||||
Dir.chdir(path) do
|
||||
if ENV["CI"]
|
||||
system("bundle", "install", "--quiet")
|
||||
else
|
||||
system("bundle", "install")
|
||||
end
|
||||
process, output = Jekyll::Utils::Exec.run("bundle", "install")
|
||||
output.to_s.each_line do |line|
|
||||
Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty?
|
||||
end
|
||||
raise SystemExit unless process.success?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,9 +10,9 @@ module Jekyll
|
|||
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
|
||||
"port" => ["-P", "--port [PORT]", "Port to listen on"],
|
||||
"show_dir_listing" => ["--show-dir-listing",
|
||||
"Show a directory listing instead of loading your index file."],
|
||||
"Show a directory listing instead of loading your index file.",],
|
||||
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
|
||||
"Skips the initial site build which occurs before the server is started."]
|
||||
"Skips the initial site build which occurs before the server is started.",],
|
||||
}.freeze
|
||||
|
||||
#
|
||||
|
@ -88,7 +88,7 @@ module Jekyll
|
|||
index.rhtml
|
||||
index.cgi
|
||||
index.xml
|
||||
)
|
||||
),
|
||||
}
|
||||
|
||||
opts[:DirectoryIndex] = [] if opts[:JekyllOptions]["show_dir_listing"]
|
||||
|
@ -116,8 +116,8 @@ module Jekyll
|
|||
WEBrick::Config::FileHandler.merge({
|
||||
:FancyIndexing => true,
|
||||
:NondisclosureName => [
|
||||
".ht*", "~*"
|
||||
]
|
||||
".ht*", "~*",
|
||||
],
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -139,7 +139,7 @@ module Jekyll
|
|||
:prefix => ssl_enabled ? "https" : "http",
|
||||
:address => address,
|
||||
:port => port,
|
||||
:baseurl => baseurl ? "#{baseurl}/" : ""
|
||||
:baseurl => baseurl ? "#{baseurl}/" : "",
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Jekyll
|
|||
class Servlet < WEBrick::HTTPServlet::FileHandler
|
||||
DEFAULTS = {
|
||||
"Cache-Control" => "private, max-age=0, proxy-revalidate, " \
|
||||
"no-store, no-cache, must-revalidate"
|
||||
"no-store, no-cache, must-revalidate",
|
||||
}.freeze
|
||||
|
||||
def initialize(server, root, callbacks)
|
||||
|
|
|
@ -58,15 +58,15 @@ module Jekyll
|
|||
"defaults" => [],
|
||||
|
||||
"liquid" => {
|
||||
"error_mode" => "warn"
|
||||
"error_mode" => "warn",
|
||||
},
|
||||
|
||||
"rdiscount" => {
|
||||
"extensions" => []
|
||||
"extensions" => [],
|
||||
},
|
||||
|
||||
"redcarpet" => {
|
||||
"extensions" => []
|
||||
"extensions" => [],
|
||||
},
|
||||
|
||||
"kramdown" => {
|
||||
|
@ -76,8 +76,8 @@ module Jekyll
|
|||
"smart_quotes" => "lsquo,rsquo,ldquo,rdquo",
|
||||
"input" => "GFM",
|
||||
"hard_wrap" => false,
|
||||
"footnote_nr" => 1
|
||||
}
|
||||
"footnote_nr" => 1,
|
||||
},
|
||||
}.map { |k, v| [k, v.freeze] }].freeze
|
||||
|
||||
class << self
|
||||
|
|
|
@ -11,7 +11,7 @@ module Jekyll
|
|||
"line_numbers" => "inline",
|
||||
"line_number_start" => 1,
|
||||
"tab_width" => 4,
|
||||
"wrap" => "div"
|
||||
"wrap" => "div",
|
||||
}.freeze
|
||||
|
||||
def initialize(config)
|
||||
|
|
|
@ -21,7 +21,7 @@ class Jekyll::Converters::Markdown::RedcarpetParser
|
|||
code,
|
||||
{
|
||||
:lexer => lang,
|
||||
:options => { :encoding => "utf-8" }
|
||||
:options => { :encoding => "utf-8" },
|
||||
}
|
||||
),
|
||||
lang
|
||||
|
|
|
@ -196,7 +196,7 @@ module Jekyll
|
|||
@url = URL.new({
|
||||
:template => url_template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink
|
||||
:permalink => permalink,
|
||||
}).to_s
|
||||
end
|
||||
|
||||
|
@ -469,14 +469,14 @@ module Jekyll
|
|||
"category",
|
||||
"categories"
|
||||
)
|
||||
).map(&:to_s).flatten.uniq
|
||||
).map(&:to_s).flatten.uniq,
|
||||
})
|
||||
end
|
||||
|
||||
private
|
||||
def populate_tags
|
||||
merge_data!({
|
||||
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
|
||||
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module Jekyll
|
|||
def to_h
|
||||
@to_h ||= {
|
||||
"version" => version,
|
||||
"environment" => environment
|
||||
"environment" => environment,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module Jekyll
|
|||
class EntryFilter
|
||||
attr_reader :site
|
||||
SPECIAL_LEADING_CHARACTERS = [
|
||||
".", "_", "#", "~"
|
||||
".", "_", "#", "~",
|
||||
].freeze
|
||||
|
||||
def initialize(site, base_directory = nil)
|
||||
|
|
|
@ -54,7 +54,7 @@ module Jekyll
|
|||
array << {
|
||||
"name" => item.first,
|
||||
"items" => item.last,
|
||||
"size" => item.last.size
|
||||
"size" => item.last.size,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module Jekyll
|
|||
PRIORITY_MAP = {
|
||||
:low => 10,
|
||||
:normal => 20,
|
||||
:high => 30
|
||||
:high => 30,
|
||||
}.freeze
|
||||
|
||||
# initial empty hooks
|
||||
|
@ -17,26 +17,26 @@ module Jekyll
|
|||
:post_read => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => []
|
||||
:post_write => [],
|
||||
},
|
||||
:pages => {
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => []
|
||||
:post_write => [],
|
||||
},
|
||||
:posts => {
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => []
|
||||
:post_write => [],
|
||||
},
|
||||
:documents => {
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => []
|
||||
}
|
||||
:post_write => [],
|
||||
},
|
||||
}
|
||||
|
||||
# map of all hooks and their priorities
|
||||
|
@ -64,7 +64,7 @@ module Jekyll
|
|||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => []
|
||||
:post_write => [],
|
||||
}
|
||||
|
||||
unless @registry[owner][event]
|
||||
|
|
|
@ -6,7 +6,7 @@ module Jekyll
|
|||
:debug => ::Logger::DEBUG,
|
||||
:info => ::Logger::INFO,
|
||||
:warn => ::Logger::WARN,
|
||||
:error => ::Logger::ERROR
|
||||
:error => ::Logger::ERROR,
|
||||
}.freeze
|
||||
|
||||
# Public: Create a new instance of a log writer
|
||||
|
|
|
@ -98,7 +98,7 @@ module Jekyll
|
|||
@url ||= URL.new({
|
||||
:template => template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink
|
||||
:permalink => permalink,
|
||||
}).to_s
|
||||
end
|
||||
|
||||
|
@ -108,7 +108,7 @@ module Jekyll
|
|||
{
|
||||
:path => @dir,
|
||||
:basename => basename,
|
||||
:output_ext => output_ext
|
||||
:output_ext => output_ext,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ module Jekyll
|
|||
:highest => 100,
|
||||
:lowest => -100,
|
||||
:normal => 0,
|
||||
:high => 10
|
||||
:high => 10,
|
||||
}.freeze
|
||||
|
||||
#
|
||||
|
|
|
@ -54,7 +54,7 @@ module Jekyll
|
|||
when ".csv"
|
||||
CSV.read(path, {
|
||||
:headers => true,
|
||||
:encoding => site.config["encoding"]
|
||||
:encoding => site.config["encoding"],
|
||||
}).map(&:to_hash)
|
||||
else
|
||||
SafeYAML.load_file(path)
|
||||
|
|
|
@ -57,7 +57,7 @@ module Jekyll
|
|||
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
|
||||
Document.new(path, {
|
||||
:site => @site,
|
||||
:collection => @site.posts
|
||||
:collection => @site.posts,
|
||||
})
|
||||
end.reject(&:nil?)
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ module Jekyll
|
|||
|
||||
metadata[path] = {
|
||||
"mtime" => File.mtime(path),
|
||||
"deps" => []
|
||||
"deps" => [],
|
||||
}
|
||||
cache[path] = true
|
||||
end
|
||||
|
|
|
@ -435,7 +435,7 @@ module Jekyll
|
|||
private
|
||||
def configure_include_paths
|
||||
@includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
|
||||
@includes_load_paths << theme.includes_path if self.theme
|
||||
@includes_load_paths << theme.includes_path if theme && theme.includes_path
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -101,7 +101,7 @@ module Jekyll
|
|||
"name" => name,
|
||||
"extname" => extname,
|
||||
"modified_time" => modified_time,
|
||||
"path" => File.join("", relative_path)
|
||||
"path" => File.join("", relative_path),
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -112,7 +112,7 @@ module Jekyll
|
|||
@collection.relative_directory.size..relative_path.size],
|
||||
:output_ext => "",
|
||||
:name => "",
|
||||
:title => ""
|
||||
:title => "",
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ module Jekyll
|
|||
else
|
||||
::Jekyll::URL.new({
|
||||
:template => @collection.url_template,
|
||||
:placeholders => placeholders
|
||||
:placeholders => placeholders,
|
||||
})
|
||||
end.to_s.gsub(%r!/$!, "")
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ eos
|
|||
[:hl_lines, opts.fetch(:hl_lines, nil)],
|
||||
[:linenos, opts.fetch(:linenos, nil)],
|
||||
[:encoding, opts.fetch(:encoding, "utf-8")],
|
||||
[:cssclass, opts.fetch(:cssclass, nil)]
|
||||
[:cssclass, opts.fetch(:cssclass, nil)],
|
||||
].reject { |f| f.last.nil? }]
|
||||
else
|
||||
opts
|
||||
|
@ -125,7 +125,7 @@ eos
|
|||
def add_code_tag(code)
|
||||
code_attributes = [
|
||||
"class=\"language-#{@lang.to_s.tr("+", "-")}\"",
|
||||
"data-lang=\"#{@lang}\""
|
||||
"data-lang=\"#{@lang}\"",
|
||||
].join(" ")
|
||||
"<figure class=\"highlight\"><pre><code #{code_attributes}>"\
|
||||
"#{code.chomp}</code></pre></figure>"
|
||||
|
|
|
@ -112,8 +112,8 @@ eos
|
|||
def locate_include_file(context, file, safe)
|
||||
includes_dirs = tag_includes_dirs(context)
|
||||
includes_dirs.each do |dir|
|
||||
path = File.join(dir, file)
|
||||
return path if valid_include_file?(path, dir, safe)
|
||||
path = File.join(dir.to_s, file.to_s)
|
||||
return path if valid_include_file?(path, dir.to_s, safe)
|
||||
end
|
||||
raise IOError, "Could not locate the included file '#{file}' in any of "\
|
||||
"#{includes_dirs}. Ensure it exists in one of those directories and, "\
|
||||
|
@ -155,15 +155,19 @@ eos
|
|||
if cached_partial.key?(path)
|
||||
cached_partial[path]
|
||||
else
|
||||
cached_partial[path] = context.registers[:site]
|
||||
unparsed_file = context.registers[:site]
|
||||
.liquid_renderer
|
||||
.file(path)
|
||||
.parse(read_file(path, context))
|
||||
begin
|
||||
cached_partial[path] = unparsed_file.parse(read_file(path, context))
|
||||
rescue Liquid::SyntaxError => ex
|
||||
raise IncludeTagError.new(ex.message, path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def valid_include_file?(path, dir, safe)
|
||||
!(outside_site_source?(path, dir, safe) || !File.exist?(path))
|
||||
!outside_site_source?(path, dir, safe) && File.file?(path)
|
||||
end
|
||||
|
||||
def outside_site_source?(path, dir, safe)
|
||||
|
|
|
@ -28,7 +28,7 @@ class Jekyll::ThemeBuilder
|
|||
def template_file(filename)
|
||||
[
|
||||
root.join("theme_template", "#{filename}.erb"),
|
||||
root.join("theme_template", filename.to_s)
|
||||
root.join("theme_template", filename.to_s),
|
||||
].find(&:exist?)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
module Jekyll
|
||||
module Utils
|
||||
extend self
|
||||
autoload :Platforms, "jekyll/utils/platforms"
|
||||
autoload :Ansi, "jekyll/utils/ansi"
|
||||
autoload :Exec, "jekyll/utils/exec"
|
||||
autoload :Platforms, "jekyll/utils/platforms"
|
||||
autoload :WinTZ, "jekyll/utils/win_tz"
|
||||
|
||||
# Constants for use in #slugify
|
||||
|
|
|
@ -17,7 +17,7 @@ module Jekyll
|
|||
:yellow => 33,
|
||||
:white => 37,
|
||||
:blue => 34,
|
||||
:cyan => 36
|
||||
:cyan => 36,
|
||||
}.freeze
|
||||
|
||||
# Strip ANSI from the current string. It also strips cursor stuff,
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
require "open3"
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
module Exec
|
||||
extend self
|
||||
|
||||
# Runs a program in a sub-shell.
|
||||
#
|
||||
# *args - a list of strings containing the program name and arguments
|
||||
#
|
||||
# Returns a Process::Status and a String of output in an array in
|
||||
# that order.
|
||||
def run(*args)
|
||||
stdin, stdout, stderr, process = Open3.popen3(*args)
|
||||
out = stdout.read.strip
|
||||
err = stderr.read.strip
|
||||
|
||||
[stdin, stdout, stderr].each(&:close)
|
||||
[process.value, out + err]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@
|
|||
namespace :docs do
|
||||
desc "Release #{docs_name} v#{version}"
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
unless `git branch` =~ %r!^\* master$!
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
desc "Release #{name} v#{version}"
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
unless `git branch` =~ %r!^\* master$!
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace :site do
|
|||
require "jekyll"
|
||||
|
||||
browser_launched = false
|
||||
Jekyll::Hooks.register :site, :post_write do |site|
|
||||
Jekyll::Hooks.register :site, :post_write do |_site|
|
||||
next if browser_launched
|
||||
browser_launched = true
|
||||
Jekyll.logger.info "Opening in browser..."
|
||||
|
@ -26,7 +26,7 @@ namespace :site do
|
|||
"source" => File.expand_path(docs_folder),
|
||||
"destination" => File.expand_path("#{docs_folder}/_site"),
|
||||
"watch" => true,
|
||||
"serving" => true
|
||||
"serving" => true,
|
||||
}
|
||||
Jekyll::Commands::Build.process(options)
|
||||
Jekyll::Commands::Serve.process(options)
|
||||
|
@ -38,7 +38,7 @@ namespace :site do
|
|||
Jekyll::Commands::Build.process({
|
||||
"profile" => true,
|
||||
"source" => File.expand_path(docs_folder),
|
||||
"destination" => File.expand_path("#{docs_folder}/_site")
|
||||
"destination" => File.expand_path("#{docs_folder}/_site"),
|
||||
})
|
||||
end
|
||||
task :build => :generate
|
||||
|
@ -48,7 +48,7 @@ namespace :site do
|
|||
Dir.chdir("#{docs_folder}/_sass") do
|
||||
sh 'curl "https://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
|
||||
sh 'sass "normalize.scss":"_normalize.scss" --style compressed'
|
||||
rm ['normalize.scss', Dir.glob('*.map')].flatten
|
||||
rm ["normalize.scss", Dir.glob("*.map")].flatten
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,40 +60,40 @@ namespace :site do
|
|||
|
||||
desc "Create a nicely formatted history page for the jekyll site based on the repo history."
|
||||
task :history do
|
||||
siteify_file('History.markdown', { "title" => "History" })
|
||||
siteify_file("History.markdown", { "title" => "History" })
|
||||
end
|
||||
|
||||
desc "Copy the Code of Conduct"
|
||||
task :conduct do
|
||||
front_matter = {
|
||||
"redirect_from" => "/conduct/index.html",
|
||||
"editable" => false
|
||||
"editable" => false,
|
||||
}
|
||||
siteify_file('CONDUCT.markdown', front_matter)
|
||||
siteify_file("CONDUCT.markdown", front_matter)
|
||||
end
|
||||
|
||||
desc "Copy the contributing file"
|
||||
task :contributing do
|
||||
siteify_file('.github/CONTRIBUTING.markdown', "title" => "Contributing")
|
||||
siteify_file(".github/CONTRIBUTING.markdown", "title" => "Contributing")
|
||||
end
|
||||
|
||||
desc "Write the site latest_version.txt file"
|
||||
task :version_file do
|
||||
File.open("#{docs_folder}/latest_version.txt", 'wb') { |f| f.puts(version) } unless version =~ /(beta|rc|alpha)/i
|
||||
File.open("#{docs_folder}/latest_version.txt", "wb") { |f| f.puts(version) } unless version =~ %r!(beta|rc|alpha)!i
|
||||
end
|
||||
|
||||
namespace :releases do
|
||||
desc "Create new release post"
|
||||
task :new, :version do |t, args|
|
||||
task :new, :version do |_t, args|
|
||||
raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
|
||||
today = Time.new.strftime('%Y-%m-%d')
|
||||
today = Time.new.strftime("%Y-%m-%d")
|
||||
release = args.version.to_s
|
||||
filename = "#{docs_folder}/_posts/#{today}-jekyll-#{release.split('.').join('-')}-released.markdown"
|
||||
filename = "#{docs_folder}/_posts/#{today}-jekyll-#{release.split(".").join("-")}-released.markdown"
|
||||
|
||||
File.open(filename, "wb") do |post|
|
||||
post.puts("---")
|
||||
post.puts("title: 'Jekyll #{release} Released'")
|
||||
post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}")
|
||||
post.puts("date: #{Time.new.strftime("%Y-%m-%d %H:%M:%S %z")}")
|
||||
post.puts("author: ")
|
||||
post.puts("version: #{release}")
|
||||
post.puts("categories: [release]")
|
||||
|
|
|
@ -32,4 +32,4 @@ bundle exec jekyll build -s $SOURCE -d $DESTINATION --trace
|
|||
|
||||
# 3.
|
||||
msg "Proofing..."
|
||||
time bundle exec htmlproof ./$DESTINATION --url-ignore $INGORE_HREFS $@
|
||||
time bundle exec htmlproofer ./$DESTINATION --url-ignore $INGORE_HREFS $@
|
||||
|
|
|
@ -46,7 +46,7 @@ include Jekyll
|
|||
Minitest::Reporters.use! [
|
||||
Minitest::Reporters::DefaultReporter.new(
|
||||
:color => true
|
||||
)
|
||||
),
|
||||
]
|
||||
|
||||
module Minitest::Assertions
|
||||
|
@ -62,6 +62,10 @@ module Minitest::Assertions
|
|||
end
|
||||
|
||||
module DirectoryHelpers
|
||||
def root_dir(*subdirs)
|
||||
File.join(File.dirname(File.dirname(__FILE__)), *subdirs)
|
||||
end
|
||||
|
||||
def dest_dir(*subdirs)
|
||||
test_dir("dest", *subdirs)
|
||||
end
|
||||
|
@ -70,8 +74,12 @@ module DirectoryHelpers
|
|||
test_dir("source", *subdirs)
|
||||
end
|
||||
|
||||
def theme_dir(*subdirs)
|
||||
test_dir("fixtures", "test-theme", *subdirs)
|
||||
end
|
||||
|
||||
def test_dir(*subdirs)
|
||||
File.join(File.dirname(__FILE__), *subdirs)
|
||||
root_dir("test", *subdirs)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -107,9 +115,9 @@ class JekyllUnitTest < Minitest::Test
|
|||
site = fixture_site({
|
||||
"collections" => {
|
||||
"methods" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
site.read
|
||||
matching_doc = site.collections["methods"].docs.find do |doc|
|
||||
|
@ -133,10 +141,10 @@ class JekyllUnitTest < Minitest::Test
|
|||
def site_configuration(overrides = {})
|
||||
full_overrides = build_configs(overrides, build_configs({
|
||||
"destination" => dest_dir,
|
||||
"incremental" => false
|
||||
"incremental" => false,
|
||||
}))
|
||||
Configuration.from(full_overrides.merge({
|
||||
"source" => source_dir
|
||||
"source" => source_dir,
|
||||
}))
|
||||
end
|
||||
|
||||
|
@ -159,11 +167,11 @@ class JekyllUnitTest < Minitest::Test
|
|||
end
|
||||
|
||||
def capture_output
|
||||
stderr = StringIO.new
|
||||
Jekyll.logger = Logger.new stderr
|
||||
buffer = StringIO.new
|
||||
Jekyll.logger = Logger.new(buffer)
|
||||
yield
|
||||
stderr.rewind
|
||||
return stderr.string.to_s
|
||||
buffer.rewind
|
||||
buffer.string.to_s
|
||||
end
|
||||
alias_method :capture_stdout, :capture_output
|
||||
alias_method :capture_stderr, :capture_output
|
||||
|
|
|
@ -2,7 +2,6 @@ module Jekyll
|
|||
class Dummy < Generator
|
||||
priority :high
|
||||
|
||||
def generate(site)
|
||||
end
|
||||
def generate(site) end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -91,9 +91,9 @@ class TestCollections < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"methods" => {
|
||||
"permalink" => "/awesome/:path/"
|
||||
}
|
||||
}
|
||||
"permalink" => "/awesome/:path/",
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["methods"]
|
||||
|
@ -107,7 +107,7 @@ class TestCollections < JekyllUnitTest
|
|||
context "with a collection" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["methods"]
|
||||
"collections" => ["methods"],
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["methods"]
|
||||
|
@ -158,9 +158,9 @@ class TestCollections < JekyllUnitTest
|
|||
"collections" => {
|
||||
"methods" => {
|
||||
"foo" => "bar",
|
||||
"baz" => "whoo"
|
||||
}
|
||||
}
|
||||
"baz" => "whoo",
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["methods"]
|
||||
|
@ -175,7 +175,7 @@ class TestCollections < JekyllUnitTest
|
|||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["methods"],
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["methods"]
|
||||
|
@ -198,7 +198,7 @@ class TestCollections < JekyllUnitTest
|
|||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["with.dots"],
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["with.dots"]
|
||||
|
|
|
@ -86,12 +86,12 @@ class TestCommandsServe < JekyllUnitTest
|
|||
"config" => %w(_config.yml _development.yml),
|
||||
"serving" => true,
|
||||
"watch" => false, # for not having guard output when running the tests
|
||||
"url" => "http://localhost:4000"
|
||||
"url" => "http://localhost:4000",
|
||||
}
|
||||
|
||||
expect(Jekyll::Commands::Serve).to receive(:process).with(custom_options)
|
||||
@merc.execute(:serve, { "config" => %w(_config.yml _development.yml),
|
||||
"watch" => false })
|
||||
"watch" => false, })
|
||||
end
|
||||
|
||||
context "in development environment" do
|
||||
|
@ -113,7 +113,7 @@ class TestCommandsServe < JekyllUnitTest
|
|||
"port" => "9999",
|
||||
"url" => "https://jekyllrb.com/",
|
||||
"ssl_cert" => "foo",
|
||||
"ssl_key" => "bar"
|
||||
"ssl_key" => "bar",
|
||||
})
|
||||
|
||||
assert_equal 1, Jekyll.sites.count
|
||||
|
@ -146,13 +146,13 @@ class TestCommandsServe < JekyllUnitTest
|
|||
should "raise if enabling without key or cert" do
|
||||
assert_raises RuntimeError do
|
||||
custom_opts({
|
||||
"ssl_key" => "foo"
|
||||
"ssl_key" => "foo",
|
||||
})
|
||||
end
|
||||
|
||||
assert_raises RuntimeError do
|
||||
custom_opts({
|
||||
"ssl_key" => "foo"
|
||||
"ssl_key" => "foo",
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -166,7 +166,7 @@ class TestCommandsServe < JekyllUnitTest
|
|||
"ssl_cert" => "foo",
|
||||
"source" => "bar",
|
||||
"enable_ssl" => true,
|
||||
"ssl_key" => "bar"
|
||||
"ssl_key" => "bar",
|
||||
})
|
||||
|
||||
assert result[:SSLEnable]
|
||||
|
|
|
@ -4,7 +4,7 @@ require "colorator"
|
|||
class TestConfiguration < JekyllUnitTest
|
||||
test_config = {
|
||||
"source" => new(nil).source_dir,
|
||||
"destination" => dest_dir
|
||||
"destination" => dest_dir,
|
||||
}
|
||||
|
||||
context ".from" do
|
||||
|
@ -34,8 +34,8 @@ class TestConfiguration < JekyllUnitTest
|
|||
{
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
},
|
||||
}
|
||||
)
|
||||
end
|
||||
|
@ -85,8 +85,8 @@ class TestConfiguration < JekyllUnitTest
|
|||
{
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title/"
|
||||
}
|
||||
"permalink" => "/:categories/:year/:month/:day/:title/",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -109,14 +109,14 @@ class TestConfiguration < JekyllUnitTest
|
|||
:permalink => "date",
|
||||
"baseurl" => "/",
|
||||
:include => [".htaccess"],
|
||||
:source => "./"
|
||||
:source => "./",
|
||||
}]
|
||||
@string_keys = Configuration[{
|
||||
"markdown" => "kramdown",
|
||||
"permalink" => "date",
|
||||
"baseurl" => "/",
|
||||
"include" => [".htaccess"],
|
||||
"source" => "./"
|
||||
"source" => "./",
|
||||
}]
|
||||
end
|
||||
should "stringify symbol keys" do
|
||||
|
@ -132,7 +132,7 @@ class TestConfiguration < JekyllUnitTest
|
|||
@no_override = {}
|
||||
@one_config_file = { "config" => "config.yml" }
|
||||
@multiple_files = {
|
||||
"config" => %w(config/site.yml config/deploy.toml configuration.yml)
|
||||
"config" => %w(config/site.yml config/deploy.toml configuration.yml),
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -205,7 +205,7 @@ class TestConfiguration < JekyllUnitTest
|
|||
"pygments" => true,
|
||||
"plugins" => true,
|
||||
"layouts" => true,
|
||||
"data_source" => true
|
||||
"data_source" => true,
|
||||
}]
|
||||
end
|
||||
should "unset 'auto' and 'watch'" do
|
||||
|
@ -255,7 +255,7 @@ class TestConfiguration < JekyllUnitTest
|
|||
setup do
|
||||
@config = proc do |val|
|
||||
Configuration[{
|
||||
"paginate" => val
|
||||
"paginate" => val,
|
||||
}]
|
||||
end
|
||||
end
|
||||
|
@ -327,7 +327,7 @@ class TestConfiguration < JekyllUnitTest
|
|||
:default => source_dir("_config.yml"),
|
||||
:other => source_dir("_config.live.yml"),
|
||||
:toml => source_dir("_config.dev.toml"),
|
||||
:empty => ""
|
||||
:empty => "",
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -372,7 +372,7 @@ class TestConfiguration < JekyllUnitTest
|
|||
Jekyll.logger.log_level = :warn
|
||||
assert_equal \
|
||||
site_configuration({ "baseurl" => "/you-beautiful-blog-you",
|
||||
"title" => "My magnificent site, wut" }),
|
||||
"title" => "My magnificent site, wut", }),
|
||||
Jekyll.configuration(test_config.merge({ "config" => [@paths[:toml]] }))
|
||||
Jekyll.logger.log_level = :info
|
||||
end
|
||||
|
@ -435,9 +435,9 @@ class TestConfiguration < JekyllUnitTest
|
|||
"docs" => {},
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}
|
||||
}
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -449,9 +449,9 @@ class TestConfiguration < JekyllUnitTest
|
|||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}
|
||||
}
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -461,9 +461,9 @@ class TestConfiguration < JekyllUnitTest
|
|||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext"
|
||||
}
|
||||
}
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -471,16 +471,16 @@ class TestConfiguration < JekyllUnitTest
|
|||
posts_permalink = "/:year/:title/"
|
||||
conf = Configuration[default_configuration].tap do |c|
|
||||
c["collections"] = {
|
||||
"posts" => { "permalink" => posts_permalink }
|
||||
"posts" => { "permalink" => posts_permalink },
|
||||
}
|
||||
end
|
||||
assert_equal conf.add_default_collections, conf.merge({
|
||||
"collections" => {
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => posts_permalink
|
||||
}
|
||||
}
|
||||
"permalink" => posts_permalink,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class TestDoctorCommand < JekyllUnitTest
|
|||
should "return success on a valid site/page" do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => File.join(source_dir, "/_urls_differ_by_case_valid"),
|
||||
"destination" => dest_dir
|
||||
"destination" => dest_dir,
|
||||
}))
|
||||
@site.process
|
||||
output = capture_stderr do
|
||||
|
@ -23,7 +23,7 @@ class TestDoctorCommand < JekyllUnitTest
|
|||
should "return warning for pages only differing by case" do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => File.join(source_dir, "/_urls_differ_by_case_invalid"),
|
||||
"destination" => dest_dir
|
||||
"destination" => dest_dir,
|
||||
}))
|
||||
@site.process
|
||||
output = capture_stderr do
|
||||
|
|
|
@ -8,7 +8,7 @@ class TestDocument < JekyllUnitTest
|
|||
context "a document in a collection" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["methods"]
|
||||
"collections" => ["methods"],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["methods"].docs.detect do |d|
|
||||
|
@ -118,10 +118,10 @@ class TestDocument < JekyllUnitTest
|
|||
"scope" => { "path"=>"", "type"=>"slides" },
|
||||
"values" => {
|
||||
"nested" => {
|
||||
"key" => "myval"
|
||||
}
|
||||
}
|
||||
}]
|
||||
"key" => "myval",
|
||||
},
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first
|
||||
|
@ -143,10 +143,10 @@ class TestDocument < JekyllUnitTest
|
|||
"values" => {
|
||||
"nested" => {
|
||||
"test1" => "default1",
|
||||
"test2" => "default1"
|
||||
}
|
||||
}
|
||||
}]
|
||||
"test2" => "default1",
|
||||
},
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[1]
|
||||
|
@ -170,10 +170,10 @@ class TestDocument < JekyllUnitTest
|
|||
"scope" => { "path"=>"_slides", "type"=>"slides" },
|
||||
"values" => {
|
||||
"nested" => {
|
||||
"key" => "value123"
|
||||
}
|
||||
}
|
||||
}]
|
||||
"key" => "value123",
|
||||
},
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs.first
|
||||
|
@ -194,10 +194,10 @@ class TestDocument < JekyllUnitTest
|
|||
"scope" => { "path"=>"somepath", "type"=>"slides" },
|
||||
"values" => {
|
||||
"nested" => {
|
||||
"key" => "myval"
|
||||
}
|
||||
}
|
||||
}]
|
||||
"key" => "myval",
|
||||
},
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs.first
|
||||
|
@ -213,7 +213,7 @@ class TestDocument < JekyllUnitTest
|
|||
context "a document in a collection with a custom permalink" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["slides"]
|
||||
"collections" => ["slides"],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[2]
|
||||
|
@ -235,10 +235,10 @@ class TestDocument < JekyllUnitTest
|
|||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true,
|
||||
"permalink" => "/slides/test/:name"
|
||||
}
|
||||
"permalink" => "/slides/test/:name",
|
||||
},
|
||||
"permalink" => "pretty"
|
||||
},
|
||||
"permalink" => "pretty",
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[0]
|
||||
|
@ -263,9 +263,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.permalink_style = :pretty
|
||||
@site.process
|
||||
|
@ -287,9 +287,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.permalink_style = :pretty
|
||||
@site.process
|
||||
|
@ -307,9 +307,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[6]
|
||||
|
@ -339,9 +339,9 @@ class TestDocument < JekyllUnitTest
|
|||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true,
|
||||
"permalink" => "/slides/:title"
|
||||
}
|
||||
}
|
||||
"permalink" => "/slides/:title",
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[3]
|
||||
|
@ -381,8 +381,8 @@ class TestDocument < JekyllUnitTest
|
|||
context "document with a permalink with dots & a trailing slash" do
|
||||
setup do
|
||||
@site = fixture_site({ "collections" => {
|
||||
"with.dots" => { "output" => true }
|
||||
} })
|
||||
"with.dots" => { "output" => true },
|
||||
}, })
|
||||
@site.process
|
||||
@document = @site.collections["with.dots"].docs.last
|
||||
@dest_file = dest_dir("with.dots", "permalink.with.slash.tho", "index.html")
|
||||
|
@ -406,9 +406,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@files = @site.collections["slides"].docs
|
||||
|
@ -436,9 +436,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["slides"].files.find do |doc|
|
||||
|
@ -469,9 +469,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"methods" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["methods"].docs.find do |doc|
|
||||
|
@ -498,9 +498,9 @@ class TestDocument < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"methods" => {
|
||||
"output" => true
|
||||
}
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
},
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["methods"].docs.find do |doc|
|
||||
|
|
|
@ -4,7 +4,7 @@ class TestDrop < JekyllUnitTest
|
|||
context "a document drop" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["methods"]
|
||||
"collections" => ["methods"],
|
||||
})
|
||||
@site.process
|
||||
@document = @site.collections["methods"].docs.detect do |d|
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestEntryFilter < JekyllUnitTest
|
|||
should "allow regexp filtering" do
|
||||
files = %w(README.md)
|
||||
@site.exclude = [
|
||||
%r!README!
|
||||
%r!README!,
|
||||
]
|
||||
|
||||
assert_empty @site.reader.filter_entries(
|
||||
|
|
|
@ -4,13 +4,13 @@ class TestExcerpt < JekyllUnitTest
|
|||
def setup_post(file)
|
||||
Document.new(@site.in_source_dir(File.join("_posts", file)), {
|
||||
:site => @site,
|
||||
:collection => @site.posts
|
||||
:collection => @site.posts,
|
||||
}).tap(&:read)
|
||||
end
|
||||
|
||||
def do_render(document)
|
||||
@site.layouts = {
|
||||
"default" => Layout.new(@site, source_dir("_layouts"), "simple.html")
|
||||
"default" => Layout.new(@site, source_dir("_layouts"), "simple.html"),
|
||||
}
|
||||
document.output = Jekyll::Renderer.new(@site, document, @site.site_payload).run
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ class TestFilters < JekyllUnitTest
|
|||
@filter = make_filter_mock({
|
||||
"timezone" => "UTC",
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => "/base"
|
||||
"baseurl" => "/base",
|
||||
})
|
||||
@sample_time = Time.utc(2013, 3, 27, 11, 22, 33)
|
||||
@sample_date = Date.parse("2013-03-27")
|
||||
|
@ -39,7 +39,7 @@ class TestFilters < JekyllUnitTest
|
|||
@array_of_objects = [
|
||||
{ "color" => "red", "size" => "large" },
|
||||
{ "color" => "red", "size" => "medium" },
|
||||
{ "color" => "blue", "size" => "medium" }
|
||||
{ "color" => "blue", "size" => "medium" },
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -332,7 +332,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = "about/my_favorite_page/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => "base"
|
||||
"baseurl" => "base",
|
||||
})
|
||||
assert_equal "http://example.com/base/#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
@ -341,7 +341,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = "about/my_favorite_page/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "",
|
||||
"baseurl" => "base"
|
||||
"baseurl" => "base",
|
||||
})
|
||||
assert_equal "/base/#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
@ -350,7 +350,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = "about/my_favorite_page/"
|
||||
filter = make_filter_mock({
|
||||
"url" => nil,
|
||||
"baseurl" => "base"
|
||||
"baseurl" => "base",
|
||||
})
|
||||
assert_equal "/base/#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
@ -359,7 +359,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = "about/my_favorite_page/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => nil
|
||||
"baseurl" => nil,
|
||||
})
|
||||
assert_equal "http://example.com/#{page_url}", filter.absolute_url(page_url)
|
||||
end
|
||||
|
@ -368,16 +368,34 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = ""
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => "/base"
|
||||
"baseurl" => "/base",
|
||||
})
|
||||
assert_equal "http://example.com/base", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "not append a forward slash if input is '/'" do
|
||||
page_url = "/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => "/base",
|
||||
})
|
||||
assert_equal "http://example.com/base/", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "not append a forward slash if input is '/' and nil 'baseurl'" do
|
||||
page_url = "/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => nil,
|
||||
})
|
||||
assert_equal "http://example.com/", filter.absolute_url(page_url)
|
||||
end
|
||||
|
||||
should "normalize international URLs" do
|
||||
page_url = ""
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://ümlaut.example.org/",
|
||||
"baseurl" => nil
|
||||
"baseurl" => nil,
|
||||
})
|
||||
assert_equal "http://xn--mlaut-jva.example.org/", filter.absolute_url(page_url)
|
||||
end
|
||||
|
@ -409,7 +427,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = "about/my_favorite_page/"
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => nil
|
||||
"baseurl" => nil,
|
||||
})
|
||||
assert_equal "/#{page_url}", filter.relative_url(page_url)
|
||||
end
|
||||
|
@ -418,7 +436,7 @@ class TestFilters < JekyllUnitTest
|
|||
page_url = ""
|
||||
filter = make_filter_mock({
|
||||
"url" => "http://example.com",
|
||||
"baseurl" => "/base"
|
||||
"baseurl" => "/base",
|
||||
})
|
||||
assert_equal "/base", filter.relative_url(page_url)
|
||||
end
|
||||
|
@ -451,7 +469,7 @@ class TestFilters < JekyllUnitTest
|
|||
"excerpt" => "<p>This should be published.</p>\n",
|
||||
"draft" => false,
|
||||
"categories" => [
|
||||
"publish_test"
|
||||
"publish_test",
|
||||
],
|
||||
"layout" => "default",
|
||||
"title" => "Publish",
|
||||
|
@ -459,7 +477,7 @@ class TestFilters < JekyllUnitTest
|
|||
"date" => "2008-02-02 00:00:00 +0000",
|
||||
"slug" => "published",
|
||||
"ext" => ".markdown",
|
||||
"tags" => []
|
||||
"tags" => [],
|
||||
}
|
||||
actual = JSON.parse(@filter.jsonify(@filter.site.docs_to_write.first.to_liquid))
|
||||
|
||||
|
@ -475,7 +493,7 @@ class TestFilters < JekyllUnitTest
|
|||
actual = @filter.jsonify(@filter.site.to_liquid)
|
||||
assert_equal JSON.parse(actual)["jekyll"], {
|
||||
"environment" => "development",
|
||||
"version" => Jekyll::VERSION
|
||||
"version" => Jekyll::VERSION,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -491,7 +509,7 @@ class TestFilters < JekyllUnitTest
|
|||
"name" => name,
|
||||
:v => 1,
|
||||
:thing => M.new({ :kay => "jewelers" }),
|
||||
:stuff => true
|
||||
:stuff => true,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -503,21 +521,21 @@ class TestFilters < JekyllUnitTest
|
|||
"v" => 1,
|
||||
"thing" => [
|
||||
{
|
||||
"kay" => "jewelers"
|
||||
}
|
||||
"kay" => "jewelers",
|
||||
},
|
||||
],
|
||||
"stuff" => true
|
||||
"stuff" => true,
|
||||
},
|
||||
{
|
||||
"name" => "Smathers",
|
||||
"v" => 1,
|
||||
"thing" => [
|
||||
{
|
||||
"kay" => "jewelers"
|
||||
}
|
||||
"kay" => "jewelers",
|
||||
},
|
||||
],
|
||||
"stuff" => true
|
||||
}
|
||||
"stuff" => true,
|
||||
},
|
||||
]
|
||||
result = @filter.jsonify([T.new("Jeremiah"), T.new("Smathers")])
|
||||
assert_equal expected, JSON.parse(result)
|
||||
|
@ -533,32 +551,32 @@ class TestFilters < JekyllUnitTest
|
|||
"v" => 1,
|
||||
"thing" => [
|
||||
{
|
||||
"kay" => "jewelers"
|
||||
}
|
||||
"kay" => "jewelers",
|
||||
},
|
||||
],
|
||||
"stuff" => true
|
||||
"stuff" => true,
|
||||
},
|
||||
{
|
||||
"name" => 1,
|
||||
"v" => 1,
|
||||
"thing" => [
|
||||
{
|
||||
"kay" => "jewelers"
|
||||
}
|
||||
"kay" => "jewelers",
|
||||
},
|
||||
],
|
||||
"stuff" => true
|
||||
"stuff" => true,
|
||||
},
|
||||
{
|
||||
"name" => 2,
|
||||
"v" => 1,
|
||||
"thing" => [
|
||||
{
|
||||
"kay" => "jewelers"
|
||||
}
|
||||
"kay" => "jewelers",
|
||||
},
|
||||
],
|
||||
"stuff" => true,
|
||||
},
|
||||
],
|
||||
"stuff" => true
|
||||
}
|
||||
]
|
||||
}
|
||||
result = @filter.jsonify(my_hash)
|
||||
assert_equal expected, JSON.parse(result)
|
||||
|
@ -633,7 +651,7 @@ class TestFilters < JekyllUnitTest
|
|||
hash = {
|
||||
"a" => { "tags"=>%w(x y) },
|
||||
"b" => { "tags"=>["x"] },
|
||||
"c" => { "tags"=>%w(y z) }
|
||||
"c" => { "tags"=>%w(y z) },
|
||||
}
|
||||
assert_equal 2, @filter.where(hash, "tags", "x").length
|
||||
end
|
||||
|
@ -642,7 +660,7 @@ class TestFilters < JekyllUnitTest
|
|||
hash = {
|
||||
"a" => { "tags"=>%w(x y) },
|
||||
"b" => { "tags"=>"x" },
|
||||
"c" => { "tags"=>%w(y z) }
|
||||
"c" => { "tags"=>%w(y z) },
|
||||
}
|
||||
assert_equal 2, @filter.where(hash, "tags", "x").length
|
||||
end
|
||||
|
@ -651,7 +669,7 @@ class TestFilters < JekyllUnitTest
|
|||
hash = {
|
||||
"a" => { "category"=>"bear" },
|
||||
"b" => { "category"=>"wolf" },
|
||||
"c" => { "category"=>%w(bear lion) }
|
||||
"c" => { "category"=>%w(bear lion) },
|
||||
}
|
||||
assert_equal 0, @filter.where(hash, "category", "ear").length
|
||||
end
|
||||
|
@ -660,7 +678,7 @@ class TestFilters < JekyllUnitTest
|
|||
hash = {
|
||||
"The Words" => { "rating" => 1.2, "featured" => false },
|
||||
"Limitless" => { "rating" => 9.2, "featured" => true },
|
||||
"Hustle" => { "rating" => 4.7, "featured" => true }
|
||||
"Hustle" => { "rating" => 4.7, "featured" => true },
|
||||
}
|
||||
|
||||
results = @filter.where(hash, "featured", "true")
|
||||
|
@ -704,7 +722,7 @@ class TestFilters < JekyllUnitTest
|
|||
hash = {
|
||||
"The Words" => { "rating" => 1.2, "featured" => false },
|
||||
"Limitless" => { "rating" => 9.2, "featured" => true },
|
||||
"Hustle" => { "rating" => 4.7, "featured" => true }
|
||||
"Hustle" => { "rating" => 4.7, "featured" => true },
|
||||
}
|
||||
|
||||
results = @filter.where_exp(hash, "item", "item.featured == true")
|
||||
|
@ -725,7 +743,7 @@ class TestFilters < JekyllUnitTest
|
|||
{ "id" => "a", "groups" => [1, 2] },
|
||||
{ "id" => "b", "groups" => [2, 3] },
|
||||
{ "id" => "c" },
|
||||
{ "id" => "d", "groups" => [1, 3] }
|
||||
{ "id" => "d", "groups" => [1, 3] },
|
||||
]
|
||||
should "filter with the contains operator over arrays" do
|
||||
results = @filter.where_exp(objects, "obj", "obj.groups contains 1")
|
||||
|
@ -807,7 +825,7 @@ class TestFilters < JekyllUnitTest
|
|||
items = [
|
||||
{ "version"=>"1.0", "result"=>"slow" },
|
||||
{ "version"=>"1.1.5", "result"=>"medium" },
|
||||
{ "version"=>"2.7.3", "result"=>"fast" }
|
||||
{ "version"=>"2.7.3", "result"=>"fast" },
|
||||
]
|
||||
|
||||
result = @filter.group_by_exp(items, "item", "item.version | split: '.' | first")
|
||||
|
|
|
@ -7,12 +7,12 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "contacts",
|
||||
"type" => "page"
|
||||
"type" => "page",
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages.find { |page| page.relative_path == "contacts/bar.html" }
|
||||
|
@ -30,12 +30,12 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "index.html"
|
||||
"path" => "index.html",
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
|
||||
@site.process
|
||||
|
@ -54,12 +54,12 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "win"
|
||||
"path" => "win",
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
|
||||
@site.process
|
||||
|
@ -78,12 +78,12 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"type" => "page"
|
||||
"type" => "page",
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
|
||||
@site.process
|
||||
|
@ -103,12 +103,12 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"type" => "pages"
|
||||
"type" => "pages",
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
|
@ -129,9 +129,9 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
"scope" => {
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
|
@ -149,9 +149,9 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"defaults" => [{
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
"key" => "val",
|
||||
},
|
||||
},],
|
||||
})
|
||||
@site.process
|
||||
@affected = @site.pages
|
||||
|
@ -171,9 +171,9 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
"destination" => dest_dir,
|
||||
"defaults" => [{
|
||||
"values" => {
|
||||
"date" => "2015-01-01 00:00:01"
|
||||
}
|
||||
}]
|
||||
"date" => "2015-01-01 00:00:01",
|
||||
},
|
||||
},],
|
||||
}))
|
||||
end
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ class TestKramdown < JekyllUnitTest
|
|||
|
||||
"syntax_highlighter" => "rouge",
|
||||
"syntax_highlighter_opts" => {
|
||||
"bold_every" => 8, "css" => :class
|
||||
}
|
||||
}
|
||||
"bold_every" => 8, "css" => :class,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@config = Jekyll.configuration(@config)
|
||||
|
@ -43,8 +43,8 @@ class TestKramdown < JekyllUnitTest
|
|||
override = {
|
||||
"highlighter" => nil,
|
||||
"kramdown" => {
|
||||
"smart_quotes" => "lsaquo,rsaquo,laquo,raquo"
|
||||
}
|
||||
"smart_quotes" => "lsaquo,rsaquo,laquo,raquo",
|
||||
},
|
||||
}
|
||||
|
||||
markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, override))
|
||||
|
@ -70,8 +70,8 @@ class TestKramdown < JekyllUnitTest
|
|||
"highlighter" => nil,
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"syntax_highlighter" => :coderay
|
||||
}
|
||||
"syntax_highlighter" => :coderay,
|
||||
},
|
||||
}
|
||||
|
||||
markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, override))
|
||||
|
@ -89,8 +89,8 @@ class TestKramdown < JekyllUnitTest
|
|||
override = {
|
||||
"markdown" => "kramdown",
|
||||
"kramdown" => {
|
||||
"enable_coderay" => true
|
||||
}
|
||||
"enable_coderay" => true,
|
||||
},
|
||||
}
|
||||
|
||||
@config.delete("highlighter")
|
||||
|
@ -115,9 +115,9 @@ class TestKramdown < JekyllUnitTest
|
|||
"kramdown" => {
|
||||
"syntax_highlighter" => "coderay",
|
||||
"coderay" => {
|
||||
"hello" => "world"
|
||||
}
|
||||
}
|
||||
"hello" => "world",
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
expect(Kramdown::Document).to receive(:new) do |arg1, hash|
|
||||
|
|
|
@ -4,7 +4,7 @@ class TestLayoutReader < JekyllUnitTest
|
|||
context "reading layouts" do
|
||||
setup do
|
||||
config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir,
|
||||
"destination" => dest_dir })
|
||||
"destination" => dest_dir, })
|
||||
@site = fixture_site(config)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class TestLiquidRenderer < JekyllUnitTest
|
|||
expected = [
|
||||
%r!^Filename\s+|\s+Count\s+|\s+Bytes\s+|\s+Time$!,
|
||||
%r!^-+\++-+\++-+\++-+$!,
|
||||
%r!^_posts/2010-01-09-date-override\.markdown\s+|\s+\d+\s+|\s+\d+\.\d{2}K\s+|\s+\d+\.\d{3}$!
|
||||
%r!^_posts/2010-01-09-date-override\.markdown\s+|\s+\d+\s+|\s+\d+\.\d{2}K\s+|\s+\d+\.\d{3}$!,
|
||||
]
|
||||
# rubocop:enable Metrics/LineLength
|
||||
|
||||
|
|
|
@ -25,14 +25,14 @@ class TestNewCommand < JekyllUnitTest
|
|||
|
||||
should "create a new directory" do
|
||||
refute_exist @full_path
|
||||
Jekyll::Commands::New.process(@args)
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
assert_exist @full_path
|
||||
end
|
||||
|
||||
should "create a Gemfile" do
|
||||
gemfile = File.join(@full_path, "Gemfile")
|
||||
refute_exist @full_path
|
||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
assert_exist gemfile
|
||||
assert_match(%r!gem "jekyll", "#{Jekyll::VERSION}"!, File.read(gemfile))
|
||||
assert_match(%r!gem "github-pages"!, File.read(gemfile))
|
||||
|
@ -40,12 +40,11 @@ class TestNewCommand < JekyllUnitTest
|
|||
|
||||
should "display a success message" do
|
||||
Jekyll::Commands::New.process(@args)
|
||||
output = Jekyll.logger.messages[-3]
|
||||
output_last = Jekyll.logger.messages.last
|
||||
output = Jekyll.logger.messages
|
||||
success_message = "New jekyll site installed in #{@full_path.cyan}. "
|
||||
bundle_message = "Running bundle install in #{@full_path.cyan}... "
|
||||
assert_includes output, success_message
|
||||
assert_includes output_last, bundle_message
|
||||
assert_includes output, bundle_message
|
||||
end
|
||||
|
||||
should "copy the static files in site template to the new directory" do
|
||||
|
@ -54,7 +53,7 @@ class TestNewCommand < JekyllUnitTest
|
|||
end
|
||||
static_template_files << "/Gemfile"
|
||||
|
||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
|
||||
new_site_files = dir_contents(@full_path).reject do |f|
|
||||
File.extname(f) == ".markdown"
|
||||
|
@ -76,7 +75,7 @@ class TestNewCommand < JekyllUnitTest
|
|||
f.gsub! "0000-00-00", stubbed_date
|
||||
end
|
||||
|
||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
|
||||
new_site_files = dir_contents(@full_path).select do |f|
|
||||
erb_template_files.include? f
|
||||
|
@ -87,7 +86,7 @@ class TestNewCommand < JekyllUnitTest
|
|||
|
||||
should "create blank project" do
|
||||
blank_contents = %w(/_drafts /_layouts /_posts /index.html)
|
||||
capture_stdout { Jekyll::Commands::New.process(@args, "--blank") }
|
||||
capture_output { Jekyll::Commands::New.process(@args, "--blank") }
|
||||
output = Jekyll.logger.messages.last
|
||||
bundle_message = "Running bundle install in #{@full_path.cyan}..."
|
||||
assert_same_elements blank_contents, dir_contents(@full_path)
|
||||
|
@ -95,13 +94,13 @@ class TestNewCommand < JekyllUnitTest
|
|||
end
|
||||
|
||||
should "force created folder" do
|
||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||
output = capture_stdout { Jekyll::Commands::New.process(@args, "--force") }
|
||||
capture_output { Jekyll::Commands::New.process(@args) }
|
||||
output = capture_output { Jekyll::Commands::New.process(@args, "--force") }
|
||||
assert_match(%r!New jekyll site installed in!, output)
|
||||
end
|
||||
|
||||
should "skip bundle install when opted to" do
|
||||
capture_stdout { Jekyll::Commands::New.process(@args, "--skip-bundle") }
|
||||
capture_output { Jekyll::Commands::New.process(@args, "--skip-bundle") }
|
||||
output = Jekyll.logger.messages.last
|
||||
bundle_message = "Bundle install skipped."
|
||||
assert_includes output, bundle_message
|
||||
|
@ -120,7 +119,7 @@ class TestNewCommand < JekyllUnitTest
|
|||
|
||||
should "create a new directory" do
|
||||
refute_exist @site_name_with_spaces
|
||||
capture_stdout { Jekyll::Commands::New.process(@multiple_args) }
|
||||
capture_output { Jekyll::Commands::New.process(@multiple_args) }
|
||||
assert_exist @site_name_with_spaces
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class TestPage < JekyllUnitTest
|
|||
|
||||
def do_render(page)
|
||||
layouts = {
|
||||
"default" => Layout.new(@site, source_dir("_layouts"), "simple.html")
|
||||
"default" => Layout.new(@site, source_dir("_layouts"), "simple.html"),
|
||||
}
|
||||
page.render(layouts, @site.site_payload)
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ class TestPage < JekyllUnitTest
|
|||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"skip_config_files" => true
|
||||
"skip_config_files" => true,
|
||||
}))
|
||||
end
|
||||
|
||||
|
@ -90,7 +90,7 @@ class TestPage < JekyllUnitTest
|
|||
:permalink => "/properties/",
|
||||
:published => nil,
|
||||
:title => "Properties Page",
|
||||
:url => "/properties/"
|
||||
:url => "/properties/",
|
||||
}
|
||||
|
||||
attrs.each do |attr, val|
|
||||
|
|
|
@ -68,7 +68,7 @@ class TestPluginManager < JekyllUnitTest
|
|||
should "require plugin files" do
|
||||
site = double({ :safe => false,
|
||||
:config => { "plugins_dir" => "_plugins" },
|
||||
:in_source_dir => "/tmp/" })
|
||||
:in_source_dir => "/tmp/", })
|
||||
plugin_manager = PluginManager.new(site)
|
||||
|
||||
expect(Jekyll::External).to receive(:require_with_graceful_fail)
|
||||
|
@ -98,9 +98,9 @@ class TestPluginManager < JekyllUnitTest
|
|||
should "call site's in_source_dir" do
|
||||
site = double({
|
||||
:config => {
|
||||
"plugins_dir" => Jekyll::Configuration::DEFAULTS["plugins_dir"]
|
||||
"plugins_dir" => Jekyll::Configuration::DEFAULTS["plugins_dir"],
|
||||
},
|
||||
:in_source_dir => "/tmp/"
|
||||
:in_source_dir => "/tmp/",
|
||||
})
|
||||
plugin_manager = PluginManager.new(site)
|
||||
|
||||
|
@ -132,7 +132,7 @@ class TestPluginManager < JekyllUnitTest
|
|||
|
||||
should "print no deprecation warning if jekyll-paginate is present" do
|
||||
site = double({
|
||||
:config => { "paginate" => true, "gems" => ["jekyll-paginate"] }
|
||||
:config => { "paginate" => true, "gems" => ["jekyll-paginate"] },
|
||||
})
|
||||
plugin_manager = PluginManager.new(site)
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ class TestRdiscount < JekyllUnitTest
|
|||
"markdown" => "rdiscount",
|
||||
"rdiscount" => {
|
||||
"toc_token" => "{:toc}",
|
||||
"extensions" => %w(smart generate_toc)
|
||||
}
|
||||
"extensions" => %w(smart generate_toc),
|
||||
},
|
||||
}
|
||||
|
||||
@markdown = Converters::Markdown.new config
|
||||
|
|
|
@ -12,8 +12,8 @@ class TestRedcarpet < JekyllUnitTest
|
|||
@config = {
|
||||
"markdown" => "redcarpet",
|
||||
"redcarpet" => {
|
||||
"extensions" => %w(smart strikethrough filter_html)
|
||||
}
|
||||
"extensions" => %w(smart strikethrough filter_html),
|
||||
},
|
||||
}
|
||||
|
||||
@markdown = Converters::Markdown.new @config
|
||||
|
|
|
@ -8,10 +8,10 @@ class TestRegenerator < JekyllUnitTest
|
|||
@site = fixture_site({
|
||||
"collections" => {
|
||||
"methods" => {
|
||||
"output" => true
|
||||
}
|
||||
"output" => true,
|
||||
},
|
||||
"incremental" => true
|
||||
},
|
||||
"incremental" => true,
|
||||
})
|
||||
|
||||
@site.read
|
||||
|
@ -92,7 +92,7 @@ class TestRegenerator < JekyllUnitTest
|
|||
setup do
|
||||
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
|
||||
@site = fixture_site({
|
||||
"incremental" => true
|
||||
"incremental" => true,
|
||||
})
|
||||
|
||||
@site.read
|
||||
|
@ -129,7 +129,7 @@ class TestRegenerator < JekyllUnitTest
|
|||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"incremental" => true
|
||||
"incremental" => true,
|
||||
}))
|
||||
|
||||
@site.process
|
||||
|
@ -311,7 +311,7 @@ class TestRegenerator < JekyllUnitTest
|
|||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"incremental" => false
|
||||
"incremental" => false,
|
||||
}))
|
||||
|
||||
@site.process
|
||||
|
|
|
@ -28,7 +28,7 @@ class TestRelatedPosts < JekyllUnitTest
|
|||
|
||||
allow_any_instance_of(Jekyll::RelatedPosts).to receive(:display)
|
||||
@site = fixture_site({
|
||||
"lsi" => true
|
||||
"lsi" => true,
|
||||
})
|
||||
|
||||
@site.reset
|
||||
|
|
|
@ -5,7 +5,7 @@ class TestSass < JekyllUnitTest
|
|||
setup do
|
||||
@site = Jekyll::Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir
|
||||
"destination" => dest_dir,
|
||||
}))
|
||||
@site.process
|
||||
@test_css_file = dest_dir("css/main.css")
|
||||
|
|
|
@ -20,7 +20,7 @@ class TestSite < JekyllUnitTest
|
|||
|
||||
should "have an array for plugins if passed as an array" do
|
||||
site = Site.new(site_configuration({
|
||||
"plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"]
|
||||
"plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"],
|
||||
}))
|
||||
array = if Utils::Platforms.windows?
|
||||
["C:/tmp/plugins", "C:/tmp/otherplugins"]
|
||||
|
@ -49,6 +49,18 @@ class TestSite < JekyllUnitTest
|
|||
site = Site.new(site_configuration({ "baseurl" => "/blog" }))
|
||||
assert_equal "/blog", site.baseurl
|
||||
end
|
||||
|
||||
should "only include theme includes_path if the path exists" do
|
||||
site = fixture_site({ "theme" => "test-theme" })
|
||||
assert_equal [source_dir("_includes"), theme_dir("_includes")],
|
||||
site.includes_load_paths
|
||||
|
||||
allow(File).to receive(:directory?).with(theme_dir("_sass")).and_return(true)
|
||||
allow(File).to receive(:directory?).with(theme_dir("_layouts")).and_return(true)
|
||||
allow(File).to receive(:directory?).with(theme_dir("_includes")).and_return(false)
|
||||
site = fixture_site({ "theme" => "test-theme" })
|
||||
assert_equal [source_dir("_includes")], site.includes_load_paths
|
||||
end
|
||||
end
|
||||
context "creating sites" do
|
||||
setup do
|
||||
|
@ -485,7 +497,7 @@ class TestSite < JekyllUnitTest
|
|||
context "manipulating the Jekyll environment" do
|
||||
setup do
|
||||
@site = Site.new(site_configuration({
|
||||
"incremental" => false
|
||||
"incremental" => false,
|
||||
}))
|
||||
@site.process
|
||||
@page = @site.pages.find { |p| p.name == "environment.html" }
|
||||
|
@ -499,7 +511,7 @@ class TestSite < JekyllUnitTest
|
|||
setup do
|
||||
ENV["JEKYLL_ENV"] = "production"
|
||||
@site = Site.new(site_configuration({
|
||||
"incremental" => false
|
||||
"incremental" => false,
|
||||
}))
|
||||
@site.process
|
||||
@page = @site.pages.find { |p| p.name == "environment.html" }
|
||||
|
@ -565,7 +577,7 @@ class TestSite < JekyllUnitTest
|
|||
context "incremental build" do
|
||||
setup do
|
||||
@site = Site.new(site_configuration({
|
||||
"incremental" => true
|
||||
"incremental" => true,
|
||||
}))
|
||||
@site.read
|
||||
end
|
||||
|
|
|
@ -16,33 +16,34 @@ class TestStaticFile < JekyllUnitTest
|
|||
end
|
||||
|
||||
def setup_static_file(base, dir, name)
|
||||
StaticFile.new(@site, base, dir, name)
|
||||
Dir.chdir(@site.source) { StaticFile.new(@site, base, dir, name) }
|
||||
end
|
||||
|
||||
def setup_static_file_with_collection(base, dir, name, metadata)
|
||||
site = fixture_site("collections" => { "foo" => metadata })
|
||||
Dir.chdir(site.source) do
|
||||
StaticFile.new(site, base, dir, name, site.collections["foo"])
|
||||
end
|
||||
end
|
||||
|
||||
def setup_static_file_with_defaults(base, dir, name, defaults)
|
||||
site = fixture_site("defaults" => defaults)
|
||||
Dir.chdir(site.source) do
|
||||
StaticFile.new(site, base, dir, name)
|
||||
end
|
||||
end
|
||||
|
||||
context "A StaticFile" do
|
||||
setup do
|
||||
clear_dest
|
||||
@old_pwd = Dir.pwd
|
||||
Dir.chdir source_dir
|
||||
@site = fixture_site
|
||||
@filename = "static_file.txt"
|
||||
make_dummy_file(@filename)
|
||||
@static_file = setup_static_file(nil, nil, @filename)
|
||||
@static_file = setup_static_file(@site.source, "", @filename)
|
||||
end
|
||||
|
||||
teardown do
|
||||
remove_dummy_file(@filename) if File.exist?(source_dir(@filename))
|
||||
Dir.chdir @old_pwd
|
||||
end
|
||||
|
||||
should "have a source file path" do
|
||||
|
@ -95,8 +96,8 @@ class TestStaticFile < JekyllUnitTest
|
|||
should "use the _config.yml defaults to determine writability" do
|
||||
defaults = [{
|
||||
"scope" => { "path" => "private" },
|
||||
"values" => { "published" => false }
|
||||
}]
|
||||
"values" => { "published" => false },
|
||||
},]
|
||||
static_file = setup_static_file_with_defaults(
|
||||
"root",
|
||||
"private/dir/subdir",
|
||||
|
@ -146,7 +147,7 @@ class TestStaticFile < JekyllUnitTest
|
|||
"name" => "static_file.txt",
|
||||
"extname" => ".txt",
|
||||
"modified_time" => @static_file.modified_time,
|
||||
"path" => "/static_file.txt"
|
||||
"path" => "/static_file.txt",
|
||||
}
|
||||
assert_equal expected, @static_file.to_liquid
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestTags < JekyllUnitTest
|
|||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||
@converter = site.converters.find { |c| c.class == converter_class }
|
||||
payload = { "highlighter_prefix" => @converter.highlighter_prefix,
|
||||
"highlighter_suffix" => @converter.highlighter_suffix }
|
||||
"highlighter_suffix" => @converter.highlighter_suffix, }
|
||||
|
||||
@result = Liquid::Template.parse(content).render!(payload, info)
|
||||
@result = @converter.convert(@result)
|
||||
|
@ -487,7 +487,7 @@ CONTENT
|
|||
end
|
||||
|
||||
create_post(@content, {
|
||||
"markdown" => "rdiscount"
|
||||
"markdown" => "rdiscount",
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -517,7 +517,7 @@ CONTENT
|
|||
end
|
||||
|
||||
create_post(@content, {
|
||||
"markdown" => "redcarpet"
|
||||
"markdown" => "redcarpet",
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -541,7 +541,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -567,7 +567,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -596,7 +596,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -628,7 +628,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -664,7 +664,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -683,7 +683,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -703,7 +703,7 @@ CONTENT
|
|||
create_post(content, {
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_all" => true
|
||||
"read_all" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -737,7 +737,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"collections" => { "methods" => { "output" => true } },
|
||||
"read_collections" => true
|
||||
"read_collections" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -764,7 +764,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"collections" => { "methods" => { "output" => true } },
|
||||
"read_collections" => true
|
||||
"read_collections" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -796,7 +796,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"collections" => { "methods" => { "output" => true } },
|
||||
"read_collections" => true
|
||||
"read_collections" => true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -820,7 +820,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true,
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
end
|
||||
@result ||= ""
|
||||
|
@ -842,7 +842,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true,
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
end
|
||||
assert_match(
|
||||
|
@ -868,7 +868,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -896,7 +896,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -913,7 +913,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -932,7 +932,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -959,7 +959,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -982,7 +982,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
assert_match(
|
||||
|
@ -1125,7 +1125,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
assert_match "Could not locate the included file 'missing.html' in any of " \
|
||||
|
@ -1150,7 +1150,7 @@ CONTENT
|
|||
"permalink" => "pretty",
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true
|
||||
"read_posts" => true,
|
||||
})
|
||||
end
|
||||
assert_equal(
|
||||
|
@ -1180,7 +1180,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true,
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
end
|
||||
@result ||= ""
|
||||
|
@ -1202,7 +1202,7 @@ CONTENT
|
|||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_posts" => true,
|
||||
"safe" => true
|
||||
"safe" => true,
|
||||
})
|
||||
end
|
||||
assert_match(
|
||||
|
|
|
@ -3,7 +3,6 @@ require "helper"
|
|||
class TestTheme < JekyllUnitTest
|
||||
def setup
|
||||
@theme = Theme.new("test-theme")
|
||||
@expected_root = File.expand_path "./fixtures/test-theme", File.dirname(__FILE__)
|
||||
end
|
||||
|
||||
context "initializing" do
|
||||
|
@ -13,7 +12,7 @@ class TestTheme < JekyllUnitTest
|
|||
end
|
||||
|
||||
should "know the theme root" do
|
||||
assert_equal @expected_root, @theme.root
|
||||
assert_equal theme_dir, @theme.root
|
||||
end
|
||||
|
||||
should "know the theme version" do
|
||||
|
@ -36,13 +35,13 @@ class TestTheme < JekyllUnitTest
|
|||
context "path generation" do
|
||||
[:assets, :_layouts, :_includes, :_sass].each do |folder|
|
||||
should "know the #{folder} path" do
|
||||
expected = File.expand_path(folder.to_s, @expected_root)
|
||||
expected = theme_dir(folder.to_s)
|
||||
assert_equal expected, @theme.public_send("#{folder.to_s.tr("_", "")}_path")
|
||||
end
|
||||
end
|
||||
|
||||
should "generate folder paths" do
|
||||
expected = File.expand_path("./_sass", @expected_root)
|
||||
expected = theme_dir("_sass")
|
||||
assert_equal expected, @theme.send(:path_for, :_sass)
|
||||
end
|
||||
|
||||
|
@ -58,7 +57,7 @@ class TestTheme < JekyllUnitTest
|
|||
# no support for symlinks on Windows
|
||||
skip_if_windows "Jekyll does not currently support symlinks on Windows."
|
||||
|
||||
expected = File.expand_path("./_layouts", @expected_root)
|
||||
expected = theme_dir("_layouts")
|
||||
assert_equal expected, @theme.send(:path_for, :_symlink)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue