Merge branch 'master' into jekyll-feed

This commit is contained in:
Ben Balter 2015-09-01 14:35:55 -04:00
commit 47df90583a
64 changed files with 851 additions and 238 deletions

View File

@ -5,7 +5,10 @@ rvm:
- 2.2 - 2.2
- 2.1 - 2.1
- 2.0 - 2.0
- jruby-head - jruby-9.0.0.0
matrix:
allow_failures:
- rvm: jruby-9.0.0.0
env: env:
matrix: matrix:
- TEST_SUITE=test - TEST_SUITE=test

22
CONDUCT.md Normal file
View File

@ -0,0 +1,22 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

View File

@ -31,16 +31,25 @@ Test Dependencies
----------------- -----------------
To run the test suite and build the gem you'll need to install Jekyll's To run the test suite and build the gem you'll need to install Jekyll's
dependencies. Jekyll uses Bundler, so a quick run of the bundle command and dependencies. Simply run this command to get all setup:
you're all set!
$ bundle $ script/bootstrap
Before you start, run the tests and make sure that they pass (to confirm your Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly): environment is configured properly):
$ bundle exec rake test $ script/cibuild
$ bundle exec rake features
If you are only updating a file in `test/`, you can use the command:
$ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command:
$ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite.
Workflow Workflow
-------- --------
@ -48,10 +57,10 @@ Workflow
Here's the most direct way to get your work merged into the project: Here's the most direct way to get your work merged into the project:
* Fork the project. * Fork the project.
* Clone down your fork ( `git clone git@github.com:<username>/jekyll.git` ). * Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ).
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ). * Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
* Hack away, add tests. Not necessarily in that order. * Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `rake`. * Make sure everything still passes by running `script/cibuild`.
* If necessary, rebase your commits into logical chunks, without errors. * If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up ( `git push origin my_awesome_feature` ). * Push the branch up ( `git push origin my_awesome_feature` ).
* Create a pull request against jekyll/jekyll and describe what your change * Create a pull request against jekyll/jekyll and describe what your change
@ -74,11 +83,16 @@ requests directed at another branch will not be accepted.
The [Jekyll wiki](https://github.com/jekyll/jekyll/wiki) on GitHub The [Jekyll wiki](https://github.com/jekyll/jekyll/wiki) on GitHub
can be freely updated without a pull request as all GitHub users have access. can be freely updated without a pull request as all GitHub users have access.
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.
Gotchas Gotchas
------- -------
* If you want to bump the gem version, please put that in a separate commit. * Please do not bump the gem version in your pull requests.
This way, the maintainers can control when the gem gets released.
* Try to keep your patch(es) based from the latest commit on jekyll/jekyll. * Try to keep your patch(es) based from the latest commit on jekyll/jekyll.
The easier it is to apply your work, the less work the maintainers have to do, The easier it is to apply your work, the less work the maintainers have to do,
which is always a good thing. which is always a good thing.

79
Gemfile
View File

@ -1,48 +1,55 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gemspec gemspec
gem 'pry' gem 'rake', '~> 10.1'
gem 'toml', '~> 0.1.0' group :development do
gem 'rdoc', '~> 4.2'
gem 'launchy', '~> 2.3'
gem 'toml', '~> 0.1.0'
gem 'pry'
end
group :test do
gem 'redgreen', '~> 1.2'
gem 'shoulda', '~> 3.5'
gem 'cucumber', '~> 2.0'
gem 'simplecov', '~> 0.9'
gem 'jekyll_test_plugin'
gem 'jekyll_test_plugin_malicious'
gem 'minitest-reporters'
gem 'minitest-profile'
gem 'minitest'
gem 'rspec-mocks'
if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
gem 'test-unit'
end
if ENV['PROOF']
gem 'html-proofer', '~> 2.0'
end
end
group :benchmark do
if ENV['BENCHMARK']
gem 'ruby-prof'
gem 'rbtrace'
gem 'stackprof'
gem 'benchmark-ips'
end
end
gem 'jekyll-paginate', '~> 1.0' gem 'jekyll-paginate', '~> 1.0'
gem 'jekyll-gist', '~> 1.0'
gem 'jekyll-coffeescript', '~> 1.0' gem 'jekyll-coffeescript', '~> 1.0'
gem 'jekyll-feed' gem 'jekyll-feed'
gem 'jekyll-gist', '~> 1.0'
gem 'mime-types', '~> 2.6'
gem 'kramdown', '~> 1.8.0'
platform :ruby, :mswin, :mingw do platform :ruby, :mswin, :mingw do
gem 'pygments.rb', '~> 0.6.0'
gem 'rdiscount', '~> 2.0' gem 'rdiscount', '~> 2.0'
gem 'classifier-reborn', '~> 2.0' gem 'pygments.rb', '~> 0.6.0'
gem 'redcarpet', '~> 3.2', '>= 3.2.3' gem 'redcarpet', '~> 3.2', '>= 3.2.3'
gem 'classifier-reborn', '~> 2.0'
gem 'liquid-c', '~> 3.0' gem 'liquid-c', '~> 3.0'
end end
if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
gem 'test-unit'
end
gem 'rake', '~> 10.1'
gem 'rdoc', '~> 3.11'
gem 'redgreen', '~> 1.2'
gem 'shoulda', '~> 3.5'
gem 'cucumber', '1.3.18'
gem 'launchy', '~> 2.3'
gem 'simplecov', '~> 0.9'
gem 'mime-types', '~> 1.5'
gem 'kramdown', '~> 1.7.0'
gem 'jekyll_test_plugin'
gem 'jekyll_test_plugin_malicious'
gem 'minitest-reporters'
gem 'minitest-profile'
gem 'minitest'
gem 'rspec-mocks'
if ENV['BENCHMARK']
gem 'ruby-prof'
gem 'rbtrace'
gem 'stackprof'
gem 'benchmark-ips'
end
if ENV['PROOF']
gem 'html-proofer', '~> 2.0'
end

View File

@ -2,11 +2,12 @@
### Major Enhancements ### Major Enhancements
* Add basic support for JRuby (commit: 0f4477) * Liquid profiler (i.e. know how fast or slow your templates render) (#3762)
* Incremental regeneration (#3116) * Incremental regeneration (#3116)
* Add Hooks: a new kind of plugin (#3553) * Add Hooks: a new kind of plugin (#3553)
* Drop support for Ruby 1.9.3. (#3235)
* Upgrade to Liquid 3.0.0 (#3002) * Upgrade to Liquid 3.0.0 (#3002)
* Add basic support for JRuby (commit: 0f4477)
* Drop support for Ruby 1.9.3. (#3235)
* Support Ruby v2.2 (#3234) * Support Ruby v2.2 (#3234)
* Support RDiscount 2 (#2767) * Support RDiscount 2 (#2767)
* Remove most runtime deps (#3323) * Remove most runtime deps (#3323)
@ -17,6 +18,8 @@
* Sunset (i.e. remove) Maruku (#3655) * Sunset (i.e. remove) Maruku (#3655)
* Remove support for relative permalinks (#3679) * Remove support for relative permalinks (#3679)
* Iterate over `site.collections` as an array instead of a hash. (#3670) * Iterate over `site.collections` as an array instead of a hash. (#3670)
* Adapt StaticFile for collections, config defaults (#3823)
* Add a Code of Conduct for the Jekyll project (#3925)
### Minor Enhancements ### Minor Enhancements
@ -77,6 +80,12 @@
* Added talk.jekyllrb.com to "Have questions?" (#3694) * Added talk.jekyllrb.com to "Have questions?" (#3694)
* Performance: Sort files only once (#3707) * Performance: Sort files only once (#3707)
* Performance: Marshal metadata (#3706) * Performance: Marshal metadata (#3706)
* Upgrade highlight wrapper from `div` to `figure` (#3779)
* Upgrade mime-types to `~> 2.6` (#3795)
* Update windows.md with Ruby version info (#3818)
* Make the directory for includes configurable (#3782)
* Rename directory configurations to match `*_dir` convention for consistency (#3782)
* Internal: trigger hooks by owner symbol (#3871)
### Bug Fixes ### Bug Fixes
@ -110,6 +119,17 @@
* Upgrade redcarpet to 3.2 (Security fix: OSVDB-120415) (#3652) * Upgrade redcarpet to 3.2 (Security fix: OSVDB-120415) (#3652)
* Create #mock_expects that goes directly to RSpec Mocks. (#3658) * Create #mock_expects that goes directly to RSpec Mocks. (#3658)
* Open `.jekyll-metadata` in binary mode to read binary Marshal data (#3713) * Open `.jekyll-metadata` in binary mode to read binary Marshal data (#3713)
* Incremental regeneration: handle deleted, renamed, and moved dependencies (#3717)
* Fix typo on line 19 of pagination.md (#3760)
* Fix it so that 'blog.html' matches 'blog.html' (#3732)
* Remove occasionally-problematic `ensure` in `LiquidRenderer` (#3811)
* Fixed an unclear code comment in site template SCSS (#3837)
* Fix reading of binary metadata file (#3845)
* Remove var collision with site template header menu iteration variable (#3838)
* Change non-existent `hl_linenos` to `hl_lines` to allow passthrough in safe mode (#3787)
* Add missing flag to disable the watcher (#3820)
* Update CI guide to include more direct explanations of the flow (#3891)
* Set `future` to `false` in the default config (#3892)
### Development Fixes ### Development Fixes
@ -140,6 +160,13 @@
* Force minitest version to 5.5.1 (#3657) * Force minitest version to 5.5.1 (#3657)
* Update the way cucumber accesses Minitest assertions (#3678) * Update the way cucumber accesses Minitest assertions (#3678)
* Add `script/rubyprof` to generate cachegrind callgraphs (#3692) * Add `script/rubyprof` to generate cachegrind callgraphs (#3692)
* Upgrade cucumber to 2.x (#3795)
* Update Kramdown. (#3853)
* Updated the scripts shebang for portability (#3858)
* Update JRuby testing to 9K ([3ab386f](https://github.com/jekyll/jekyll/commit/3ab386f1b096be25a24fe038fc70fd0fb08d545d))
* Organize dependencies into dev and test groups. (#3852)
* Contributing.md should refer to `script/cucumber` (#3894)
* Update contributing documentation to reflect workflow updates (#3895)
### Site Enhancements ### Site Enhancements
@ -201,6 +228,16 @@
* Add note to `excerpt_separator` documentation that it can be set globally (#3667) * Add note to `excerpt_separator` documentation that it can be set globally (#3667)
* Fix some names on Troubleshooting page (#3683) * Fix some names on Troubleshooting page (#3683)
* Add `remote_file_content` tag plugin to list of third-party plugins (#3691) * Add `remote_file_content` tag plugin to list of third-party plugins (#3691)
* Update the Redcarpet version on the Configuration page. (#3743)
* Update the link in the welcome post to point to Jekyll Talk (#3745)
* Update link for navbars with data attributes tutorial (#3728)
* Add `jekyll-asciinema` to list of third-party plugins (#3750)
* Update pagination example to be agnostic to first pagination dir (#3763)
* Detailed instructions for rsync deployment method (#3848)
* Add Jekyll Portfolio Generator to list of plugins (#3883)
* Add `site.html_files` to variables docs (#3880)
* Add Static Publisher tool to list of deployment methods (#3865)
* Fix a few typos. (#3897)
## 2.5.3 / 2014-12-22 ## 2.5.3 / 2014-12-22

View File

@ -22,6 +22,18 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs
* Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications * Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
* Have questions? Check out our official forum community [Jekyll Talk](https://talk.jekyllrb.com/) or [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/) * Have questions? Check out our official forum community [Jekyll Talk](https://talk.jekyllrb.com/) or [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/)
## Code of Conduct
In order to have a more open and welcoming community, Jekyll adheres to a
[code of conduct](CONDUCT.md) adapted from the Ruby on Rails code of
conduct.
Please adhere to this code of conduct in any interactions you have in the
Jekyll community. It is strictly enforced on all official Jekyll
repositories, websites, and resources. If you encounter someone violating
these terms, please let a maintainer (@parkr, @envygeeks, or @mattr-) know
and we will address it as soon as possible.
## Diving In ## Diving In
* [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system * [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system

View File

@ -22,8 +22,9 @@ Mercenary.program(:jekyll) do |p|
p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)' p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)' p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
p.option 'safe', '--safe', 'Safe mode (defaults to false)' p.option 'safe', '--safe', 'Safe mode (defaults to false)'
p.option 'plugins', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)' p.option 'plugins_dir', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
p.option 'layouts', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)' p.option 'layouts_dir', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
p.option 'profile', '--profile', 'Generate a Liquid rendering profile'
Jekyll::Command.subclasses.each { |c| c.init_with_program(p) } Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }

View File

@ -1,14 +0,0 @@
machine:
timezone: UTC
ruby:
version: 2.1.5
environment:
PROOF: true
test:
override:
- script/proof -f
general:
branches:
ignore:
- gh-pages # no proof script here
- master # don't need to duplicate work

View File

@ -112,16 +112,16 @@ Feature: Create sites
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with internal post linking Scenario: Basic site with internal post linking
Given I have an "index.html" page that contains "URL: {% post_url 2020-01-31-entry2 %}" Given I have an "index.html" page that contains "URL: {% post_url 2008-01-01-entry2 %}"
And I have a configuration file with "permalink" set to "pretty" And I have a configuration file with "permalink" set to "pretty"
And I have a _posts directory And I have a _posts directory
And I have the following posts: And I have the following posts:
| title | date | layout | content | | title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. | | entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. | | entry2 | 2008-01-01 | post | content for entry2. |
When I run jekyll build When I run jekyll build
Then the _site directory should exist Then the _site directory should exist
And I should see "URL: /2020/01/31/entry2/" in "_site/index.html" And I should see "URL: /2008/01/01/entry2/" in "_site/index.html"
Scenario: Basic site with whitelisted dotfile Scenario: Basic site with whitelisted dotfile
Given I have an ".htaccess" file that contains "SomeDirective" Given I have an ".htaccess" file that contains "SomeDirective"
@ -156,3 +156,17 @@ Feature: Create sites
And the "_site/index.html" file should exist And the "_site/index.html" file should exist
And the "_site/public.html" file should exist And the "_site/public.html" file should exist
And the "_site/secret.html" file should exist And the "_site/secret.html" file should exist
Scenario: Basic site with page with future date
Given I have a _posts directory
And I have the following post:
| title | date | layout | content |
| entry1 | 2020-12-31 | post | content for entry1. |
| entry2 | 2007-12-31 | post | content for entry2. |
When I run jekyll build
Then the _site directory should exist
And I should see "content for entry2" in "_site/2007/12/31/entry2.html"
And the "_site/2020/12/31/entry1.html" file should not exist
When I run jekyll build --future
Then the _site directory should exist
And the "_site/2020/12/31/entry1.html" file should exist

View File

@ -224,7 +224,7 @@ Feature: Site configuration
| key | value | | key | value |
| time | 2010-01-01 | | time | 2010-01-01 |
| future | true | | future | true |
| layouts | _theme | | layouts_dir | _theme |
And I have a _posts directory And I have a _posts directory
And I have the following posts: And I have the following posts:
| title | date | layout | content | | title | date | layout | content |

View File

@ -66,6 +66,7 @@ module Jekyll
autoload :Regenerator, 'jekyll/regenerator' autoload :Regenerator, 'jekyll/regenerator'
autoload :RelatedPosts, 'jekyll/related_posts' autoload :RelatedPosts, 'jekyll/related_posts'
autoload :Renderer, 'jekyll/renderer' autoload :Renderer, 'jekyll/renderer'
autoload :LiquidRenderer, 'jekyll/liquid_renderer'
autoload :Site, 'jekyll/site' autoload :Site, 'jekyll/site'
autoload :StaticFile, 'jekyll/static_file' autoload :StaticFile, 'jekyll/static_file'
autoload :Stevenson, 'jekyll/stevenson' autoload :Stevenson, 'jekyll/stevenson'

View File

@ -9,9 +9,10 @@ module Jekyll
# Where things are # Where things are
'source' => Dir.pwd, 'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'), 'destination' => File.join(Dir.pwd, '_site'),
'plugins' => '_plugins', 'plugins_dir' => '_plugins',
'layouts' => '_layouts', 'layouts_dir' => '_layouts',
'data_source' => '_data', 'data_dir' => '_data',
'includes_dir' => '_includes',
'collections' => nil, 'collections' => nil,
# Handling Reading # Handling Reading
@ -26,7 +27,7 @@ module Jekyll
# Filtering Content # Filtering Content
'show_drafts' => nil, 'show_drafts' => nil,
'limit_posts' => 0, 'limit_posts' => 0,
'future' => true, # remove and make true just default 'future' => false,
'unpublished' => false, 'unpublished' => false,
# Plugins # Plugins
@ -219,14 +220,10 @@ module Jekyll
config.delete('server') config.delete('server')
end end
if config.key? 'server_port' renamed_key 'server_port', 'port', config
Jekyll::Deprecator.deprecation_message "The 'server_port' configuration option" + renamed_key 'plugins', 'plugins_dir', config
" has been renamed to 'port'. Please update your config" + renamed_key 'layouts', 'layouts_dir', config
" file accordingly." renamed_key 'data_source', 'data_dir', config
# copy but don't overwrite:
config['port'] = config['server_port'] unless config.key?('port')
config.delete('server_port')
end
if config.key? 'pygments' if config.key? 'pygments'
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" + Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" +
@ -277,5 +274,14 @@ module Jekyll
config config
end end
def renamed_key(old, new, config, allowed_values = nil)
if config.key?(old)
Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" +
"option has been renamed to '#{new}'. Please update your config " +
"file accordingly."
config[new] = config.delete(old)
end
end
end end
end end

View File

@ -29,7 +29,7 @@ module Jekyll
include CommonMethods include CommonMethods
def code_wrap(code) def code_wrap(code)
"<div class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></div>" "<figure class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></figure>"
end end
def block_code(code, lang) def block_code(code, lang)

View File

@ -108,8 +108,8 @@ module Jekyll
# info - the info for Liquid # info - the info for Liquid
# #
# Returns the converted content # Returns the converted content
def render_liquid(content, payload, info, path = nil) def render_liquid(content, payload, info, path)
Liquid::Template.parse(content).render!(payload, info) site.liquid_renderer.file(path).parse(content).render(payload, info)
rescue Tags::IncludeTagError => e rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || self.path}" Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || self.path}"
raise e raise e
@ -144,6 +144,15 @@ module Jekyll
end end
end end
# returns the owner symbol for hook triggering
def hook_owner
if is_a?(Post)
:post
elsif is_a?(Page)
:page
end
end
# Determine whether the document is an asset file. # Determine whether the document is an asset file.
# Asset files include CoffeeScript files and Sass/SCSS files. # Asset files include CoffeeScript files and Sass/SCSS files.
# #
@ -211,7 +220,7 @@ module Jekyll
self.output = render_liquid(layout.content, self.output = render_liquid(layout.content,
payload, payload,
info, info,
File.join(site.config['layouts'], layout.name)) File.join(site.config['layouts_dir'], layout.name))
# Add layout to dependency tree # Add layout to dependency tree
site.regenerator.add_dependency( site.regenerator.add_dependency(
@ -236,21 +245,21 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def do_layout(payload, layouts) def do_layout(payload, layouts)
Jekyll::Hooks.trigger self, :pre_render, payload Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload['page'] } } info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload['page'] } }
# render and transform content (this becomes the final content of the object) # render and transform content (this becomes the final content of the object)
payload["highlighter_prefix"] = converters.first.highlighter_prefix payload["highlighter_prefix"] = converters.first.highlighter_prefix
payload["highlighter_suffix"] = converters.first.highlighter_suffix payload["highlighter_suffix"] = converters.first.highlighter_suffix
self.content = render_liquid(content, payload, info) if render_with_liquid? self.content = render_liquid(content, payload, info, path) if render_with_liquid?
self.content = transform self.content = transform
# output keeps track of what will finally be written # output keeps track of what will finally be written
self.output = content self.output = content
render_all_layouts(layouts, payload, info) if place_in_layout? render_all_layouts(layouts, payload, info) if place_in_layout?
Jekyll::Hooks.trigger self, :post_render Jekyll::Hooks.trigger hook_owner, :post_render, self
end end
# Write the generated page file to the destination directory. # Write the generated page file to the destination directory.
@ -264,7 +273,7 @@ module Jekyll
File.open(path, 'wb') do |f| File.open(path, 'wb') do |f|
f.write(output) f.write(output)
end end
Jekyll::Hooks.trigger self, :post_write Jekyll::Hooks.trigger hook_owner, :post_write, self
end end
# Accessor for data properties by Liquid. # Accessor for data properties by Liquid.

View File

@ -190,7 +190,7 @@ module Jekyll
f.write(output) f.write(output)
end end
Jekyll::Hooks.trigger self, :post_write Jekyll::Hooks.trigger :document, :post_write, self
end end
# Returns merged option hash for File.read of self.site (if exists) # Returns merged option hash for File.read of self.site (if exists)

View File

@ -173,7 +173,7 @@ module Jekyll
if path.nil? || path.empty? if path.nil? || path.empty?
"" ""
else else
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1/') path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1')
end end
end end
end end

View File

@ -1,13 +1,5 @@
module Jekyll module Jekyll
module Hooks module Hooks
# Helps look up hooks from the registry by owner's class
OWNER_MAP = {
Jekyll::Site => :site,
Jekyll::Page => :page,
Jekyll::Post => :post,
Jekyll::Document => :document,
}.freeze
DEFAULT_PRIORITY = 20 DEFAULT_PRIORITY = 20
# compatibility layer for octopress-hooks users # compatibility layer for octopress-hooks users
@ -88,19 +80,17 @@ module Jekyll
end end
# interface for Jekyll core components to trigger hooks # interface for Jekyll core components to trigger hooks
def self.trigger(instance, event, *args) def self.trigger(owner, event, *args)
owner_symbol = OWNER_MAP[instance.class]
# proceed only if there are hooks to call # proceed only if there are hooks to call
return unless @registry[owner_symbol] return unless @registry[owner]
return unless @registry[owner_symbol][event] return unless @registry[owner][event]
# hooks to call for this owner and event # hooks to call for this owner and event
hooks = @registry[owner_symbol][event] hooks = @registry[owner][event]
# sort and call hooks according to priority and load order # sort and call hooks according to priority and load order
hooks.sort_by { |h| @hook_priority[h] }.each do |hook| hooks.sort_by { |h| @hook_priority[h] }.each do |hook|
hook.call(instance, *args) hook.call(*args)
end end
end end
end end

View File

@ -0,0 +1,39 @@
require 'jekyll/liquid_renderer/file'
require 'jekyll/liquid_renderer/table'
module Jekyll
class LiquidRenderer
def initialize(site)
@site = site
reset
end
def reset
@stats = {}
end
def file(filename)
filename = @site.in_source_dir(filename).sub(/\A#{Regexp.escape(@site.source)}\//, '')
LiquidRenderer::File.new(self, filename).tap do |file|
@stats[filename] ||= {}
@stats[filename][:count] ||= 0
@stats[filename][:count] += 1
end
end
def increment_bytes(filename, bytes)
@stats[filename][:bytes] ||= 0
@stats[filename][:bytes] += bytes
end
def increment_time(filename, time)
@stats[filename][:time] ||= 0.0
@stats[filename][:time] += time
end
def stats_table(n = 50)
LiquidRenderer::Table.new(@stats).to_s(n)
end
end
end

View File

@ -0,0 +1,50 @@
module Jekyll
class LiquidRenderer
class File
def initialize(renderer, filename)
@renderer = renderer
@filename = filename
end
def parse(content)
measure_time do
@template = Liquid::Template.parse(content)
end
self
end
def render(*args)
measure_time do
measure_bytes do
@template.render(*args)
end
end
end
def render!(*args)
measure_time do
measure_bytes do
@template.render!(*args)
end
end
end
private
def measure_bytes
yield.tap do |str|
@renderer.increment_bytes(@filename, str.bytesize)
end
end
def measure_time
before = Time.now
yield
ensure
after = Time.now
@renderer.increment_time(@filename, after - before)
end
end
end
end

View File

@ -0,0 +1,94 @@
module Jekyll
class LiquidRenderer::Table
def initialize(stats)
@stats = stats
end
def to_s(n = 50)
data = data_for_table(n)
widths = table_widths(data)
generate_table(data, widths)
end
private
def generate_table(data, widths)
str = "\n"
table_head = data.shift
str << generate_row(table_head, widths)
str << generate_table_head_border(table_head, widths)
data.each do |row_data|
str << generate_row(row_data, widths)
end
str << "\n"
str
end
def generate_table_head_border(row_data, widths)
str = ""
row_data.each_index do |cell_index|
str << '-' * widths[cell_index]
str << '-+-' unless cell_index == row_data.length-1
end
str << "\n"
str
end
def generate_row(row_data, widths)
str = ''
row_data.each_with_index do |cell_data, cell_index|
if cell_index == 0
str << cell_data.ljust(widths[cell_index], ' ')
else
str << cell_data.rjust(widths[cell_index], ' ')
end
str << ' | ' unless cell_index == row_data.length-1
end
str << "\n"
str
end
def table_widths(data)
widths = []
data.each do |row|
row.each_with_index do |cell, index|
widths[index] = [ cell.length, widths[index] ].compact.max
end
end
widths
end
def data_for_table(n)
sorted = @stats.sort_by{ |filename, file_stats| -file_stats[:time] }
sorted = sorted.slice(0, n)
table = [[ 'Filename', 'Count', 'Bytes', 'Time' ]]
sorted.each do |filename, file_stats|
row = []
row << filename
row << file_stats[:count].to_s
row << format_bytes(file_stats[:bytes])
row << "%.3f" % file_stats[:time]
table << row
end
table
end
def format_bytes(bytes)
bytes /= 1024.0
"%.2fK" % bytes
end
end
end

View File

@ -36,7 +36,7 @@ module Jekyll
site.frontmatter_defaults.find(File.join(dir, name), type, key) site.frontmatter_defaults.find(File.join(dir, name), type, key)
end end
Jekyll::Hooks.trigger self, :post_init Jekyll::Hooks.trigger :page, :post_init, self
end end
# The generated directory into which the page will be placed # The generated directory into which the page will be placed

View File

@ -82,10 +82,10 @@ module Jekyll
# #
# Returns an Array of plugin search paths # Returns an Array of plugin search paths
def plugins_path def plugins_path
if (site.config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins']) if (site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir'])
[site.in_source_dir(site.config['plugins'])] [site.in_source_dir(site.config['plugins_dir'])]
else else
Array(site.config['plugins']).map { |d| File.expand_path(d) } Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
end end
end end

View File

@ -69,7 +69,7 @@ module Jekyll
populate_categories populate_categories
populate_tags populate_tags
Jekyll::Hooks.trigger self, :post_init Jekyll::Hooks.trigger :post, :post_init, self
end end
def published? def published?

View File

@ -16,7 +16,7 @@ module Jekyll
@site.layouts = LayoutReader.new(site).read @site.layouts = LayoutReader.new(site).read
read_directories read_directories
sort_files! sort_files!
@site.data = DataReader.new(site).read(site.config['data_source']) @site.data = DataReader.new(site).read(site.config['data_dir'])
CollectionReader.new(site).read CollectionReader.new(site).read
end end

View File

@ -38,11 +38,11 @@ module Jekyll
end end
def layout_directory_inside_source def layout_directory_inside_source
site.in_source_dir(site.config['layouts']) site.in_source_dir(site.config['layouts_dir'])
end end
def layout_directory_in_cwd def layout_directory_in_cwd
dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts']) dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts_dir'])
if File.directory?(dir) && !site.safe if File.directory?(dir) && !site.safe
dir dir
else else

View File

@ -102,7 +102,7 @@ module Jekyll
return cache[dependency] = cache[path] = true return cache[dependency] = cache[path] = true
end end
end end
if data["mtime"].eql? File.mtime(path) if File.exist?(path) && data["mtime"].eql?(File.mtime(path))
return cache[path] = false return cache[path] = false
else else
return add(path) return add(path)
@ -130,9 +130,7 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def write_metadata def write_metadata
File.open(metadata_file, 'wb') do |f| File.binwrite(metadata_file, Marshal.dump(metadata))
f.write(Marshal.dump(metadata))
end
end end
# Produce the absolute path of the metadata file # Produce the absolute path of the metadata file
@ -158,7 +156,7 @@ module Jekyll
# Returns the read metadata. # Returns the read metadata.
def read_metadata def read_metadata
@metadata = if !disabled? && File.file?(metadata_file) @metadata = if !disabled? && File.file?(metadata_file)
content = File.read(metadata_file) content = File.binread(metadata_file)
begin begin
Marshal.load(content) Marshal.load(content)

View File

@ -35,7 +35,7 @@ module Jekyll
"page" => document.to_liquid "page" => document.to_liquid
}, site_payload || site.site_payload) }, site_payload || site.site_payload)
Jekyll::Hooks.trigger document, :pre_render, payload Jekyll::Hooks.trigger :document, :pre_render, document, payload
info = { info = {
filters: [Jekyll::Filters], filters: [Jekyll::Filters],
@ -49,7 +49,7 @@ module Jekyll
output = document.content output = document.content
if document.render_with_liquid? if document.render_with_liquid?
output = render_liquid(output, payload, info) output = render_liquid(output, payload, info, document.path)
end end
output = convert(output) output = convert(output)
@ -92,7 +92,7 @@ module Jekyll
# #
# Returns the content, rendered by Liquid. # Returns the content, rendered by Liquid.
def render_liquid(content, payload, info, path = nil) def render_liquid(content, payload, info, path = nil)
Liquid::Template.parse(content).render!(payload, info) site.liquid_renderer.file(path).parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || document.relative_path}" Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || document.relative_path}"
raise e raise e
@ -138,7 +138,7 @@ module Jekyll
layout.content, layout.content,
payload, payload,
info, info,
File.join(site.config['layouts'], layout.name) File.join(site.config['layouts_dir'], layout.name)
) )
# Add layout to dependency tree # Add layout to dependency tree

View File

@ -11,7 +11,7 @@ module Jekyll
:gems, :plugin_manager :gems, :plugin_manager
attr_accessor :converters, :generators, :reader attr_accessor :converters, :generators, :reader
attr_reader :regenerator attr_reader :regenerator, :liquid_renderer
# Public: Initialize a new Site. # Public: Initialize a new Site.
# #
@ -33,6 +33,8 @@ module Jekyll
# Initialize incremental regenerator # Initialize incremental regenerator
@regenerator = Regenerator.new(self) @regenerator = Regenerator.new(self)
@liquid_renderer = LiquidRenderer.new(self)
self.plugin_manager = Jekyll::PluginManager.new(self) self.plugin_manager = Jekyll::PluginManager.new(self)
self.plugins = plugin_manager.plugins_path self.plugins = plugin_manager.plugins_path
@ -57,6 +59,13 @@ module Jekyll
render render
cleanup cleanup
write write
print_stats
end
def print_stats
if @config['profile']
puts @liquid_renderer.stats_table
end
end end
# Reset Site details. # Reset Site details.
@ -70,13 +79,14 @@ module Jekyll
self.static_files = [] self.static_files = []
self.data = {} self.data = {}
@collections = nil @collections = nil
@regenerator.clear_cache() @regenerator.clear_cache
@liquid_renderer.reset
if limit_posts < 0 if limit_posts < 0
raise ArgumentError, "limit_posts must be a non-negative number" raise ArgumentError, "limit_posts must be a non-negative number"
end end
Jekyll::Hooks.trigger self, :after_reset Jekyll::Hooks.trigger :site, :after_reset, self
end end
# Load necessary libraries, plugins, converters, and generators. # Load necessary libraries, plugins, converters, and generators.
@ -134,7 +144,7 @@ module Jekyll
def read def read
reader.read reader.read
limit_posts! limit_posts!
Jekyll::Hooks.trigger self, :post_read Jekyll::Hooks.trigger :site, :post_read, self
end end
# Run each of the Generators. # Run each of the Generators.
@ -154,13 +164,13 @@ module Jekyll
payload = site_payload payload = site_payload
Jekyll::Hooks.trigger self, :pre_render, payload Jekyll::Hooks.trigger :site, :pre_render, self, payload
collections.each do |label, collection| collections.each do |label, collection|
collection.docs.each do |document| collection.docs.each do |document|
if regenerator.regenerate?(document) if regenerator.regenerate?(document)
document.output = Jekyll::Renderer.new(self, document, payload).run document.output = Jekyll::Renderer.new(self, document, payload).run
Jekyll::Hooks.trigger document, :post_render Jekyll::Hooks.trigger :document, :post_render, document
end end
end end
end end
@ -189,7 +199,7 @@ module Jekyll
item.write(dest) if regenerator.regenerate?(item) item.write(dest) if regenerator.regenerate?(item)
} }
regenerator.write_metadata regenerator.write_metadata
Jekyll::Hooks.trigger self, :post_write Jekyll::Hooks.trigger :site, :post_write, self
end end
# Construct a Hash of Posts indexed by the specified Post attribute. # Construct a Hash of Posts indexed by the specified Post attribute.
@ -319,7 +329,6 @@ module Jekyll
end.to_a end.to_a
end end
def each_site_file def each_site_file
%w(posts pages static_files docs_to_write).each do |type| %w(posts pages static_files docs_to_write).each do |type|
send(type).each do |item| send(type).each do |item|

View File

@ -37,7 +37,7 @@ module Jekyll
def destination_rel_dir def destination_rel_dir
if @collection if @collection
@dir.gsub(/\A_/, '') File.dirname(url)
else else
@dir @dir
end end
@ -61,9 +61,10 @@ module Jekyll
# Whether to write the file to the filesystem # Whether to write the file to the filesystem
# #
# Returns true. # Returns true unless the defaults for the destination path from
# _config.yml contain `published: false`.
def write? def write?
true defaults.fetch('published', true)
end end
# Write the static file to the destination directory (if modified). # Write the static file to the destination directory (if modified).
@ -100,5 +101,41 @@ module Jekyll
"path" => File.join("", relative_path) "path" => File.join("", relative_path)
} }
end end
def placeholders
{
collection: @collection.label,
path: relative_path[
@collection.relative_directory.size..relative_path.size],
output_ext: '',
name: '',
title: '',
}
end
# Applies a similar URL-building technique as Jekyll::Document that takes
# the collection's URL template into account. The default URL template can
# be overriden in the collection's configuration in _config.yml.
def url
@url ||= if @collection.nil?
relative_path
else
::Jekyll::URL.new({
template: @collection.url_template,
placeholders: placeholders,
})
end.to_s.gsub /\/$/, ''
end
# Returns the type of the collection if present, nil otherwise.
def type
@type ||= @collection.nil? ? nil : @collection.label.to_sym
end
# Returns the front matter defaults defined for the file's URL and/or type
# as defined in _config.yml.
def defaults
@defaults ||= @site.frontmatter_defaults.all url, type
end
end end
end end

View File

@ -64,7 +64,7 @@ eos
if is_safe if is_safe
Hash[[ Hash[[
[:startinline, opts.fetch(:startinline, nil)], [:startinline, opts.fetch(:startinline, nil)],
[:hl_linenos, opts.fetch(:hl_linenos, nil)], [:hl_lines, opts.fetch(:hl_lines, nil)],
[:linenos, opts.fetch(:linenos, nil)], [:linenos, opts.fetch(:linenos, nil)],
[:encoding, opts.fetch(:encoding, 'utf-8')], [:encoding, opts.fetch(:encoding, 'utf-8')],
[:cssclass, opts.fetch(:cssclass, nil)] [:cssclass, opts.fetch(:cssclass, nil)]
@ -113,7 +113,7 @@ eos
"class=\"language-#{@lang.to_s.gsub('+', '-')}\"", "class=\"language-#{@lang.to_s.gsub('+', '-')}\"",
"data-lang=\"#{@lang.to_s}\"" "data-lang=\"#{@lang.to_s}\""
].join(" ") ].join(" ")
"<div class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></div>" "<figure class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></figure>"
end end
end end

View File

@ -20,7 +20,6 @@ module Jekyll
def initialize(tag_name, markup, tokens) def initialize(tag_name, markup, tokens)
super super
@includes_dir = tag_includes_dir
matched = markup.strip.match(VARIABLE_SYNTAX) matched = markup.strip.match(VARIABLE_SYNTAX)
if matched if matched
@file = matched['variable'].strip @file = matched['variable'].strip
@ -95,17 +94,18 @@ eos
# Render the variable if required # Render the variable if required
def render_variable(context) def render_variable(context)
if @file.match(VARIABLE_SYNTAX) if @file.match(VARIABLE_SYNTAX)
partial = Liquid::Template.parse(@file) partial = context.registers[:site].liquid_renderer.file("(variable)").parse(@file)
partial.render!(context) partial.render!(context)
end end
end end
def tag_includes_dir def tag_includes_dir(context)
'_includes'.freeze context.registers[:site].config['includes_dir'].freeze
end end
def render(context) def render(context)
site = context.registers[:site] site = context.registers[:site]
@includes_dir = tag_includes_dir(context)
dir = resolved_includes_dir(context) dir = resolved_includes_dir(context)
file = render_variable(context) || @file file = render_variable(context) || @file
@ -123,7 +123,7 @@ eos
end end
begin begin
partial = Liquid::Template.parse(read_file(path, context)) partial = site.liquid_renderer.file(path).parse(read_file(path, context))
context.stack do context.stack do
context['include'] = parse_params(context) if @params context['include'] = parse_params(context) if @params
@ -161,7 +161,7 @@ eos
end end
class IncludeRelativeTag < IncludeTag class IncludeRelativeTag < IncludeTag
def tag_includes_dir def tag_includes_dir(context)
'.'.freeze '.'.freeze
end end

View File

@ -1,3 +1,3 @@
module Jekyll module Jekyll
VERSION = '3.0.0.pre.beta5' VERSION = '3.0.0.pre.beta8'
end end

View File

@ -14,9 +14,9 @@
</a> </a>
<div class="trigger"> <div class="trigger">
{% for page in site.pages %} {% for my_page in site.pages %}
{% if page.title %} {% if my_page.title %}
<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a> <a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>

View File

@ -18,8 +18,8 @@ print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT. #=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %} {% endhighlight %}
Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekylls dedicated Help repository][jekyll-help]. Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
[jekyll-docs]: http://jekyllrb.com/docs/home [jekyll-docs]: http://jekyllrb.com/docs/home
[jekyll-gh]: https://github.com/jekyll/jekyll [jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-help]: https://github.com/jekyll/jekyll-help [jekyll-talk]: https://talk.jekyllrb.com/

2
lib/site_template/css/main.scss Executable file → Normal file
View File

@ -30,7 +30,7 @@ $on-laptop: 800px;
// Using media queries with like this: // Use media queries like this:
// @include media-query($on-palm) { // @include media-query($on-palm) {
// .wrapper { // .wrapper {
// padding-right: $spacing-unit / 2; // padding-right: $spacing-unit / 2;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
script/branding script/branding
bundle install -j8 bundle install -j8

View File

@ -1,4 +1,4 @@
#! /bin/bash #!/usr/bin/env bash
echo " ---------------------------------------------------------- " echo " ---------------------------------------------------------- "
echo " _ ______ _ __ __ __ _ _ " echo " _ ______ _ __ __ __ _ _ "

View File

@ -1,4 +1,4 @@
#! /bin/bash -e #!/usr/bin/env bash
script/branding script/branding

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if ruby --version | grep -q "jruby" if ruby --version | grep -q "jruby"
then then

View File

@ -1,4 +1,4 @@
#! /bin/bash #!/usr/bin/env bash
# #
# Usage: # Usage:
# script/proof # script/proof

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# rebund(1) # rebund(1)
# #

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export BENCHMARK=1 export BENCHMARK=1
TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site', 'full_rebuild' => true})" TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site', 'full_rebuild' => true})"

View File

@ -1,4 +1,5 @@
#! /bin/bash -e #!/usr/bin/env bash
set -e
# Usage: # Usage:
# script/test <test_file> # script/test <test_file>

View File

@ -73,7 +73,7 @@ You may also specify the output style with the `style` option in your
{% highlight yaml %} {% highlight yaml %}
sass: sass:
style: :compressed style: compressed
{% endhighlight %} {% endhighlight %}
These are passed to Sass, so any output style options Sass supports are valid These are passed to Sass, so any output style options Sass supports are valid

View File

@ -180,7 +180,7 @@ class="flag">flags</code> (specified on the command-line) that control them.
<p class="description">Enable auto-regeneration of the site when files are modified.</p> <p class="description">Enable auto-regeneration of the site when files are modified.</p>
</td> </td>
<td class="align-center"> <td class="align-center">
<p><code class="flag">-w, --watch</code></p> <p><code class="flag">-w, --[no-]watch</code></p>
</td> </td>
</tr> </tr>
<tr class="setting"> <tr class="setting">
@ -465,12 +465,13 @@ file or on the command-line.
{% highlight yaml %} {% highlight yaml %}
# Where things are # Where things are
source: . source: .
destination: ./_site destination: ./_site
plugins: ./_plugins plugins_dir: ./_plugins
layouts: ./_layouts layouts_dir: ./_layouts
data_source: ./_data data_dir: ./_data
collections: null includes_dir: ./_includes
collections: null
# Handling Reading # Handling Reading
safe: false safe: false
@ -483,7 +484,7 @@ markdown_ext: "markdown,mkdown,mkdn,mkd,md"
# Filtering Content # Filtering Content
show_drafts: null show_drafts: null
limit_posts: 0 limit_posts: 0
future: true future: false
unpublished: false unpublished: false
# Plugins # Plugins
@ -574,15 +575,14 @@ All other extensions retain their usual names from Redcarpet, and no renderer
options aside from `smart` can be specified in Jekyll. [A list of available options aside from `smart` can be specified in Jekyll. [A list of available
extensions can be found in the Redcarpet README file.][redcarpet_extensions] extensions can be found in the Redcarpet README file.][redcarpet_extensions]
Make sure you're looking at the README for the right version of Make sure you're looking at the README for the right version of
Redcarpet: Jekyll currently uses v2.2.x, and extensions like `footnotes` and Redcarpet: Jekyll currently uses v3.2.x. The most commonly used
`highlight` weren't added until after version 3.0.0. The most commonly used
extensions are: extensions are:
- `tables` - `tables`
- `no_intra_emphasis` - `no_intra_emphasis`
- `autolink` - `autolink`
[redcarpet_extensions]: https://github.com/vmg/redcarpet/blob/v2.2.2/README.markdown#and-its-like-really-simple-to-use [redcarpet_extensions]: https://github.com/vmg/redcarpet/blob/v3.2.2/README.markdown#and-its-like-really-simple-to-use
### Kramdown ### Kramdown

View File

@ -34,6 +34,8 @@ This tool checks your resulting site to ensure all links and images exist.
Utilize it either with the convenient `htmlproof` command-line executable, Utilize it either with the convenient `htmlproof` command-line executable,
or write a Ruby script which utilizes the gem. or write a Ruby script which utilizes the gem.
Save the commands you want to run and succeed in a file: `./script/cibuild`
### The HTML Proofer Executable ### The HTML Proofer Executable
{% highlight bash %} {% highlight bash %}
@ -48,6 +50,12 @@ Some options can be specified via command-line switches. Check out the
`html-proofer` README for more information about these switches, or run `html-proofer` README for more information about these switches, or run
`htmlproof --help` locally. `htmlproof --help` locally.
For example to avoid testing external sites, use this command:
{% highlight bash %}
$ bundle exec htmlproof ./_site --disable-external
{% endhighlight %}
### The HTML Proofer Library ### The HTML Proofer Library
You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile): You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile):
@ -81,15 +89,21 @@ gem "jekyll"
gem "html-proofer" gem "html-proofer"
{% endhighlight %} {% endhighlight %}
Your `.travis.yml` file should look like this:
{% highlight yaml %} {% highlight yaml %}
language: ruby language: ruby
rvm: rvm:
- 2.1 - 2.1
# Assume bundler is being used, install step will run `bundle install`.
before_script:
- chmod +x ./script/cibuild # or do this locally and commit
# Assume bundler is being used, therefore
# the `install` step will run `bundle install` by default.
script: ./script/cibuild script: ./script/cibuild
# branch whitelist # branch whitelist, only for GitHub Pages
branches: branches:
only: only:
- gh-pages # test the gh-pages branch - gh-pages # test the gh-pages branch
@ -118,6 +132,16 @@ RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This
directive tells Travis the Ruby version to use when running your test directive tells Travis the Ruby version to use when running your test
script. script.
{% highlight yaml %}
before_script:
- chmod +x ./script/cibuild
{% endhighlight %}
The build script file needs to have the *executable* attribute set or
Travis will fail with a permission denied error. You can also run this
locally and commit the permissions directly, thus rendering this step
irrelevant.
{% highlight yaml %} {% highlight yaml %}
script: ./script/cibuild script: ./script/cibuild
{% endhighlight %} {% endhighlight %}
@ -136,7 +160,7 @@ script: jekyll build && htmlproof ./_site
The `script` directive can be absolutely any valid shell command. The `script` directive can be absolutely any valid shell command.
{% highlight yaml %} {% highlight yaml %}
# branch whitelist # branch whitelist, only for GitHub Pages
branches: branches:
only: only:
- gh-pages # test the gh-pages branch - gh-pages # test the gh-pages branch
@ -152,7 +176,8 @@ a pull request flow for proposing changes, you may wish to enforce a
convention for your builds such that all branches containing edits are convention for your builds such that all branches containing edits are
prefixed, exemplified above with the `/pages-(.*)/` regular expression. prefixed, exemplified above with the `/pages-(.*)/` regular expression.
The `branches` directive is completely optional. The `branches` directive is completely optional. Travis will build from every
push to any branch of your repo if leave it out.
{% highlight yaml %} {% highlight yaml %}
env: env:
@ -177,10 +202,20 @@ environment variable `NOKOGIRI_USE_SYSTEM_LIBRARIES` to `true`.
exclude: [vendor] exclude: [vendor]
{% endhighlight %} {% endhighlight %}
### Troubleshooting
**Travis error:** *"You are trying to install in deployment mode after changing
your Gemfile. Run bundle install elsewhere and add the updated Gemfile.lock
to version control."*
**Workaround:** Either run `bundle install` locally and commit your changes to
`Gemfile.lock`, or remove the `Gemfile.lock` file from your repository and add
an entry in the `.gitignore` file to avoid it from being checked in again.
### Questions? ### Questions?
This entire guide is open-source. Go ahead and [edit it][3] if you have a This entire guide is open-source. Go ahead and [edit it][3] if you have a
fix or [ask for help][4] if you run into trouble and need some help. fix or [ask for help][4] if you run into trouble and need some help.
[3]: https://github.com/jekyll/jekyll/edit/master/site/_docs/continuous-integration.md [3]: https://github.com/jekyll/jekyll/edit/master/site/_docs/continuous-integration.md
[4]: https://github.com/jekyll/jekyll-help#how-do-i-ask-a-question [4]: http://jekyllrb.com/help/

View File

@ -7,10 +7,12 @@ permalink: /docs/contributing/
So you've got an awesome idea to throw into Jekyll. Great! Please keep the So you've got an awesome idea to throw into Jekyll. Great! Please keep the
following in mind: following in mind:
* **Use https://talk.jekyllrb.com for non-technical or indirect Jekyll questions that are not bugs.**
* **Contributions will not be accepted without tests or necessary documentation updates.**
* If you're creating a small fix or patch to an existing feature, just a simple * If you're creating a small fix or patch to an existing feature, just a simple
test will do. Please stay in the confines of the current test suite and use test will do. Please stay in the confines of the current test suite and use
[Shoulda](https://github.com/thoughtbot/shoulda/tree/master) and [Shoulda](https://github.com/thoughtbot/shoulda/tree/master) and
[RSpec Mocks](https://github.com/rspec/rspec-mocks/). [RSpec-Mocks](https://github.com/rspec/rspec-mocks).
* If it's a brand new feature, make sure to create a new * If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps [Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
where appropriate. Also, whipping up some documentation in your fork's `site` where appropriate. Also, whipping up some documentation in your fork's `site`
@ -36,24 +38,30 @@ following in mind:
</p> </p>
</div> </div>
Test Dependencies Test Dependencies
----------------- -----------------
To run the test suite and build the gem you'll need to install Jekyll's To run the test suite and build the gem you'll need to install Jekyll's
dependencies. Jekyll uses Bundler, so a quick run of the `bundle` command and dependencies. Simply run this command to get all setup:
you're all set!
{% highlight bash %} $ script/bootstrap
$ bundle
{% endhighlight %}
Before you start, run the tests and make sure that they pass (to confirm your Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly): environment is configured properly):
{% highlight bash %} $ script/cibuild
$ bundle exec rake test
$ bundle exec rake features If you are only updating a file in `test/`, you can use the command:
{% endhighlight %}
$ script/test test/blah_test.rb
If you are only updating a `.feature` file, you can use the command:
$ script/cucumber features/blah.feature
Both `script/test` and `script/cucumber` can be run without arguments to
run its entire respective suite.
Workflow Workflow
-------- --------
@ -61,30 +69,14 @@ Workflow
Here's the most direct way to get your work merged into the project: Here's the most direct way to get your work merged into the project:
* Fork the project. * Fork the project.
* Clone down your fork: * Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ).
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
{% highlight bash %}
git clone git://github.com/<username>/jekyll.git
{% endhighlight %}
* Create a topic branch to contain your change:
{% highlight bash %}
git checkout -b my_awesome_feature
{% endhighlight %}
* Hack away, add tests. Not necessarily in that order. * Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `rake`. * Make sure everything still passes by running `script/cibuild`.
* If necessary, rebase your commits into logical chunks, without errors. * If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up: * Push the branch up ( `git push origin my_awesome_feature` ).
* Create a pull request against jekyll/jekyll and describe what your change
{% highlight bash %} does and the why you think it should be merged.
git push origin my_awesome_feature
{% endhighlight %}
* Create a pull request against jekyll/jekyll:master and describe what your
change does and the why you think it should be merged.
Updating Documentation Updating Documentation
---------------------- ----------------------
@ -101,8 +93,7 @@ All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted. requests directed at another branch will not be accepted.
The [Jekyll wiki]({{ site.repository }}/wiki) on GitHub The [Jekyll wiki]({{ site.repository }}/wiki) on GitHub
can be freely updated without a pull request as all can be freely updated without a pull request as all GitHub users have access.
GitHub users have access.
If you want to add your plugin to the [list of plugins](/docs/plugins/#available-plugins), If you want to add your plugin to the [list of plugins](/docs/plugins/#available-plugins),
please submit a pull request modifying the [plugins page source please submit a pull request modifying the [plugins page source
@ -112,14 +103,15 @@ link to your plugin under the proper subheading depending upon its type.
Gotchas Gotchas
------- -------
* If you want to bump the gem version, please put that in a separate commit. * Please do not bump the gem version in your pull requests.
This way, the maintainers can control when the gem gets released.
* Try to keep your patch(es) based from the latest commit on jekyll/jekyll. * Try to keep your patch(es) based from the latest commit on jekyll/jekyll.
The easier it is to apply your work, the less work the maintainers have to The easier it is to apply your work, the less work the maintainers have to do,
do, which is always a good thing. which is always a good thing.
* Please don't tag your GitHub issue with \[fix\], \[feature\], etc. The * Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
maintainers actively read the issues and will label it once they come across actively read the issues and will label it once they come across it.
it.
Finally...
----------
<div class="note"> <div class="note">
<h5>Let us know what could be better!</h5> <h5>Let us know what could be better!</h5>

View File

@ -84,16 +84,82 @@ host your site directly on a CDN or file host like S3.
Setup steps are fully documented Setup steps are fully documented
[in the `jekyll-hook` repo](https://github.com/developmentseed/jekyll-hook). [in the `jekyll-hook` repo](https://github.com/developmentseed/jekyll-hook).
### Static Publisher
[Static Publisher](https://github.com/static-publisher/static-publisher) is another automated deployment option with a server listening for webhook posts, though it's not tied to GitHub specifically. It has a one-click deploy to Heroku, it can watch multiple projects from one server, it has an easy to user admin interface and can publish to either S3 or to a git repository (e.g. gh-pages).
### Rake ### Rake
Another way to deploy your Jekyll site is to use [Rake](https://github.com/jimweirich/rake), [HighLine](https://github.com/JEG2/highline), and Another way to deploy your Jekyll site is to use [Rake](https://github.com/jimweirich/rake), [HighLine](https://github.com/JEG2/highline), and
[Net::SSH](https://github.com/net-ssh/net-ssh). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/cdfbc4ec5321ff8d18c3ce936e9c749dbbc4f190/Rakefile). [Net::SSH](https://github.com/net-ssh/net-ssh). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/cdfbc4ec5321ff8d18c3ce936e9c749dbbc4f190/Rakefile).
### scp
Once youve generated the `_site` directory, you can easily scp it using a `tasks/deploy` shell script similar to [this deploy script here](https://github.com/henrik/henrik.nyh.se/blob/master/script/deploy). Youd obviously need to change the values to reflect your sites details. There is even [a matching TextMate command](http://gist.github.com/214959) that will help you run this script from within Textmate.
### rsync ### rsync
Once youve generated the `_site` directory, you can easily rsync it using a `tasks/deploy` shell script similar to [this deploy script here](https://github.com/henrik/henrik.nyh.se/blob/master/script/deploy). Youd obviously need to change the values to reflect your sites details. There is even [a matching TextMate command](http://gist.github.com/214959) that will help you run Once youve generated the `_site` directory, you can easily rsync it using a `tasks/deploy` shell script similar to [this deploy script here](https://github.com/vitalyrepin/vrepinblog/blob/master/transfer.sh). Youd obviously need to change the values to reflect your sites details.
this script from within Textmate.
#### Step 1: Install rrsync to your home folder (server-side)
We will use certificate-based authorization to simplify the publishing process. It makes sense to restrict rsync access only to the directory which it is supposed to sync.
That's why rrsync wrapper shall be installed. If it is not already installed by your hoster you can do it yourself:
- [download rrsync](http://ftp.samba.org/pub/unpacked/rsync/support/rrsync)
- Put it to the bin subdirectory of your home folder (```~/bin```)
- Make it executable (```chmod +x```)
#### Step 2: Setup certificate-based ssh access (server side)
[This process is described in a lot of places in the net](https://wiki.gentoo.org/wiki/SSH#Passwordless_Authentication). We will not cover it here. What is different from usual approach is to put the restriction to certificate-based authorization in ```~/.ssh/authorized_keys```). We will launch ```rrsync``` utility and supply it with the folder it shall have read-write access to:
```
command="$HOME/bin/rrsync <folder>",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa <cert>
```
```<folder>``` is the path to your site. E.g., ```~/public_html/you.org/blog-html/```.
#### Step 3: Rsync! (client-side)
Add the script ```deploy``` to the web site source folder:
{% highlight bash %}
#!/bin/sh
rsync -avr --rsh='ssh -p2222' --delete-after --delete-excluded <folder> <user>@<site>:
{% endhighlight %}
Command line parameters are:
- ```--rsh='ssh -p2222'``` It is needed if your hoster provides ssh access using ssh port different from default one (e.g., this is what hostgator is doing)
- ```<folder>``` is the name of the local folder with generated web content. By default it is ```_site/``` for Jekyll
- ```<user>``` &mdash; ssh user name for your hosting account
- ```<site>``` &mdash; your hosting server
Example command line is:
{% highlight bash %}
rsync -avr --rsh='ssh -p2222' --delete-after --delete-excluded _site/ hostuser@vrepin.org:
{% endhighlight %}
Don't forget column ':' after server name!
#### Optional step 4: exclude transfer.sh from being copied to the output folder by Jekyll
This step is recommended if you use this how-to to deploy Jekyll-based web site. If you put ```deploy``` script to the root folder of your project, Jekyll copies it to the output folder.
This behavior can be changed in ```_config.yml```. Just add the following line there:
{% highlight yaml %}
# Do not copy these file to the output directory
exclude: ["deploy"]
{% endhighlight %}
#### We are done!
Now it's possible to publish your web site by launching ```deploy``` script. If your ssh certificate is [passphrase-protected](https://martin.kleppmann.com/2013/05/24/improving-security-of-ssh-private-keys.html), you are asked to enter the password.
## Rack-Jekyll ## Rack-Jekyll

View File

@ -16,7 +16,7 @@ and folders you need for paginated listings.
your Jekyll site. Pagination works when called from within the HTML your Jekyll site. Pagination works when called from within the HTML
file, named <code>index.html</code>, which optionally may reside in and file, named <code>index.html</code>, which optionally may reside in and
produce pagination from within a subdirectory, via the produce pagination from within a subdirectory, via the
<code>pagination_path</code> configuration value. <code>paginate_path</code> configuration value.
</p> </p>
</div> </div>
@ -204,7 +204,7 @@ page with links to all but the current page.
{% if page == paginator.page %} {% if page == paginator.page %}
<em>{{ page }}</em> <em>{{ page }}</em>
{% elsif page == 1 %} {% elsif page == 1 %}
<a href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a> <a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
{% else %} {% else %}
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a> <a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
{% endif %} {% endif %}

View File

@ -711,6 +711,7 @@ LESS.js files during generation.
- [Jekyll::GitMetadata by Ivan Tse](https://github.com/ivantsepp/jekyll-git_metadata): Expose Git metadata for your templates. - [Jekyll::GitMetadata by Ivan Tse](https://github.com/ivantsepp/jekyll-git_metadata): Expose Git metadata for your templates.
- [Jekyll Http Basic Auth Plugin](https://gist.github.com/snrbrnjna/422a4b7e017192c284b3): Plugin to manage http basic auth for jekyll generated pages and directories. - [Jekyll Http Basic Auth Plugin](https://gist.github.com/snrbrnjna/422a4b7e017192c284b3): Plugin to manage http basic auth for jekyll generated pages and directories.
- [Jekyll Auto Image by Merlos](https://github.com/merlos/jekyll-auto-image): Gets the first image of a post. Useful to list your posts with images or to add [twitter cards](https://dev.twitter.com/cards/overview) to your site. - [Jekyll Auto Image by Merlos](https://github.com/merlos/jekyll-auto-image): Gets the first image of a post. Useful to list your posts with images or to add [twitter cards](https://dev.twitter.com/cards/overview) to your site.
- [Jekyll Portfolio Generator by Shannon Babincsak](https://github.com/codeinpink/jekyll-portfolio-generator): Generates project pages and computes related projects out of project data files.
#### Converters #### Converters
@ -744,7 +745,7 @@ LESS.js files during generation.
- [Smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics. - [Smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics.
- [Read in X Minutes](https://gist.github.com/zachleat/5792681) by [zachleat](https://github.com/zachleat): Estimates the reading time of a string (for blog post content). - [Read in X Minutes](https://gist.github.com/zachleat/5792681) by [zachleat](https://github.com/zachleat): Estimates the reading time of a string (for blog post content).
- [Jekyll-timeago](https://github.com/markets/jekyll-timeago): Converts a time value to the time ago in words. - [Jekyll-timeago](https://github.com/markets/jekyll-timeago): Converts a time value to the time ago in words.
- [pluralize](https://github.com/bdesham/pluralize): Easily combine a number and a word into a gramatically-correct amount like “1 minute” or “2 minute**s**”. - [pluralize](https://github.com/bdesham/pluralize): Easily combine a number and a word into a grammatically-correct amount like “1 minute” or “2 minute**s**”.
- [reading_time](https://github.com/bdesham/reading_time): Count words and estimate reading time for a piece of text, ignoring HTML elements that are unlikely to contain running text. - [reading_time](https://github.com/bdesham/reading_time): Count words and estimate reading time for a piece of text, ignoring HTML elements that are unlikely to contain running text.
- [Table of Content Generator](https://github.com/dafi/jekyll-toc-generator): Generate the HTML code containing a table of content (TOC), the TOC can be customized in many way, for example you can decide which pages can be without TOC. - [Table of Content Generator](https://github.com/dafi/jekyll-toc-generator): Generate the HTML code containing a table of content (TOC), the TOC can be customized in many way, for example you can decide which pages can be without TOC.
- [jekyll-humanize](https://github.com/23maverick23/jekyll-humanize): This is a port of the Django app humanize which adds a "human touch" to data. Each method represents a Fluid type filter that can be used in your Jekyll site templates. Given that Jekyll produces static sites, some of the original methods do not make logical sense to port (e.g. naturaltime). - [jekyll-humanize](https://github.com/23maverick23/jekyll-humanize): This is a port of the Django app humanize which adds a "human touch" to data. Each method represents a Fluid type filter that can be used in your Jekyll site templates. Given that Jekyll produces static sites, some of the original methods do not make logical sense to port (e.g. naturaltime).
@ -807,6 +808,7 @@ LESS.js files during generation.
- [twa](https://github.com/Ezmyrelda/twa): Twemoji Awesome plugin for Jekyll. Liquid tag allowing you to use twitter emoji in your jekyll pages. - [twa](https://github.com/Ezmyrelda/twa): Twemoji Awesome plugin for Jekyll. Liquid tag allowing you to use twitter emoji in your jekyll pages.
- [jekyll-files](https://github.com/x43x61x69/jekyll-files) by [Zhi-Wei Cai](http://vox.vg/): Output relative path strings and other info regarding specific assets. - [jekyll-files](https://github.com/x43x61x69/jekyll-files) by [Zhi-Wei Cai](http://vox.vg/): Output relative path strings and other info regarding specific assets.
- [Fetch remote file content](https://github.com/dimitri-koenig/jekyll-plugins) by [Dimitri König](https://www.dimitrikoenig.net/): Using `remote_file_content` tag you can fetch the content of a remote file and include it as if you would put the content right into your markdown file yourself. Very useful for including code from github repo's to always have a current repo version. - [Fetch remote file content](https://github.com/dimitri-koenig/jekyll-plugins) by [Dimitri König](https://www.dimitrikoenig.net/): Using `remote_file_content` tag you can fetch the content of a remote file and include it as if you would put the content right into your markdown file yourself. Very useful for including code from github repo's to always have a current repo version.
- [jekyll-asciinema](https://github.com/mnuessler/jekyll-asciinema): A tag for embedding asciicasts recorded with [asciinema](https://asciinema.org) in your Jekyll pages.
#### Collections #### Collections

View File

@ -45,4 +45,4 @@ A guide to implementing a tag cloud and per-tag content pages using 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/10/adding-ajax-pagination-to-jekyll.html)
- [Using Jekylls Data Files to build a dynamic navbar](http://www.jordanthornquest.com/blog/building-dynamic-navbars-with-jekyll/) - [Using Jekylls Data Files to build a dynamic navbar](http://blog.jordanthornquest.com/post/119506660470/building-dynamic-navbars-in-jekyll)

View File

@ -20,8 +20,6 @@ learning purposes.
([source](https://github.com/rsms/rsms.github.com)) ([source](https://github.com/rsms/rsms.github.com))
- [Scott Chacon](http://schacon.github.com) - [Scott Chacon](http://schacon.github.com)
([source](https://github.com/schacon/schacon.github.com)) ([source](https://github.com/schacon/schacon.github.com))
- [Ozon OS](http://ozonos.github.io)
([source](https://github.com/ozonos/ozonos.github.io))
If you would like to explore more examples, you can find a list of sites If you would like to explore more examples, you can find a list of sites
and their sources on the ["Sites" page in the Jekyll wiki][jekyll-sites]. and their sources on the ["Sites" page in the Jekyll wiki][jekyll-sites].

View File

@ -133,11 +133,12 @@ An overview of what each of these does:
<p> <p>
Well-formatted site data should be placed here. The jekyll engine Well-formatted site data should be placed here. The jekyll engine
will autoload all yaml files (ends with will autoload all YAML files in this directory (using either the
<code>.yml</code> or <code>.yaml</code>) in this directory. If <code>.yml</code>, <code>.yaml</code>, <code>.json</code> or
there's a file <code>members.yml</code> under the directory, <code>.csv</code> formats and extensions) and they will be
then you can access contents of the file accessible via `site.data`. If there's a file
through <code>site.data.members</code>. <code>members.yml</code> under the directory, then you can access
contents of the file through <code>site.data.members</code>.
</p> </p>
</td> </td>

View File

@ -125,7 +125,15 @@ following is a reference of the available data.
<td><p><code>site.html_pages</code></p></td> <td><p><code>site.html_pages</code></p></td>
<td><p> <td><p>
A list of all HTML Pages. A subset of `site.pages` listing those which end in `.html`.
</p></td>
</tr>
<tr>
<td><p><code>site.html_files</code></p></td>
<td><p>
A subset of `site.static_files` listing those which end in `.html`.
</p></td> </p></td>
</tr> </tr>

View File

@ -12,6 +12,8 @@ knowledge and lessons that have been unearthed by Windows users.
Julian Thilo has written up instructions to get Julian Thilo has written up instructions to get
[Jekyll running on Windows][windows-installation] and it seems to work for most. [Jekyll running on Windows][windows-installation] and it seems to work for most.
The instructions were written for Ruby 2.0.0, but should work for later versions
[prior to 2.2][hitimes-issue].
## Encoding ## Encoding
@ -28,6 +30,7 @@ $ chcp 65001
{% endhighlight %} {% endhighlight %}
[windows-installation]: http://jekyll-windows.juthilo.com/ [windows-installation]: http://jekyll-windows.juthilo.com/
[hitimes-issue]: https://github.com/copiousfreetime/hitimes/issues/40
## Auto-regeneration ## Auto-regeneration

View File

@ -0,0 +1 @@
custom_included

View File

@ -66,6 +66,9 @@ class TestConfiguration < JekyllUnitTest
"exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown", "exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown",
"include" => "STOP_THE_PRESSES.txt,.heloses, .git", "include" => "STOP_THE_PRESSES.txt,.heloses, .git",
"pygments" => true, "pygments" => true,
"plugins" => true,
"layouts" => true,
"data_source" => true,
}] }]
end end
should "unset 'auto' and 'watch'" do should "unset 'auto' and 'watch'" do
@ -93,6 +96,17 @@ class TestConfiguration < JekyllUnitTest
assert !@config.backwards_compatibilize.key?("pygments") assert !@config.backwards_compatibilize.key?("pygments")
assert_equal @config.backwards_compatibilize["highlighter"], "pygments" assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
end end
should "adjust directory names" do
assert @config.key?("plugins")
assert !@config.backwards_compatibilize.key?("plugins")
assert @config.backwards_compatibilize["plugins_dir"]
assert @config.key?("layouts")
assert !@config.backwards_compatibilize.key?("layouts")
assert @config.backwards_compatibilize["layouts_dir"]
assert @config.key?("data_source")
assert !@config.backwards_compatibilize.key?("data_source")
assert @config.backwards_compatibilize["data_dir"]
end
end end
context "#fix_common_issues" do context "#fix_common_issues" do
setup do setup do

View File

@ -28,6 +28,32 @@ class TestFrontMatterDefaults < JekyllUnitTest
end end
end end
context "A site with front matter type pages and an extension" do
setup do
@site = Site.new(Jekyll.configuration({
"source" => source_dir,
"destination" => dest_dir,
"defaults" => [{
"scope" => {
"path" => "index.html"
},
"values" => {
"key" => "val"
}
}]
}))
@site.process
@affected = @site.pages.find { |page| page.relative_path == "index.html" }
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
end
should "affect only the specified path" do
assert_equal @affected.data["key"], "val"
assert_equal @not_affected.data["key"], nil
end
end
context "A site with front matter defaults with no type" do context "A site with front matter defaults with no type" do
setup do setup do
@site = Site.new(Jekyll.configuration({ @site = Site.new(Jekyll.configuration({

View File

@ -0,0 +1,26 @@
require 'helper'
class TestLiquidRenderer < JekyllUnitTest
context "profiler" do
setup do
@site = Site.new(site_configuration)
@renderer = @site.liquid_renderer
end
should "return a table with profiling results" do
@site.process
output = @renderer.stats_table
expected = [
/^Filename\s+|\s+Count\s+|\s+Bytes\s+|\s+Time$/,
/^-+\++-+\++-+\++-+$/,
/^_posts\/2010-01-09-date-override\.markdown\s+|\s+\d+\s+|\s+\d+\.\d{2}K\s+|\s+\d+\.\d{3}$/,
]
expected.each do |regexp|
assert_match regexp, output
end
end
end
end

View File

@ -75,7 +75,7 @@ puts "Hello world"
end end
should "render fenced code blocks without syntax highlighting" do should "render fenced code blocks without syntax highlighting" do
assert_equal "<div class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\">puts &quot;Hello world&quot;\n</code></pre></div>", @markdown.convert( assert_equal "<figure class=\"highlight\"><pre><code class=\"language-ruby\" data-lang=\"ruby\">puts &quot;Hello world&quot;\n</code></pre></figure>", @markdown.convert(
<<-EOS <<-EOS
```ruby ```ruby
puts "Hello world" puts "Hello world"

View File

@ -49,7 +49,7 @@ class TestRegenerator < JekyllUnitTest
@regenerator = Regenerator.new(@site) @regenerator = Regenerator.new(@site)
# these should pass, since nothing has changed, and the # these should pass, since nothing has changed, and the
# loop above made sure the desinations exist # loop above made sure the designations exist
assert !@regenerator.regenerate?(@page) assert !@regenerator.regenerate?(@page)
assert !@regenerator.regenerate?(@post) assert !@regenerator.regenerate?(@post)
assert !@regenerator.regenerate?(@document) assert !@regenerator.regenerate?(@document)
@ -89,6 +89,41 @@ class TestRegenerator < JekyllUnitTest
end end
end end
context "The site regenerator" do
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
@site = fixture_site({
"full_rebuild" => false
})
@site.read
@post = @site.posts.first
@regenerator = @site.regenerator
@regenerator.regenerate?(@post)
@layout_path = source_dir("_layouts/default.html")
end
teardown do
File.rename(@layout_path + ".tmp", @layout_path)
end
should "handle deleted/nonexistent dependencies" do
assert_equal 1, @regenerator.metadata.size
path = @regenerator.metadata.keys[0]
assert File.exist?(@layout_path)
@regenerator.add_dependency(path, @layout_path)
File.rename(@layout_path, @layout_path + ".tmp")
refute File.exist?(@layout_path)
@regenerator.clear_cache
assert @regenerator.regenerate?(@post)
end
end
context "The site metadata" do context "The site metadata" do
setup do setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata")) FileUtils.rm_rf(source_dir(".jekyll-metadata"))

View File

@ -13,22 +13,22 @@ class TestSite < JekyllUnitTest
end end
should "have an array for plugins if passed as a string" do should "have an array for plugins if passed as a string" do
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => '/tmp/plugins'}))
assert_equal ['/tmp/plugins'], site.plugins assert_equal ['/tmp/plugins'], site.plugins
end end
should "have an array for plugins if passed as an array" do should "have an array for plugins if passed as an array" do
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => ['/tmp/plugins', '/tmp/otherplugins']})) site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => ['/tmp/plugins', '/tmp/otherplugins']}))
assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins
end end
should "have an empty array for plugins if nothing is passed" do should "have an empty array for plugins if nothing is passed" do
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => []})) site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => []}))
assert_equal [], site.plugins assert_equal [], site.plugins
end end
should "have an empty array for plugins if nil is passed" do should "have an empty array for plugins if nil is passed" do
site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => nil})) site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins_dir' => nil}))
assert_equal [], site.plugins assert_equal [], site.plugins
end end
@ -310,7 +310,7 @@ class TestSite < JekyllUnitTest
custom_processor = "CustomMarkdown" custom_processor = "CustomMarkdown"
s = Site.new(site_configuration('markdown' => custom_processor)) s = Site.new(site_configuration('markdown' => custom_processor))
assert !!s.process s.process
# Do some cleanup, we don't like straggling stuff's. # Do some cleanup, we don't like straggling stuff's.
Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown) Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown)
@ -459,6 +459,17 @@ class TestSite < JekyllUnitTest
end end
end end
context "with liquid profiling" do
setup do
@site = Site.new(site_configuration('profile' => true))
end
should "print profile table" do
@site.liquid_renderer.should_receive(:stats_table)
@site.process
end
end
context "incremental build" do context "incremental build" do
setup do setup do
@site = Site.new(site_configuration({ @site = Site.new(site_configuration({

View File

@ -18,6 +18,16 @@ class TestStaticFile < JekyllUnitTest
StaticFile.new(@site, base, dir, name) StaticFile.new(@site, base, dir, name)
end end
def setup_static_file_with_collection(base, dir, name, label, metadata)
site = fixture_site 'collections' => {label => metadata}
StaticFile.new(site, base, dir, name, site.collections[label])
end
def setup_static_file_with_defaults(base, dir, name, defaults)
site = fixture_site 'defaults' => defaults
StaticFile.new(site, base, dir, name)
end
context "A StaticFile" do context "A StaticFile" do
setup do setup do
clear_dest clear_dest
@ -46,7 +56,44 @@ class TestStaticFile < JekyllUnitTest
should "have a destination relative directory without a collection" do should "have a destination relative directory without a collection" do
static_file = setup_static_file("root", "dir/subdir", "file.html") static_file = setup_static_file("root", "dir/subdir", "file.html")
assert "dir/subdir", static_file.destination_rel_dir assert_equal nil, static_file.type
assert_equal "dir/subdir/file.html", static_file.url
assert_equal "dir/subdir", static_file.destination_rel_dir
end
should "have a destination relative directory with a collection" do
static_file = setup_static_file_with_collection(
"root", "_foo/dir/subdir", "file.html", "foo", {"output" => true})
assert_equal :foo, static_file.type
assert_equal "/foo/dir/subdir/file.html", static_file.url
assert_equal "/foo/dir/subdir", static_file.destination_rel_dir
end
should "use its collection's permalink template for the destination relative directory" do
static_file = setup_static_file_with_collection(
"root", "_foo/dir/subdir", "file.html", "foo",
{"output" => true, "permalink" => "/:path/"})
assert_equal :foo, static_file.type
assert_equal "/dir/subdir/file.html", static_file.url
assert_equal "/dir/subdir", static_file.destination_rel_dir
end
should "be writable by default" do
static_file = setup_static_file("root", "dir/subdir", "file.html")
assert(static_file.write?,
"static_file.write? should return true by default")
end
should "use the _config.yml defaults to determine writability" do
defaults = [{
"scope" => {"path" => "private"},
"values" => {"published" => false}
}]
static_file = setup_static_file_with_defaults(
"root", "private/dir/subdir", "file.html", defaults)
assert(!static_file.write?,
"static_file.write? should return false when _config.yml sets " +
"`published: false`")
end end
should "know its last modification time" do should "know its last modification time" do

View File

@ -114,9 +114,9 @@ CONTENT
assert_equal true, sanitized[:linenos] assert_equal true, sanitized[:linenos]
end end
should "allow hl_linenos" do should "allow hl_lines" do
sanitized = @tag.sanitized_opts({:hl_linenos => %w[1 2 3 4]}, true) sanitized = @tag.sanitized_opts({:hl_lines => %w[1 2 3 4]}, true)
assert_equal %w[1 2 3 4], sanitized[:hl_linenos] assert_equal %w[1 2 3 4], sanitized[:hl_lines]
end end
should "allow cssclass" do should "allow cssclass" do
@ -600,6 +600,23 @@ CONTENT
end end
end end
context "with custom includes directory" do
setup do
content = <<CONTENT
---
title: custom includes directory
---
{% include custom.html %}
CONTENT
create_post(content, {'includes_dir' => '_includes_custom', 'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
end
should "include file from custom directory" do
assert_match "custom_included", @result
end
end
context "without parameters within if statement" do context "without parameters within if statement" do
setup do setup do
content = <<CONTENT content = <<CONTENT