Merge remote-tracking branch 'origin/master' into themes

* origin/master: (65 commits)
  Update history to reflect merge of #4703 [ci skip]
  Update history to reflect merge of #4712 [ci skip]
  Highlight the test code
  Update history to reflect merge of #4640 [ci skip]
  readded "env=prod"-condition
  Update history to reflect merge of #3849 [ci skip]
  Update history to reflect merge of #4624 [ci skip]
  Update history to reflect merge of #4704 [ci skip]
  Update history to reflect merge of #4706 [ci skip]
  Checks for link file extension in tests
  Updating assets documentation
  Fix test teardown for cleaner.
  Update history to reflect merge of #4542 [ci skip]
  Add explanation of site variables in the example _config.yml
  Use double quotes in the gemfile
  Add test for creation of Gemfile by 'jekyll new'
  Add comment about github-pages
  Update history to reflect merge of #4533 [ci skip]
  Ensure Rouge closes its div/figure properly after highlighting ends.
  Add Site#config= which can be used to set the config
  ...
This commit is contained in:
Parker Moore 2016-03-25 16:30:25 -07:00
commit a30068bf3f
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
36 changed files with 442 additions and 65 deletions

View File

@ -15,7 +15,7 @@ Whether you're a developer, a designer, or just a Jekyll devotee, there are lots
* [Install Jekyll on your computer](https://jekyllrb.com/docs/installation/) and kick the tires. Does it work? Does it do what you'd expect? If not, [open an issue](https://github.com/jekyll/jekyll/issues/new) and let us know.
* Comment on some of the project's [open issues](https://github.com/jekyll/jekyll/issues). Have you experienced the same problem? Know a work around? Do you have a suggestion for how the feature could be better?
* Read through [the documentation](http://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion for something that could be improved.
* Read through [the documentation](https://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion for something that could be improved.
* Browse through [the Jekyll discussion forum](https://talk.jekyllrb.com/), and lend a hand answering questions. There's a good chance you've already experienced what another user is experiencing.
* Find [an open issue](https://github.com/jekyll/jekyll/issues) (especially [those labeled `help-wanted`](https://github.com/jekyll/jekyll/issues?q=is%3Aopen+is%3Aissue+label%3Ahelp-wanted)), and submit a proposed fix. If it's your first pull request, we promise we won't bite, and are glad to answer any questions.
* Help evaluate [open pull requests](https://github.com/jekyll/jekyll/pulls), by testing the changes locally and reviewing what's proposed.
@ -68,7 +68,7 @@ One gotcha, all pull requests should be directed at the `master` branch (the def
### Adding plugins
If you want to add your plugin to the [list of plugins](http://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](site/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
If you want to add your plugin to the [list of plugins](https://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](site/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
## Code Contributions
@ -100,19 +100,19 @@ If your contribution changes any Jekyll behavior, make sure to update the docume
To run the test suite and build the gem you'll need to install Jekyll's dependencies by running the following command:
$ script/bootstrap
<pre class="highlight"><code>$ script/bootstrap</code></pre>
Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly):
$ script/cibuild
<pre class="highlight"><code>$ script/cibuild</code></pre>
If you are only updating a file in `test/`, you can use the command:
$ script/test test/blah_test.rb
<pre class="highlight"><code>$ script/test test/blah_test.rb</code></pre>
If you are only updating a `.feature` file, you can use the command:
$ script/cucumber features/blah.feature
<pre class="highlight"><code>$ script/cucumber features/blah.feature</code></pre>
Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite.

View File

@ -82,7 +82,7 @@ group :site do
gem "html-proofer", "~> 2.0"
end
gem "jemoji"
gem "jemoji", "0.5.1"
gem "jekyll-sitemap"
gem "jekyll-seo-tag", "~> 1.1"
gem "jekyll-avatar"

View File

@ -10,6 +10,14 @@
* Site Template: Changed main `<div>` to `<main>` and added accessibility info (#4636)
* Add array support to `where` filter (#4555)
* 'jekyll clean': also remove .sass-cache (#4652)
* Clean up Tags::PostUrl a bit, including better errors and date parsing (#4670)
* Use String#encode for xml_escape filter instead of CGI.escapeHTML (#4694)
* Add show_dir_listing option for serve command and fix index file names (#4533)
* Site Template: write a Gemfile which is educational to the new site (#4542)
* Site template: add explanation of site variables in the example `_config.yml` (#4704)
* Adds `link` Liquid tag to make generation of URL's easier (#4624)
* Allow static files to be symlinked in unsafe mode or non-prod environments (#4640)
* Add `:after_init` hook & add `Site#config=` to make resetting config easy (#4703)
### Bug Fixes
@ -19,6 +27,8 @@
* Filters#time: clone an input Time so as to be non-destructive (#4590)
* Doctor: fix issue where `--config` wasn't a recognized flag (#4598)
* Ensures related_posts are only set for a post (#4620)
* EntryFilter#special?: ignore filenames which begin with '~' (#4491)
* Cleaner: `keep_files` should only apply to the beginning of paths, not substrings with index > 0 (#3849)
### Development Fixes
@ -40,6 +50,14 @@
* Document that subdirectories of `_posts` are no longer categories (#4639)
* Update continuous-integration docs with sudo: false information (#4628)
* Blog post on refreshed contributing file and new affinity teams (#4645)
* Fixes typo on collections (#4647)
* Documentation: future option also works for collections (#4682)
* Additional package needed for Fedora 23 Workspace (#4685)
* Fix typo on Chocolatey name in Windows documentation (#4686)
* Use the correct URL, Fixes #4698 (#4699)
* Add jekyll-paspagon plugin (#4700)
* Bold-italicize note in assets documentation about needing yaml front matter (#4706)
* Highlight the `script/` calls in the Contributing documentation (#4712)
## 3.1.2 / 2016-02-19

View File

@ -55,4 +55,4 @@ and we will address it as soon as possible.
## License
See [LICENSE](https://github.com/jekyll/jekyll/blob/master/LICENSE).
See the [LICENSE](https://github.com/jekyll/jekyll/blob/master/LICENSE) file.

View File

@ -0,0 +1,51 @@
#!/usr/bin/env ruby
require 'benchmark/ips'
# For this pull request, which changes Page#dir
# https://github.com/jekyll/jekyll/pull/4403
CONTENT_CONTAINING = <<-HTML.freeze
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Jemoji</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="/css/screen.css">
</head>
<body class="wrap">
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20" align="absmiddle"></p>
</body>
</html>
HTML
CONTENT_NOT_CONTAINING = <<-HTML.freeze
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Jemoji</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="/css/screen.css">
</head>
<body class="wrap">
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20" align="absmiddle"></p>
</body>
</html>
HTML
Benchmark.ips do |x|
x.report("no body include?") { CONTENT_NOT_CONTAINING.include?('<body') }
x.report("no body regexp") { CONTENT_NOT_CONTAINING =~ /<\s*body/ }
x.compare!
end
# No trailing slash
Benchmark.ips do |x|
x.report("with body include?") { CONTENT_CONTAINING.include?('<body') }
x.report("with body regexp") { CONTENT_CONTAINING =~ /<\s*body/ }
x.compare!
end

View File

@ -95,11 +95,12 @@ module Jekyll
# Private: Creates a regular expression from the config's keep_files array
#
# Examples
# ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
# ['.git','.svn'] with site.dest "/myblog/_site" creates
# the following regex: /\A\/myblog\/_site\/(\.git|\/.svn)/
#
# Returns the regular expression
def keep_file_regex
Regexp.union(site.keep_files)
/\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})/
end
end
end

View File

@ -35,6 +35,10 @@ module Jekyll
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
f.write(scaffold_post_content)
end
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
f.write(gemfile_contents)
end
end
Jekyll.logger.info "New jekyll site installed in #{new_blog_path}."
@ -59,6 +63,31 @@ module Jekyll
end
private
def gemfile_contents
<<-RUBY
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "#{Jekyll::VERSION}"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
# group :jekyll_plugins do
# gem "jekyll-github-metadata", "~> 1.0"
# end
RUBY
end
def preserve_source_location?(path, options)
!options["force"] && !Dir["#{path}/**/*"].empty?

View File

@ -10,6 +10,8 @@ module Jekyll
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
"port" => ["-P", "--port [PORT]", "Port to listen on"],
"baseurl" => ["-b", "--baseurl [URL]", "Base URL"],
"show_dir_listing" => ["--show-dir-listing",
"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."]
}
@ -91,6 +93,8 @@ module Jekyll
)
}
opts[:DirectoryIndex] = [] if opts[:JekyllOptions]['show_dir_listing']
enable_ssl(opts)
enable_logging(opts)
opts

View File

@ -44,6 +44,7 @@ module Jekyll
'port' => '4000',
'host' => '127.0.0.1',
'baseurl' => '',
'show_dir_listing' => false,
# Output Configuration
'permalink' => 'date',

View File

@ -1,6 +1,6 @@
module Jekyll
class EntryFilter
SPECIAL_LEADING_CHARACTERS = ['.', '_', '#'].freeze
SPECIAL_LEADING_CHARACTERS = ['.', '_', '#', '~'].freeze
attr_reader :site

View File

@ -6,5 +6,9 @@ module Jekyll
InvalidPermalinkError = Class.new(FatalException)
InvalidYAMLFrontMatterError = Class.new(FatalException)
MissingDependencyException = Class.new(FatalException)
InvalidDateError = Class.new(FatalException)
InvalidPostNameError = Class.new(FatalException)
PostURLError = Class.new(FatalException)
end
end

View File

@ -117,7 +117,7 @@ module Jekyll
#
# Returns the escaped String.
def xml_escape(input)
CGI.escapeHTML(input.to_s)
input.to_s.encode(:xml => :attr).gsub(/\A"|"\Z/, "")
end
# CGI escape a string for use in a URL. Replaces any special characters
@ -308,7 +308,7 @@ module Jekyll
#
# Returns a String representation of the object.
def inspect(input)
CGI.escapeHTML(input.inspect)
xml_escape(input.inspect)
end
private

View File

@ -12,6 +12,7 @@ module Jekyll
# initial empty hooks
@registry = {
:site => {
:after_init => [],
:after_reset => [],
:post_read => [],
:pre_render => [],

View File

@ -17,6 +17,31 @@ module Jekyll
#
# config - A Hash containing site configuration details.
def initialize(config)
# Source and destination may not be changed after the site has been created.
@source = File.expand_path(config['source']).freeze
@dest = File.expand_path(config['destination']).freeze
self.config = config
@reader = Reader.new(self)
@regenerator = Regenerator.new(self)
@liquid_renderer = LiquidRenderer.new(self)
Jekyll.sites << self
Jekyll::Hooks.trigger :site, :after_init, self
reset
setup
end
# Public: Set the site's configuration. This handles side-effects caused by
# changing values in the configuration.
#
# config - a Jekyll::Configuration, containing the new configuration.
#
# Returns the new configuration.
def config=(config)
@config = config.clone
%w(safe lsi highlighter baseurl exclude include future unpublished
@ -24,17 +49,6 @@ module Jekyll
self.send("#{opt}=", config[opt])
end
# Source and destination may not be changed after the site has been created.
@source = File.expand_path(config['source']).freeze
@dest = File.expand_path(config['destination']).freeze
@reader = Jekyll::Reader.new(self)
# Initialize incremental regenerator
@regenerator = Regenerator.new(self)
@liquid_renderer = LiquidRenderer.new(self)
self.plugin_manager = Jekyll::PluginManager.new(self)
self.plugins = plugin_manager.plugins_path
@ -45,10 +59,7 @@ module Jekyll
self.permalink_style = config['permalink'].to_sym
Jekyll.sites << self
reset
setup
@config
end
# Public: Read, process, and write this Site to output.

View File

@ -80,7 +80,11 @@ module Jekyll
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.rm(dest_path) if File.exist?(dest_path)
FileUtils.cp(path, dest_path)
if @site.safe || Jekyll.env == "production"
FileUtils.cp(path, dest_path)
else
FileUtils.copy_entry(path, dest_path)
end
File.utime(@@mtimes[path], @@mtimes[path], dest_path)
true

26
lib/jekyll/tags/link.rb Normal file
View File

@ -0,0 +1,26 @@
module Jekyll
module Tags
class Link < Liquid::Tag
TagName = 'link'
def initialize(tag_name, relative_path, tokens)
super
@relative_path = relative_path.strip
end
def render(context)
site = context.registers[:site]
site.docs_to_write.each do |document|
return document.url if document.relative_path == @relative_path
end
raise ArgumentError, "Could not find document '#{@relative_path}' in tag '#{TagName}'.\n\n" \
"Make sure the document exists and the path is correct."
end
end
end
end
Liquid::Template.register_tag(Jekyll::Tags::Link::TagName, Jekyll::Tags::Link)

View File

@ -7,22 +7,30 @@ module Jekyll
def initialize(name)
@name = name
all, @path, @date, @slug = *name.sub(/^\//, "").match(MATCHER)
raise ArgumentError.new("'#{name}' does not contain valid date and/or title.") unless all
unless all
raise Jekyll::Errors::InvalidPostNameError,
"'#{name}' does not contain valid date and/or title."
end
@name_regex = /^#{path}#{date}-#{slug}\.[^.]+/
end
def post_date
@post_date ||= Utils.parse_date(date,
"\"#{date}\" does not contain valid date and/or title.")
end
def ==(other)
other.basename.match(@name_regex)
end
def deprecated_equality(other)
date = Utils.parse_date(name, "'#{name}' does not contain valid date and/or title.")
slug == post_slug(other) &&
date.year == other.date.year &&
date.month == other.date.month &&
date.day == other.date.day
post_date.year == other.date.year &&
post_date.month == other.date.month &&
post_date.day == other.date.day
end
private
@ -47,11 +55,13 @@ module Jekyll
@orig_post = post.strip
begin
@post = PostComparer.new(@orig_post)
rescue
raise ArgumentError.new <<-eos
rescue => e
raise Jekyll::Errors::PostURLError, <<-eos
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
Make sure the post exists and the name is correct.
#{e.class}: #{e.message}
eos
end
end
@ -75,7 +85,7 @@ eos
return p.url
end
raise ArgumentError.new <<-eos
raise Jekyll::Errors::PostURLError, <<-eos
Could not find post "#{@orig_post}" in tag 'post_url'.
Make sure the post exists and the name is correct.

View File

@ -1,3 +1,4 @@
module Jekyll
module Utils
extend self
@ -126,7 +127,7 @@ module Jekyll
def parse_date(input, msg = "Input could not be parsed.")
Time.parse(input).localtime
rescue ArgumentError
raise Errors::FatalException.new("Invalid date '#{input}': " + msg)
raise Errors::InvalidDateError, "Invalid date '#{input}': #{msg}"
end
# Determines whether a given file has

View File

@ -1,11 +1,17 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely need to edit after that.
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing these this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'jekyll serve'. If you change this file, please restart the server process.
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Your awesome title
email: your-email@domain.com
description: > # this means to ignore newlines until "baseurl:"

View File

@ -6,8 +6,8 @@ permalink: /docs/assets/
Jekyll provides built-in support for Sass and can work with CoffeeScript via
a Ruby gem. In order to use them, you must first create a file with the
proper extension name (one of `.sass`, `.scss`, or `.coffee`) and start the
file with two lines of triple dashes, like this:
proper extension name (one of `.sass`, `.scss`, or `.coffee`) and ***start the
file with two lines of triple dashes***, like this:
{% highlight sass %}
---

View File

@ -303,11 +303,8 @@ file, each document has the following attributes:
</td>
<td>
<p>
The URL of the rendered collection. The file is only written to the
destination when the name of the collection to which it belongs is
included in the <code>render</code> key in the site's configuration
file.
</p>
The URL of the rendered collection. The file is only written to the destination when the collection to which it belongs has <code>output: true</code> in the site's configuration.
</p>
</td>
</tr>
<tr>

View File

@ -214,7 +214,7 @@ class="flag">flags</code> (specified on the command-line) that control them.
<tr class="setting">
<td>
<p class="name"><strong>Future</strong></p>
<p class="description">Publish posts with a future date.</p>
<p class="description">Publish posts or collection documents with a future date.</p>
</td>
<td class="align-center">
<p><code class="option">future: BOOL</code></p>

View File

@ -20,7 +20,7 @@ Whether you're a developer, a designer, or just a Jekyll devotee, there are lots
* [Install Jekyll on your computer](https://jekyllrb.com/docs/installation/) and kick the tires. Does it work? Does it do what you'd expect? If not, [open an issue](https://github.com/jekyll/jekyll/issues/new) and let us know.
* Comment on some of the project's [open issues](https://github.com/jekyll/jekyll/issues). Have you experienced the same problem? Know a work around? Do you have a suggestion for how the feature could be better?
* Read through [the documentation](http://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion for something that could be improved.
* Read through [the documentation](https://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion for something that could be improved.
* Browse through [the Jekyll discussion forum](https://talk.jekyllrb.com/), and lend a hand answering questions. There's a good chance you've already experienced what another user is experiencing.
* Find [an open issue](https://github.com/jekyll/jekyll/issues) (especially [those labeled `help-wanted`](https://github.com/jekyll/jekyll/issues?q=is%3Aopen+is%3Aissue+label%3Ahelp-wanted)), and submit a proposed fix. If it's your first pull request, we promise we won't bite, and are glad to answer any questions.
* Help evaluate [open pull requests](https://github.com/jekyll/jekyll/pulls), by testing the changes locally and reviewing what's proposed.
@ -73,7 +73,7 @@ One gotcha, all pull requests should be directed at the `master` branch (the def
### Adding plugins
If you want to add your plugin to the [list of plugins](http://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](site/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
If you want to add your plugin to the [list of plugins](https://jekyllrb.com/docs/plugins/#available-plugins), please submit a pull request modifying the [plugins page source file](site/_docs/plugins.md) by adding a link to your plugin under the proper subheading depending upon its type.
## Code Contributions
@ -105,19 +105,19 @@ If your contribution changes any Jekyll behavior, make sure to update the docume
To run the test suite and build the gem you'll need to install Jekyll's dependencies by running the following command:
$ script/bootstrap
<pre class="highlight"><code>$ script/bootstrap</code></pre>
Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly):
$ script/cibuild
<pre class="highlight"><code>$ script/cibuild</code></pre>
If you are only updating a file in `test/`, you can use the command:
$ script/test test/blah_test.rb
<pre class="highlight"><code>$ script/test test/blah_test.rb</code></pre>
If you are only updating a `.feature` file, you can use the command:
$ script/cucumber features/blah.feature
<pre class="highlight"><code>$ script/cucumber features/blah.feature</code></pre>
Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite.

View File

@ -516,6 +516,18 @@ The complete list of available hooks is below:
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>:site</code></p>
</td>
<td>
<p><code>:after_init</code></p>
</td>
<td>
<p>Just after the site initializes, but before setup & render. Good
for modifying the configuration of the site.</p>
</td>
</tr>
<tr>
<td>
<p><code>:site</code></p>
@ -885,6 +897,7 @@ LESS.js files during generation.
- [Jekyll Language Plugin](https://github.com/vwochnik/jekyll-language-plugin): Jekyll 3.0-compatible multi-language plugin for posts, pages and includes.
- [Jekyll Deploy](https://github.com/vwochnik/jekyll-deploy): Adds a `deploy` sub-command to Jekyll.
- [Official Contentful Jekyll Plugin](https://github.com/contentful/jekyll-contentful-data-import): Adds a `contentful` sub-command to Jekyll to import data from Contentful.
- [jekyll-paspagon](https://github.com/KrzysiekJ/jekyll-paspagon): Sell your posts in various formats for cryptocurrencies.
#### Editors

View File

@ -35,4 +35,4 @@ Jekylls growing use is producing a wide variety of tutorials, frameworks, ext
- [Generating a Tag Cloud in Jekyll](http://www.justkez.com/generating-a-tag-cloud-in-jekyll/) A guide to implementing a tag cloud and per-tag content pages using Jekyll.
- A way to [extend Jekyll](https://github.com/rfelix/jekyll_ext) without forking and modifying the Jekyll gem codebase and some [portable Jekyll extensions](https://wiki.github.com/rfelix/jekyll_ext/extensions) that can be reused and shared.
- [Using your Rails layouts in Jekyll](http://numbers.brighterplanet.com/2010/08/09/sharing-rails-views-with-jekyll)
- [Adding Ajax pagination to Jekyll](https://eduardoboucas.com/blog/2014/11/10/adding-ajax-pagination-to-jekyll.html)
- [Adding Ajax pagination to Jekyll](https://eduardoboucas.com/blog/2014/11/05/adding-ajax-pagination-to-jekyll.html)

View File

@ -271,6 +271,39 @@ common tasks easier.
</p>
</td>
</tr>
<tr>
<td>
<p class="name"><strong>Array Filters</strong></p>
<p>Push, pop, shift, and unshift elements from an Array.</p>
<p>These are <strong>NON-DESTRUCTIVE</strong>, i.e. they do not mutate the array, but rather make a copy and mutate that.</p>
</td>
<td class="align-center">
<p>
<code class="filter">{% raw %}{{ page.tags | push: 'Spokane' }}{% endraw %}</code>
</p>
<p>
<code class="output">['Seattle', 'Tacoma', 'Spokane']</code>
</p>
<p>
<code class="filter">{% raw %}{{ page.tags | pop }}{% endraw %}</code>
</p>
<p>
<code class="output">['Seattle']</code>
</p>
<p>
<code class="filter">{% raw %}{{ page.tags | shift }}{% endraw %}</code>
</p>
<p>
<code class="output">['Tacoma']</code>
</p>
<p>
<code class="filter">{% raw %}{{ page.tags | unshift: "Olympia" }}{% endraw %}</code>
</p>
<p>
<code class="output">['Olympia', 'Seattle', 'Tacoma']</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -30,6 +30,13 @@ On Red Hat, CentOS, and Fedora systems you can do this by running:
sudo yum install ruby-devel
{% endhighlight %}
If you installed the above - specifically on Fedora 23 - but the extensions would still not compile, you are probably running a Fedora image that misses the `redhat-rpm-config` package. To solve this, simply run:
{% highlight bash %}
sudo dnf install redhat-rpm-config
{% endhighlight %}
On [NearlyFreeSpeech](https://www.nearlyfreespeech.net/) you need to run the
following commands before installing Jekyll:

View File

@ -15,7 +15,7 @@ Julian Thilo has written up instructions to get
people. The instructions were written for Ruby 2.0.0, but should work for later
versions [prior to 2.2][hitimes-issue].
Alternatively David Burela has written instructions on [how to install Jekyll via Chocolately with 3 command prompt entries](https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/).
Alternatively David Burela has written instructions on [how to install Jekyll via Chocolatey with 3 command prompt entries](https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/).
## Encoding

View File

@ -27,7 +27,7 @@ Add **jekyll** to almost any query, and you'll find just what you need.
Jekyll Talk is our official Discourse forum. Here, users and contributors
can ask questions and discuss all aspects of Jekyll.
### [Jekyll on StackOverflow](http://stackoverflow.com/questions/tagged/jekyll)
### [Jekyll on StackOverflow](https://stackoverflow.com/questions/tagged/jekyll)
StackOverflow is a staple of any developer's diet. Check out the Jekyll tag
on StackOverflow for an answer to your question. Not there? Ask a new

View File

@ -37,6 +37,40 @@ class TestCleaner < JekyllUnitTest
end
end
context "not-nested directory in keep_files and similary named directory not in keep_files" do
setup do
clear_dest
FileUtils.mkdir_p(dest_dir('.git/child_dir'))
FileUtils.mkdir_p(dest_dir('username.github.io'))
FileUtils.touch(File.join(dest_dir('.git'), 'index.html'))
FileUtils.touch(File.join(dest_dir('username.github.io'), 'index.html'))
@site = fixture_site
@site.keep_files = ['.git']
@cleaner = Cleaner.new(@site)
@cleaner.cleanup!
end
teardown do
FileUtils.rm_rf(dest_dir('.git'))
FileUtils.rm_rf(dest_dir('username.github.io'))
end
should "keep the file in the directory in keep_files" do
assert File.exist?(File.join(dest_dir('.git'), 'index.html'))
end
should "delete the file in the directory not in keep_files" do
assert !File.exist?(File.join(dest_dir('username.github.io'), 'index.html'))
end
should "delete the directory not in keep_files" do
assert !File.exist?(dest_dir('username.github.io'))
end
end
context "directory containing no files and non-empty directories" do
setup do
clear_dest

View File

@ -68,6 +68,11 @@ class TestCommandsServe < JekyllUnitTest
]
end
should "use empty directory index list when show_dir_listing is true" do
opts = { "show_dir_listing" => true }
assert custom_opts(opts)[:DirectoryIndex].empty?
end
context "verbose" do
should "debug when verbose" do
assert_equal custom_opts({ "verbose" => true })[:Logger].level, 5

View File

@ -8,7 +8,7 @@ class TestEntryFilter < JekyllUnitTest
should "filter entries" do
ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
.baz.markdow foo.markdown~ .htaccess _posts _pages]
.baz.markdow foo.markdown~ .htaccess _posts _pages ~$benbalter.docx]
entries = EntryFilter.new(@site).filter(ent1)
assert_equal %w[foo.markdown bar.markdown baz.markdown .htaccess], entries

View File

@ -394,6 +394,10 @@ class TestFilters < JekyllUnitTest
should "return a HTML-escaped string representation of an object" do
assert_equal "{&quot;&lt;a&gt;&quot;=&gt;1}", @filter.inspect({ "<a>" => 1 })
end
should "quote strings" do
assert_equal "&quot;string&quot;", @filter.inspect("string")
end
end
context "slugify filter" do

View File

@ -29,6 +29,15 @@ class TestNewCommand < JekyllUnitTest
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) }
assert_exist gemfile
assert_match /gem "jekyll", "#{Jekyll::VERSION}"/, File.read(gemfile)
assert_match /gem "github-pages"/, File.read(gemfile)
end
should 'display a success message' do
Jekyll::Commands::New.process(@args)
output = Jekyll.logger.messages.last
@ -40,6 +49,7 @@ class TestNewCommand < JekyllUnitTest
static_template_files = dir_contents(site_template).reject do |f|
File.extname(f) == '.erb'
end
static_template_files << "/Gemfile"
capture_stdout { Jekyll::Commands::New.process(@args) }

View File

@ -11,9 +11,8 @@ class TestTags < JekyllUnitTest
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
site = fixture_site({"highlighter" => "rouge"}.merge(override))
if override['read_posts']
site.posts.docs.concat(PostReader.new(site).read_posts(''))
end
site.posts.docs.concat(PostReader.new(site).read_posts('')) if override['read_posts']
CollectionReader.new(site).read if override['read_collections']
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
@converter = site.converters.find { |c| c.class == converter_class }
@ -317,6 +316,27 @@ EOS
end
end
context "post content has highlight tag with linenumbers" do
setup do
create_post <<-EOS
---
title: This is a test
---
This is not yet highlighted
{% highlight php linenos %}
test
{% endhighlight %}
This should not be highlighted, right?
EOS
end
should "should stop highlighting at boundary" do
assert_match "<p>This is not yet highlighted</p>\n\n<figure class=\"highlight\"><pre><code class=\"language-php\" data-lang=\"php\"><table style=\"border-spacing: 0\"><tbody><tr><td class=\"gutter gl\" style=\"text-align: right\"><pre class=\"lineno\">1</pre></td><td class=\"code\"><pre>test<span class=\"w\">\n</span></pre></td></tr></tbody></table></code></pre></figure>\n\n<p>This should not be highlighted, right?</p>", @result
end
end
context "post content has highlight tag with preceding spaces & Windows-style newlines" do
setup do
fill_post "\r\n\r\n\r\n [,1] [,2]"
@ -468,10 +488,97 @@ title: Invalid post name linking
---
{% post_url abc2008-11-21-complex %}
CONTENT
assert_raises Jekyll::Errors::PostURLError do
create_post(content, {
'permalink' => 'pretty',
'source' => source_dir,
'destination' => dest_dir,
'read_posts' => true
})
end
end
should "cause an error with a bad date" do
content = <<CONTENT
---
title: Invalid post name linking
---
{% post_url 2008-42-21-complex %}
CONTENT
assert_raises Jekyll::Errors::InvalidDateError do
create_post(content, {
'permalink' => 'pretty',
'source' => source_dir,
'destination' => dest_dir,
'read_posts' => true
})
end
end
end
context "simple page with linking" do
setup do
content = <<CONTENT
---
title: linking
---
{% link _methods/yaml_with_dots.md %}
CONTENT
create_post(content, {'source' => source_dir, 'destination' => dest_dir, 'collections' => { 'methods' => { 'output' => true }}, 'read_collections' => true})
end
should "not cause an error" do
refute_match /markdown\-html\-error/, @result
end
should "have the url to the \"yaml_with_dots\" item" do
assert_match %r{/methods/yaml_with_dots\.html}, @result
end
end
context "simple page with nested linking" do
setup do
content = <<CONTENT
---
title: linking
---
- 1 {% link _methods/sanitized_path.md %}
- 2 {% link _methods/site/generate.md %}
CONTENT
create_post(content, {'source' => source_dir, 'destination' => dest_dir, 'collections' => { 'methods' => { 'output' => true }}, 'read_collections' => true})
end
should "not cause an error" do
refute_match /markdown\-html\-error/, @result
end
should "have the url to the \"sanitized_path\" item" do
assert_match %r{1\s/methods/sanitized_path\.html}, @result
end
should "have the url to the \"site/generate\" item" do
assert_match %r{2\s/methods/site/generate\.html}, @result
end
end
context "simple page with invalid linking" do
should "cause an error" do
content = <<CONTENT
---
title: Invalid linking
---
{% link non-existent-collection-item %}
CONTENT
assert_raises ArgumentError do
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
create_post(content, {'source' => source_dir, 'destination' => dest_dir, 'collections' => { 'methods' => { 'output' => true }}, 'read_collections' => true})
end
end
end

View File

@ -95,20 +95,20 @@ class TestUtils < JekyllUnitTest
end
should "throw an error if the input contains no date data" do
assert_raises Jekyll::Errors::FatalException do
assert_raises Jekyll::Errors::InvalidDateError do
Utils.parse_date("Blah")
end
end
should "throw an error if the input is out of range" do
assert_raises Jekyll::Errors::FatalException do
assert_raises Jekyll::Errors::InvalidDateError do
Utils.parse_date("9999-99-99")
end
end
should "throw an error with the default message if no message is passed in" do
date = "Blah this is invalid"
assert_raises Jekyll::Errors::FatalException, "Invalid date '#{date}': Input could not be parsed." do
assert_raises Jekyll::Errors::InvalidDateError, "Invalid date '#{date}': Input could not be parsed." do
Utils.parse_date(date)
end
end
@ -116,7 +116,7 @@ class TestUtils < JekyllUnitTest
should "throw an error with the provided message if a message is passed in" do
date = "Blah this is invalid"
message = "Aaaah, the world has exploded!"
assert_raises Jekyll::Errors::FatalException, "Invalid date '#{date}': #{message}" do
assert_raises Jekyll::Errors::InvalidDateError, "Invalid date '#{date}': #{message}" do
Utils.parse_date(date, message)
end
end