diff --git a/.github/CONTRIBUTING.markdown b/.github/CONTRIBUTING.markdown index 170b8819..e0f278fe 100644 --- a/.github/CONTRIBUTING.markdown +++ b/.github/CONTRIBUTING.markdown @@ -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 +
$ script/bootstrap
Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly): - $ script/cibuild +
$ script/cibuild
If you are only updating a file in `test/`, you can use the command: - $ script/test test/blah_test.rb +
$ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command: - $ script/cucumber features/blah.feature +
$ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to run its entire respective suite. diff --git a/Gemfile b/Gemfile index dfbbdfd9..645e3005 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/History.markdown b/History.markdown index 35a01ad5..d43c99e5 100644 --- a/History.markdown +++ b/History.markdown @@ -10,6 +10,14 @@ * Site Template: Changed main `
` to `
` 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 diff --git a/README.markdown b/README.markdown index 5caaa1eb..d3128bcf 100644 --- a/README.markdown +++ b/README.markdown @@ -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. diff --git a/benchmark/regexp-vs-include.rb b/benchmark/regexp-vs-include.rb new file mode 100644 index 00000000..b2a4eff4 --- /dev/null +++ b/benchmark/regexp-vs-include.rb @@ -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 + + + + + + Jemoji + + + + +

:+1:

+ + + +HTML +CONTENT_NOT_CONTAINING = <<-HTML.freeze + + + + + + Jemoji + + + + +

:+1:

+ + + +HTML + +Benchmark.ips do |x| + x.report("no body include?") { CONTENT_NOT_CONTAINING.include?(' 1.0" +# end +RUBY + end def preserve_source_location?(path, options) !options["force"] && !Dir["#{path}/**/*"].empty? diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 29408fe2..69ea8ba7 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -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 diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 0f8618a1..cf499aa2 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -44,6 +44,7 @@ module Jekyll 'port' => '4000', 'host' => '127.0.0.1', 'baseurl' => '', + 'show_dir_listing' => false, # Output Configuration 'permalink' => 'date', diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb index 6d42c067..48509f9d 100644 --- a/lib/jekyll/entry_filter.rb +++ b/lib/jekyll/entry_filter.rb @@ -1,6 +1,6 @@ module Jekyll class EntryFilter - SPECIAL_LEADING_CHARACTERS = ['.', '_', '#'].freeze + SPECIAL_LEADING_CHARACTERS = ['.', '_', '#', '~'].freeze attr_reader :site diff --git a/lib/jekyll/errors.rb b/lib/jekyll/errors.rb index 36b2643d..322eb6af 100644 --- a/lib/jekyll/errors.rb +++ b/lib/jekyll/errors.rb @@ -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 diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 183c9c58..02523d9c 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -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 diff --git a/lib/jekyll/hooks.rb b/lib/jekyll/hooks.rb index 869bcc1f..6d8fcd8d 100644 --- a/lib/jekyll/hooks.rb +++ b/lib/jekyll/hooks.rb @@ -12,6 +12,7 @@ module Jekyll # initial empty hooks @registry = { :site => { + :after_init => [], :after_reset => [], :post_read => [], :pre_render => [], diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index d5c1f1c6..e13a6bda 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -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. diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index 0ed0fbfe..3e7d0d25 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -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 diff --git a/lib/jekyll/tags/link.rb b/lib/jekyll/tags/link.rb new file mode 100644 index 00000000..f81e43b4 --- /dev/null +++ b/lib/jekyll/tags/link.rb @@ -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) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 6c4c9f8e..b05d056b 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -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. diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 5d0dda2e..179981ec 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -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 diff --git a/lib/site_template/_config.yml b/lib/site_template/_config.yml index 1c5e5bc9..e23ad0fe 100644 --- a/lib/site_template/_config.yml +++ b/lib/site_template/_config.yml @@ -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:" diff --git a/site/_docs/assets.md b/site/_docs/assets.md index db8847c1..8e850548 100644 --- a/site/_docs/assets.md +++ b/site/_docs/assets.md @@ -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 %} --- diff --git a/site/_docs/collections.md b/site/_docs/collections.md index ede3ffef..87c7c8e9 100644 --- a/site/_docs/collections.md +++ b/site/_docs/collections.md @@ -303,11 +303,8 @@ file, each document has the following attributes:

- 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 render key in the site's configuration - file. -

+ The URL of the rendered collection. The file is only written to the destination when the collection to which it belongs has output: true in the site's configuration. +

diff --git a/site/_docs/configuration.md b/site/_docs/configuration.md index 72929f0a..9956cb77 100644 --- a/site/_docs/configuration.md +++ b/site/_docs/configuration.md @@ -214,7 +214,7 @@ class="flag">flags (specified on the command-line) that control them.

Future

-

Publish posts with a future date.

+

Publish posts or collection documents with a future date.

future: BOOL

diff --git a/site/_docs/contributing.md b/site/_docs/contributing.md index 9ac49666..c128ced9 100644 --- a/site/_docs/contributing.md +++ b/site/_docs/contributing.md @@ -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 +
$ script/bootstrap
Before you make any changes, run the tests and make sure that they pass (to confirm your environment is configured properly): - $ script/cibuild +
$ script/cibuild
If you are only updating a file in `test/`, you can use the command: - $ script/test test/blah_test.rb +
$ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command: - $ script/cucumber features/blah.feature +
$ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to run its entire respective suite. diff --git a/site/_docs/plugins.md b/site/_docs/plugins.md index 932fd204..8f173cb0 100644 --- a/site/_docs/plugins.md +++ b/site/_docs/plugins.md @@ -516,6 +516,18 @@ The complete list of available hooks is below: + + +

:site

+ + +

:after_init

+ + +

Just after the site initializes, but before setup & render. Good + for modifying the configuration of the site.

+ +

:site

@@ -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 diff --git a/site/_docs/resources.md b/site/_docs/resources.md index 261100f0..0e403986 100644 --- a/site/_docs/resources.md +++ b/site/_docs/resources.md @@ -35,4 +35,4 @@ Jekyll’s 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) diff --git a/site/_docs/templates.md b/site/_docs/templates.md index 0ebd35f8..60892505 100644 --- a/site/_docs/templates.md +++ b/site/_docs/templates.md @@ -271,6 +271,39 @@ common tasks easier.

+ + +

Array Filters

+

Push, pop, shift, and unshift elements from an Array.

+

These are NON-DESTRUCTIVE, i.e. they do not mutate the array, but rather make a copy and mutate that.

+ + +

+ {% raw %}{{ page.tags | push: 'Spokane' }}{% endraw %} +

+

+ ['Seattle', 'Tacoma', 'Spokane'] +

+

+ {% raw %}{{ page.tags | pop }}{% endraw %} +

+

+ ['Seattle'] +

+

+ {% raw %}{{ page.tags | shift }}{% endraw %} +

+

+ ['Tacoma'] +

+

+ {% raw %}{{ page.tags | unshift: "Olympia" }}{% endraw %} +

+

+ ['Olympia', 'Seattle', 'Tacoma'] +

+ +
diff --git a/site/_docs/troubleshooting.md b/site/_docs/troubleshooting.md index 5d7b1ad9..899f129e 100644 --- a/site/_docs/troubleshooting.md +++ b/site/_docs/troubleshooting.md @@ -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: diff --git a/site/_docs/windows.md b/site/_docs/windows.md index ddb08926..c573747d 100644 --- a/site/_docs/windows.md +++ b/site/_docs/windows.md @@ -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 diff --git a/site/help/index.md b/site/help/index.md index 11213471..46ddcd4d 100644 --- a/site/help/index.md +++ b/site/help/index.md @@ -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 diff --git a/test/test_cleaner.rb b/test/test_cleaner.rb index 43d99503..2118c4f4 100644 --- a/test/test_cleaner.rb +++ b/test/test_cleaner.rb @@ -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 diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 87472c3d..9fd3c1db 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -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 diff --git a/test/test_entry_filter.rb b/test/test_entry_filter.rb index c0ce59b3..546f0252 100644 --- a/test/test_entry_filter.rb +++ b/test/test_entry_filter.rb @@ -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 diff --git a/test/test_filters.rb b/test/test_filters.rb index de59bc02..4ded0cd6 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -394,6 +394,10 @@ class TestFilters < JekyllUnitTest should "return a HTML-escaped string representation of an object" do assert_equal "{"<a>"=>1}", @filter.inspect({ "" => 1 }) end + + should "quote strings" do + assert_equal ""string"", @filter.inspect("string") + end end context "slugify filter" do diff --git a/test/test_new_command.rb b/test/test_new_command.rb index f0d2a389..7ba84781 100644 --- a/test/test_new_command.rb +++ b/test/test_new_command.rb @@ -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) } diff --git a/test/test_tags.rb b/test/test_tags.rb index f263e9d8..bd481265 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -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 "

This is not yet highlighted

\n\n
1
test\n
\n\n

This should not be highlighted, right?

", @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 = < 'pretty', + 'source' => source_dir, + 'destination' => dest_dir, + 'read_posts' => true + }) + end + end + end + + context "simple page with linking" do + setup do + content = < 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 = < 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 = < '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 diff --git a/test/test_utils.rb b/test/test_utils.rb index eab0ca1e..f102b7a6 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -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