jekyll-3.1.6/ 0000775 0000000 0000000 00000000000 12717414063 0013020 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/.codeclimate.yml 0000664 0000000 0000000 00000001014 12717414063 0016066 0 ustar 00root root 0000000 0000000 engines:
rubocop: { enabled: true }
fixme: { enabled: false }
exclude_paths:
- .rubocop.yml
- .codeclimate.yml
- .travis.yml
- .gitignore
- .rspec
- Gemfile.lock
- CHANGELOG.{md,markdown,txt,textile}
- CONTRIBUTING.{md,markdown,txt,textile}
- readme.{md,markdown,txt,textile}
- README.{md,markdown,txt,textile}
- Readme.{md,markdown,txt,textile}
- ReadMe.{md,markdown,txt,textile}
- COPYING
- LICENSE
- site/**/*
- test/**/*
- vendor/**/*
- features/**/*
- script/**/*
- spec/**/*
ratings:
paths:
- lib/**/*.rb
jekyll-3.1.6/.gitignore 0000664 0000000 0000000 00000000345 12717414063 0015012 0 ustar 00root root 0000000 0000000 *.gem
*.swp
*~
.DS_Store
.analysis
.bundle/
.byebug_history
.jekyll-metadata
.ruby-gemset
.ruby-version
.sass-cache
/test/source/file_name.txt
/vendor
Gemfile.lock
_site/
bbin/
coverage
gh-pages/
pkg/
site/_site/
test/dest
tmp/*
jekyll-3.1.6/.jrubyrc 0000664 0000000 0000000 00000000075 12717414063 0014503 0 ustar 00root root 0000000 0000000 backtrace.mask=true
backtrace.color=true
backtrace.style=mri
jekyll-3.1.6/.rubocop.yml 0000664 0000000 0000000 00000005224 12717414063 0015275 0 ustar 00root root 0000000 0000000 Metrics/MethodLength: { Max: 24 }
Metrics/ClassLength: { Max: 240 }
Metrics/ModuleLength: { Max: 240 }
Metrics/LineLength: { Max: 112 }
Metrics/CyclomaticComplexity: { Max: 8 }
Metrics/PerceivedComplexity: { Max: 8 }
Metrics/ParameterLists: { Max: 4 }
Metrics/MethodLength: { Max: 24 }
Metrics/AbcSize: { Max: 20 }
Style/IndentHash: { EnforcedStyle: consistent }
Style/HashSyntax: { EnforcedStyle: hash_rockets }
Style/SignalException: { EnforcedStyle: only_raise }
Style/AlignParameters: { EnforcedStyle: with_fixed_indentation }
Style/StringLiteralsInInterpolation: { EnforcedStyle: double_quotes }
Style/MultilineMethodCallIndentation: { EnforcedStyle: indented }
Style/MultilineOperationIndentation: { EnforcedStyle: indented }
Style/FirstParameterIndentation: { EnforcedStyle: consistent }
Style/StringLiterals: { EnforcedStyle: double_quotes }
Style/RegexpLiteral: { EnforcedStyle: slashes }
Style/IndentArray: { EnforcedStyle: consistent }
Style/ExtraSpacing: { AllowForAlignment: true }
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%q': '{}'
'%Q': '{}'
'%r': '!!'
'%s': '()'
'%w': '()'
'%W': '()'
'%x': '()'
Style/AlignArray: { Enabled: false }
Style/StringLiterals: { Enabled: false }
Style/Documentation: { Enabled: false }
Style/DoubleNegation: { Enabled: false }
Style/UnneededCapitalW: { Enabled: false }
Style/EmptyLinesAroundModuleBody: { Enabled: false }
Style/EmptyLinesAroundAccessModifier: { Enabled: false }
Style/BracesAroundHashParameters: { Enabled: false }
Style/SpaceInsideBrackets: { Enabled: false }
Style/IfUnlessModifier: { Enabled: false }
Style/ModuleFunction: { Enabled: false }
Style/RescueModifier: { Enabled: false }
Style/GuardClause: { Enabled: false }
Style/FileName: { Enabled: false }
Lint/UselessAccessModifier: { Enabled: false }
Style/SpaceAroundOperators: { Enabled: false }
Style/RedundantReturn: { Enabled: false }
Style/SingleLineMethods: { Enabled: false }
AllCops:
TargetRubyVersion: 2.0
Include:
- lib/**/*.rb
Exclude:
- .rubocop.yml
- .codeclimate.yml
- .travis.yml
- .gitignore
- .rspec
- Gemfile.lock
- CHANGELOG.{md,markdown,txt,textile}
- CONTRIBUTING.{md,markdown,txt,textile}
- readme.{md,markdown,txt,textile}
- README.{md,markdown,txt,textile}
- Readme.{md,markdown,txt,textile}
- ReadMe.{md,markdown,txt,textile}
- COPYING
- LICENSE
- site/**/*
- test/**/*
- vendor/**/*
- features/**/*
- script/**/*
- spec/**/*
jekyll-3.1.6/.travis.yml 0000664 0000000 0000000 00000002124 12717414063 0015130 0 ustar 00root root 0000000 0000000 before_script: bundle update
bundler_args: --without benchmark:site:development
script: script/cibuild
cache: bundler
language: ruby
sudo: false
rvm:
- &ruby1 2.3.0
- &ruby2 2.2.4
- &ruby3 2.1.8
- &ruby4 2.0.0-p648
- &jruby jruby-9.0.4.0
- &rhead ruby-head
matrix:
fast_finish: true
allow_failures:
- rvm: *jruby
- rvm: *rhead
env:
matrix:
- TEST_SUITE=test
- TEST_SUITE=cucumber
notifications:
irc:
template: "%{repository}#%{build_number} (%{branch}) %{message} %{build_url}"
channels: irc.freenode.org#jekyll
email:
recipients:
- jordon@envygeeks.io
slack:
secure: "\
dNdKk6nahNURIUbO3ULhA09/vTEQjK0fNbgjVjeYPEvROHgQBP1cIP3AJy8aWs8rl5Yyow4Y\
GEilNRzKPz18AsFptVXofpwyqcBxaCfmHP809NX5PHBaadydveLm+TNVao2XeLXSWu+HUNAY\
O1AanCUbJSEyJTju347xCBGzESU=\
"
addons:
code_climate:
repo_token:
secure: "\
mAuvDu+nrzB8dOaLqsublDGt423mGRyZYM3vsrXh4Tf1sT+L1PxsRzU4gLmcV27HtX2Oq9\
DA4vsRURfABU0fIhwYkQuZqEcA3d8TL36BZcGEshG6MQ2AmnYsmFiTcxqV5bmlElHEqQuT\
5SUFXLafgZPBnL0qDwujQcHukID41sE=\
"
jekyll-3.1.6/CONDUCT.markdown 0000664 0000000 0000000 00000004522 12717414063 0015666 0 ustar 00root root 0000000 0000000 # 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, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
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 a project maintainer. All complaints
will be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. Maintainers are obligated to
maintain confidentiality with regard to the reporter of an incident.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
jekyll-3.1.6/CONTRIBUTING.markdown 0000664 0000000 0000000 00000010557 12717414063 0016503 0 ustar 00root root 0000000 0000000 Contribute
==========
So you've got an awesome idea to throw into Jekyll. Great! Please keep the
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
test will do. Please stay in the confines of the current test suite and use
[Shoulda](https://github.com/thoughtbot/shoulda/tree/master) and
[RSpec-Mocks](https://github.com/rspec/rspec-mocks).
* If it's a brand new feature, make sure to create a new
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
where appropriate. Also, whipping up some documentation in your fork's `site`
would be appreciated, and once merged it will be transferred over to the main
`site`, jekyllrb.com.
* If your contribution changes any Jekyll behavior, make sure to update the
documentation. It lives in `site/_docs`. If the docs are missing information,
please feel free to add it in. Great docs make a great project!
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
when modifying Ruby code.
* Please do your best to submit **small pull requests**. The easier the proposed
change is to review, the more likely it will be merged.
* When submitting a pull request, please make judicious use of the pull request
body. A description of what changes were made, the motivations behind the
changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
will also speed up review time.
Test Dependencies
-----------------
To run the test suite and build the gem you'll need to install Jekyll's
dependencies. Simply run this command to get all setup:
$ script/bootstrap
Before you start, run the tests and make sure that they pass (to confirm your
environment is configured properly):
$ script/cibuild
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
--------
Here's the most direct way to get your work merged into the project:
* Fork the project.
* 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` ).
* Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `script/cibuild`.
* If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up ( `git push origin my_awesome_feature` ).
* Create a pull request against jekyll/jekyll and describe what your change
does and the why you think it should be merged.
Updating Documentation
----------------------
We want the Jekyll documentation to be the best it can be. We've
open-sourced our docs and we welcome any pull requests if you find it
lacking.
You can find the documentation for jekyllrb.com in the
[site](https://github.com/jekyll/jekyll/tree/master/site) directory of
Jekyll's repo on GitHub.com.
All documentation pull requests should be directed at `master`. Pull
requests directed at another branch will not be accepted.
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.
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
-------
* Please do not bump the gem version in your pull requests.
* 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,
which is always a good thing.
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
actively read the issues and will label it once they come across it.
Finally...
----------
Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure
out, let us know so we can improve our process or documentation!
jekyll-3.1.6/Gemfile 0000664 0000000 0000000 00000003032 12717414063 0014311 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
gemspec :name => "jekyll"
gem "rake", "~> 10.1"
group :development do
gem "launchy", "~> 2.3"
gem "rubocop", "~> 0.40"
gem "pry"
unless RUBY_ENGINE == "jruby"
gem "pry-byebug"
end
end
#
group :test do
gem "cucumber", "~> 2.1"
gem "jekyll_test_plugin"
gem "jekyll_test_plugin_malicious"
gem "codeclimate-test-reporter"
gem "rspec-mocks"
gem "nokogiri"
gem "rspec"
end
#
group :test_legacy do
if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
gem 'test-unit'
end
gem "redgreen"
gem "simplecov"
gem "minitest-reporters"
gem "minitest-profile"
gem "minitest"
gem "shoulda"
end
#
group :benchmark do
if ENV["BENCHMARK"]
gem "ruby-prof"
gem "benchmark-ips"
gem "stackprof"
gem "rbtrace"
end
end
#
group :jekyll_optional_dependencies do
gem "toml", "~> 0.1.0"
gem "coderay", "~> 1.1.0"
gem "jekyll-docs", path: '../docs' if Dir.exist?('../docs') && ENV["JEKYLL_VERSION"]
gem "jekyll-gist", "~> 1.0"
gem "jekyll-feed", "~> 0.1.3"
gem "jekyll-coffeescript", "~> 1.0"
gem "jekyll-redirect-from", "~> 0.9.1"
gem "jekyll-paginate", "~> 1.0"
gem "mime-types", "~> 3.0"
gem "kramdown", "~> 1.9"
gem "rdoc", "~> 4.2"
platform :ruby, :mswin, :mingw do
gem "rdiscount", "~> 2.0"
gem "pygments.rb", "~> 0.6.0"
gem "redcarpet", "~> 3.2", ">= 3.2.3"
gem "classifier-reborn", "~> 2.0"
gem "liquid-c", "~> 3.0"
end
end
#
group :site do
if ENV["PROOF"]
gem "html-proofer", "~> 2.0"
end
gem "jemoji"
end
jekyll-3.1.6/History.markdown 0000664 0000000 0000000 00000271127 12717414063 0016237 0 ustar 00root root 0000000 0000000 ## 3.1.6 / 2016-05-19
### Bug Fixes
* Add ability to `jsonify` Drops such that, e.g. `site | jsonify`, works. (#4914)
## 3.1.5 / 2016-05-18
### Bug Fixes
* Sort the results of the `require_all` glob (affects Linux only). (#4912)
## 3.1.4 / 2016-05-18
### Bug Fixes
* Add `ExcerptDrop` and remove excerpt's ability to refer to itself in Liquid (#4907)
* Configuration permalink fix where `collections.posts.permalink` inherits properly from `permalink` only when it doesn't exist (#4910)
* Add `Configuration.from` to make it easier to build configs from just a hash
* Sorting `site.collections` in Liquid by label (#4910)
* Fix bug where `layout` in Liquid would inherit from previously-rendered layouts' metadatas (#4909)
* Fix bug where `layout` in Liquid would override in the wrong direction (more-specific layouts' data were overwritten by their parent layouts' data; this has now been reversed) (#4909)
## 3.1.2 / 2016-02-19
### Minor Enhancements
* Include `.rubocop.yml` in Gem (#4437)
* `LiquidRenderer#parse`: parse with line numbers. (#4452)
* Add consistency to the no-subcommand deprecation message (#4505)
### Bug Fixes
* Fix syntax highlighting in kramdown by making `@config` accessible in the Markdown converter. (#4428)
* `Jekyll.sanitized_path`: sanitizing a questionable path should handle tildes (#4492)
* Fix `titleize` so already capitalized words are not dropped (#4525)
* Permalinks which end in a slash should always output HTML (#4546)
### Development Fixes
* Require at least cucumber version 2.1.0 (#4514)
### Site Enhancements
* Add jekyll-toc plugin (#4429)
* Docs: Quickstart - added documentation about the `--force` option (#4410)
* Fix broken links to the Code of Conduct (#4436)
* Upgrade notes: mention trailing slash in permalink; fixes #4440 (#4455)
* Add hooks to the plugin categories toc (#4463)
* [add note] Jekyll 3 requires newer version of Ruby. (#4461)
* Fix typo in upgrading docs (#4473)
* Add note about upgrading documentation on jekyllrb.com/help/ (#4484)
* Update Rake link (#4496)
* Update & prune the short list of example sites (#4374)
* Added amp-jekyll plugin to plugins docs (#4517)
* A few grammar fixes (#4512)
* Correct a couple mistakes in structure.md (#4522)
## 3.1.1 / 2016-01-29
### Meta
* Update the Code of Conduct to the latest version (#4402)
### Bug Fixes
* `Page#dir`: ensure it ends in a slash (#4403)
* Add `Utils.merged_file_read_opts` to unify reading & strip the BOM (#4404)
* `Renderer#output_ext`: honor folders when looking for ext (#4401)
### Development Fixes
* Suppress stdout in liquid profiling test (#4409)
## 3.1.0 / 2016-01-23
### Minor Enhancements
* Use `Liquid::Drop`s instead of `Hash`es in `#to_liquid` (#4277)
* Add 'sample' Liquid filter Equivalent to Array#sample functionality (#4223)
* Cache parsed include file to save liquid parsing time. (#4120)
* Slightly speed up url sanitization and handle multiples of ///. (#4168)
* Print debug message when a document is skipped from reading (#4180)
* Include tag should accept multiple variables in the include name (#4183)
* Add `-o` option to serve command which opens server URL (#4144)
* Add CodeClimate platform for better code quality. (#4220)
* General improvements for WEBrick via jekyll serve such as SSL & custom headers (#4224, #4228)
* Add a default charset to content-type on webrick. (#4231)
* Switch `PluginManager` to use `require_with_graceful_fail` for better UX (#4233)
* Allow quoted date in front matter defaults (#4184)
* Add a Jekyll doctor warning for URLs that only differ by case (#3171)
* drops: create one base Drop class which can be set as mutable or not (#4285)
* drops: provide `#to_h` to allow for hash introspection (#4281)
* Shim subcommands with indication of gem possibly required so users know how to use them (#4254)
* Add smartify Liquid filter for SmartyPants (#4323)
* Raise error on empty permalink (#4361)
* Refactor Page#permalink method (#4389)
### Bug Fixes
* Pass build options into `clean` command (#4177)
* Allow users to use .htm and .xhtml (XHTML5.) (#4160)
* Prevent Shell Injection. (#4200)
* Convertible should make layout data accessible via `layout` instead of `page` (#4205)
* Avoid using `Dir.glob` with absolute path to allow special characters in the path (#4150)
* Handle empty config files (#4052)
* Rename `@options` so that it does not impact Liquid. (#4173)
* utils/drops: update Drop to support `Utils.deep_merge_hashes` (#4289)
* Make sure jekyll/drops/drop is loaded first. (#4292)
* Convertible/Page/Renderer: use payload hash accessor & setter syntax for backwards-compatibility (#4311)
* Drop: fix hash setter precendence (#4312)
* utils: `has_yaml_header?` should accept files with extraneous spaces (#4290)
* Escape html from site.title and page.title in site template (#4307)
* Allow custom file extensions if defined in `permalink` YAML front matter (#4314)
* Fix deep_merge_hashes! handling of drops and hashes (#4359)
* Page should respect output extension of its permalink (#4373)
* Disable auto-regeneration when running server detached (#4376)
* Drop#[]: only use public_send for keys in the content_methods array (#4388)
* Extract title from filename successfully when no date. (#4195)
### Development Fixes
* `jekyll-docs` should be easily release-able (#4152)
* Allow use of Cucumber 2.1 or greater (#4181)
* Modernize Kramdown for Markdown converter. (#4109)
* Change TestDoctorCommand to JekyllUnitTest... (#4263)
* Create namespaced rake tasks in separate `.rake` files under `lib/tasks` (#4282)
* markdown: refactor for greater readability & efficiency (#3771)
* Fix many Rubocop style errors (#4301)
* Fix spelling of "GitHub" in docs and history (#4322)
* Reorganize and cleanup the Gemfile, shorten required depends. (#4318)
* Remove script/rebund. (#4341)
* Implement codeclimate platform (#4340)
* Remove ObectSpace dumping and start using inherited, it's faster. (#4342)
* Add script/travis so all people can play with Travis-CI images. (#4338)
* Move Cucumber to using RSpec-Expections and furthering JRuby support. (#4343)
* Rearrange Cucumber and add some flair. (#4347)
* Remove old FIXME (#4349)
* Clean up the Gemfile (and keep all the necessary dependencies) (#4350)
### Site Enhancements
* Add three plugins to directory (#4163)
* Add upgrading docs from 2.x to 3.x (#4157)
* Add `protect_email` to the plugins index. (#4169)
* Add `jekyll-deploy` to list of third-party plugins (#4179)
* Clarify plugin docs (#4154)
* Add Kickster to deployment methods in documentation (#4190)
* Add DavidBurela's tutorial for Windows to Windows docs page (#4210)
* Change GitHub code block to highlight tag to avoid it overlaps parent div (#4121)
* Update FormKeep link to be something more specific to Jekyll (#4243)
* Remove example Roger Chapman site, as the domain doesn't exist (#4249)
* Added configuration options for `draft_posts` to configuration docs (#4251)
* Fix checklist in `_assets.md` (#4259)
* Add Markdown examples to Pages docs (#4275)
* Add jekyll-paginate-category to list of third-party plugins (#4273)
* Add `jekyll-responsive_image` to list of third-party plugins (#4286)
* Add `jekyll-commonmark` to list of third-party plugins (#4299)
* Add documentation for incremental regeneration (#4293)
* Add note about removal of relative permalink support in upgrading docs (#4303)
* Add Pro Tip to use front matter variable to create clean URLs (#4296)
* Fix grammar in the documentation for posts. (#4330)
* Add documentation for smartify Liquid filter (#4333)
* Fixed broken link to blog on using mathjax with jekyll (#4344)
* Documentation: correct reference in Precedence section of Configuration docs (#4355)
* Add @jmcglone's guide to github-pages doc page (#4364)
* Added the Wordpress2Jekyll Wordpress plugin (#4377)
* Add Contentful Extension to list of third-party plugins (#4390)
* Correct Minor spelling error (#4394)
## 3.0.3 / 2016-02-08
### Bug Fixes
* Fix extension weirdness with folders (#4493)
* EntryFilter: only include 'excluded' log on excluded files (#4479)
* `Jekyll.sanitized_path`: escape tildes before sanitizing a questionable path (#4468)
* `LiquidRenderer#parse`: parse with line numbers (#4453)
* `Document#<=>`: protect against nil comparison in dates. (#4446)
## 3.0.2 / 2016-01-20
### Bug Fixes
* Document: throw a useful error when an invalid date is given (#4378)
## 3.0.1 / 2015-11-17
### Bug Fixes
* Document: only superdirectories of the collection are categories (#4110)
* `Convertible#render_liquid` should use `render!` to cause failure on bad Liquid (#4077)
* Don't generate `.jekyll-metadata` in non-incremental build (#4079)
* Set `highlighter` config val to `kramdown.syntax_highlighter` (#4090)
* Align hooks implementation with documentation (#4104)
* Fix the deprecation warning in the doctor command (#4114)
* Fix case in `:title` and add `:slug` which is downcased (#4100)
### Development Fixes
* Fix test warnings when doing rake {test,spec} or script/test (#4078)
### Site Enhancements
* Update normalize.css to v3.0.3. (#4085)
* Update Font Awesome to v4.4.0. (#4086)
* Adds a note about installing the jekyll-gist gem to make gist tag work (#4101)
* Align hooks documentation with implementation (#4104)
* Add Jekyll Flickr Plugin to the list of third party plugins (#4111)
* Remove link to now-deleted blog post (#4125)
* Update the liquid syntax in the pagination docs (#4130)
* Add jekyll-language-plugin to plugins.md (#4134)
* Updated to reflect feedback in #4129 (#4137)
* Clarify assets.md based on feedback of #4129 (#4142)
* Re-correct the liquid syntax in the pagination docs (#4140)
## 3.0.0 / 2015-10-26
### Major Enhancements
* Liquid profiler (i.e. know how fast or slow your templates render) (#3762)
* Incremental regeneration (#3116)
* Add Hooks: a new kind of plugin (#3553)
* Upgrade to Liquid 3.0.0 (#3002)
* `site.posts` is now a Collection instead of an Array (#4055)
* Add basic support for JRuby (commit: 0f4477)
* Drop support for Ruby 1.9.3. (#3235)
* Support Ruby v2.2 (#3234)
* Support RDiscount 2 (#2767)
* Remove most runtime deps (#3323)
* Move to Rouge as default highlighter (#3323)
* Mimic GitHub Pages `.html` extension stripping behavior in WEBrick (#3452)
* Always include file extension on output files (#3490)
* Improved permalinks for pages and collections (#3538)
* Sunset (i.e. remove) Maruku (#3655)
* Remove support for relative permalinks (#3679)
* 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)
* Added permalink time variables (#3990)
* Add `--incremental` flag to enable incremental regen (disabled by default) (#4059)
### Minor Enhancements
* Deprecate access to Document#data properties and Collection#docs methods (#4058)
* Sort static files just once, and call `site_payload` once for all collections (#3204)
* Separate `jekyll docs` and optimize external gem handling (#3241)
* Improve `Site#getConverterImpl` and call it `Site#find_converter_instance` (#3240)
* Use relative path for `path` Liquid variable in Documents for consistency (#2908)
* Generalize `Utils#slugify` for any scripts (#3047)
* Added basic microdata to post template in site template (#3189)
* Store log messages in an array of messages. (#3244)
* Allow collection documents to override `output` property in front matter (#3172)
* Keep file modification times between builds for static files (#3220)
* Only downcase mixed-case categories for the URL (#2571)
* Added per post `excerpt_separator` functionality (#3274)
* Allow collections YAML to end with three dots (#3134)
* Add mode parameter to `slugify` Liquid filter (#2918)
* Perf: `Markdown#matches` should avoid regexp (#3321)
* Perf: Use frozen regular expressions for `Utils#slugify` (#3321)
* Split off Textile support into jekyll-textile-converter (#3319)
* Improve the navigation menu alignment in the site template on small screens (#3331)
* Show the regeneration time after the initial generation (#3378)
* Site template: Switch default font to Helvetica Neue (#3376)
* Make the `include` tag a teensy bit faster. (#3391)
* Add `pkill -f jekyll` to ways to kill. (#3397)
* Site template: collapsed, variable-driven font declaration (#3360)
* Site template: Don't always show the scrollbar in code blocks (#3419)
* Site template: Remove undefined `text` class from `p` element (#3440)
* Site template: Optimize text rendering for legibility (#3382)
* Add `draft?` method to identify if Post is a Draft & expose to Liquid (#3456)
* Write regeneration metadata even on full rebuild (#3464)
* Perf: Use `String#end_with?("/")` instead of regexp when checking paths (#3516)
* Docs: document 'ordinal' built-in permalink style (#3532)
* Upgrade liquid-c to 3.x (#3531)
* Use consistent syntax for deprecation warning (#3535)
* Added build --destination and --source flags (#3418)
* Site template: remove unused `page.meta` attribute (#3537)
* Improve the error message when sorting null objects (#3520)
* Added liquid-md5 plugin (#3598)
* Documentation: RR replaced with RSpec Mocks (#3600)
* Documentation: Fix subpath. (#3599)
* Create 'tmp' dir for test_tags if it doesn't exist (#3609)
* Extract reading of data from `Site` to reduce responsibilities. (#3545)
* Removed the word 'Jekyll' a few times from the comments (#3617)
* `bin/jekyll`: with no args, exit with exit code 1 (#3619)
* Incremental build if destination file missing (#3614)
* Static files `mtime` liquid should return a `Time` obj (#3596)
* Use `Jekyll::Post`s for both LSI indexing and lookup. (#3629)
* Add `charset=utf-8` for HTML and XML pages in WEBrick (#3649)
* Set log level to debug when verbose flag is set (#3665)
* Added a mention on the Gemfile to complete the instructions (#3671)
* Perf: Cache `Document#to_liquid` and invalidate where necessary (#3693)
* Perf: `Jekyll::Cleaner#existing_files`: Call `keep_file_regex` and `keep_dirs` only once, not once per iteration (#3696)
* Omit jekyll/jekyll-help from list of resources. (#3698)
* Add basic `jekyll doctor` test to detect fsnotify (OSX) anomalies. (#3704)
* Added talk.jekyllrb.com to "Have questions?" (#3694)
* Performance: Sort files only once (#3707)
* 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)
* Update MIME types from mime-db (#3933)
* Add header to site template `_config.yml` for clarity & direction (#3997)
* Site template: add timezone offset to post date frontmatter (#4001)
* Make a constant for the regex to find hidden files (#4032)
* Site template: refactor github & twitter icons into includes (#4049)
* Site template: add background to Kramdown Rouge-ified backtick code blocks (#4053)
### Bug Fixes
* `post_url`: fix access deprecation warning & fix deprecation msg (#4060)
* Perform jekyll-paginate deprecation warning correctly. (#3580)
* Make permalink parsing consistent with pages (#3014)
* `time()`pre-filter method should accept a `Date` object (#3299)
* Remove unneeded end tag for `link` in site template (#3236)
* Kramdown: Use `enable_coderay` key instead of `use_coderay` (#3237)
* Unescape `Document` output path (#2924)
* Fix nav items alignment when on multiple rows (#3264)
* Highlight: Only Strip Newlines/Carriage Returns, not Spaces (#3278)
* Find variables in front matter defaults by searching with relative file path. (#2774)
* Allow variables (e.g `:categories`) in YAML front matter permalinks (#3320)
* Handle nil URL placeholders in permalinks (#3325)
* Template: Fix nav items alignment when in "burger" mode (#3329)
* Template: Remove `!important` from nav SCSS introduced in #3329 (#3375)
* The `:title` URL placeholder for collections should be the filename slug. (#3383)
* Trim the generate time diff to just 3 places past the decimal place (#3415)
* The highlight tag should only clip the newlines before and after the *entire* block, not in between (#3401)
* highlight: fix problem with linenos and rouge. (#3436)
* `Site#read_data_file`: read CSV's with proper file encoding (#3455)
* Ignore `.jekyll-metadata` in site template (#3496)
* Template: Point documentation link to the documentation pages (#3502)
* Removed the trailing slash from the example `/blog` baseurl comment (#3485)
* Clear the regenerator cache every time we process (#3592)
* Readd (bring back) minitest-profile (#3628)
* Add WOFF2 font MIME type to Jekyll server MIME types (#3647)
* Be smarter about extracting the extname in `StaticFile` (#3632)
* Process metadata for all dependencies (#3608)
* Show error message if the YAML front matter on a page/post is invalid. (#3643)
* Upgrade redcarpet to 3.2 (Security fix: OSVDB-120415) (#3652)
* Create #mock_expects that goes directly to RSpec Mocks. (#3658)
* 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)
* filters: `where` should compare stringified versions of input & comparator (#3935)
* Read build options for `jekyll clean` command (#3828)
* Fix #3970: Use Gem::Version to compare versions, not `>`.
* Abort if no subcommand. Fixes confusing message. (#3992)
* Whole-post excerpts should match the post content (#4004)
* Change default font weight to 400 to fix bold/strong text issues (#4050)
* Document: Only auto-generate the excerpt if it's not overridden (#4062)
* Utils: `deep_merge_hashes` should also merge `default_proc` (45f69bb)
* Defaults: compare paths in `applies_path?` as `String`s to avoid confusion (7b81f00)
### Development Fixes
* Remove loader.rb and "modernize" `script/test`. (#3574)
* Improve the grammar in the documentation (#3233)
* Update the LICENSE text to match the MIT license exactly (#3253)
* Update rake task `site:publish` to fix minor bugs. (#3254)
* Switch to shields.io for the README badges. (#3255)
* Use `FileList` instead of `Dir.glob` in `site:publish` rake task (#3261)
* Fix test script to be platform-independent (#3279)
* Instead of symlinking `/tmp`, create and symlink a local `tmp` in the tests (#3258)
* Fix some spacing (#3312)
* Fix comment typo in `lib/jekyll/frontmatter_defaults.rb` (#3322)
* Move all `regenerate?` checking to `Regenerator` (#3326)
* Factor out a `read_data_file` call to keep things clean (#3380)
* Proof the site with CircleCI. (#3427)
* Update LICENSE to 2015. (#3477)
* Upgrade tests to use Minitest (#3492)
* Remove trailing whitespace (#3497)
* Use `fixture_site` for Document tests (#3511)
* Remove adapters deprecation warning (#3529)
* Minor fixes to `url.rb` to follow GitHub style guide (#3544)
* Minor changes to resolve deprecation warnings (#3547)
* Convert remaining textile test documents to markdown (#3528)
* Migrate the tests to use rspec-mocks (#3552)
* Remove `activesupport` (#3612)
* Added tests for `Jekyll:StaticFile` (#3633)
* Force minitest version to 5.5.1 (#3657)
* Update the way cucumber accesses Minitest assertions (#3678)
* 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)
* Add script to vendor mime types (#3933)
* Ignore .bundle dir in SimpleCov (#4033)
### Site Enhancements
* Add 'info' labels to certain notes in collections docs (#3601)
* Remove extra spaces, make the last sentence less awkward in permalink docs (#3603)
* Update the permalinks documentation to reflect the updates for 3.0 (#3556)
* Add blog post announcing Jekyll Help (#3523)
* Add Jekyll Talk to Help page on site (#3518)
* Change Ajax pagination resource link to use HTTPS (#3570)
* Fixing the default host on docs (#3229)
* Add `jekyll-thumbnail-filter` to list of third-party plugins (#2790)
* Add link to 'Adding Ajax pagination to Jekyll' to Resources page (#3186)
* Add a Resources link to tutorial on building dynamic navbars (#3185)
* Semantic structure improvements to the post and page layouts (#3251)
* Add new AsciiDoc plugin to list of third-party plugins. (#3277)
* Specify that all transformable collection documents must contain YAML front matter (#3271)
* Assorted accessibility fixes (#3256)
* Update configuration docs to mention `keep_files` for `destination` (#3288, #3296)
* Break when we successfully generate nav link to save CPU cycles. (#3291)
* Update usage docs to mention `keep_files` and a warning about `destination` cleaning (#3295)
* Add logic to automatically generate the `next_section` and `prev_section` navigation items (#3292)
* Some small fixes for the Plugins TOC. (#3306)
* Added versioning comment to configuration file (#3314)
* Add `jekyll-minifier` to list of third-party plugins (#3333)
* Add blog post about the Jekyll meet-up (#3332)
* Use `highlight` Liquid tag instead of the four-space tabs for code (#3336)
* 3.0.0.beta1 release post (#3346)
* Add `twa` to the list of third-party plugins (#3384)
* Remove extra spaces (#3388)
* Fix small grammar errors on a couple pages (#3396)
* Fix typo on Templates docs page (#3420)
* s/three/four for plugin type list (#3424)
* Release jekyllrb.com as a locally-compiled site. (#3426)
* Add a jekyllrb.com/help page which elucidates places from which to get help (#3428)
* Remove extraneous dash on Plugins doc page which caused a formatting error (#3431)
* Fix broken link to Jordan Thornquest's website. (#3438)
* Change the link to an extension (#3457)
* Fix Twitter link on the help page (#3466)
* Fix wording in code snippet highlighting section (#3475)
* Add a `/` to `paginate_path` in the Pagination documentation (#3479)
* Add a link on all the docs pages to "Improve this page". (#3510)
* Add jekyll-auto-image generator to the list of third-party plugins (#3489)
* Replace link to the proposed `picture` element spec (#3530)
* Add frontmatter date formatting information (#3469)
* Improve consistency and clarity of plugins options note (#3546)
* Add permalink warning to pagination docs (#3551)
* Fix grammar in Collections docs API stability warning (#3560)
* Restructure `excerpt_separator` documentation for clarity (#3550)
* Fix accidental line break in collections docs (#3585)
* Add information about the `.jekyll-metadata` file (#3597)
* Document addition of variable parameters to an include (#3581)
* Add `jekyll-files` to the list of third-party plugins. (#3586)
* Define the `install` step in the CI example `.travis.yml` (#3622)
* Expand collections documentation. (#3638)
* Add the "warning" note label to excluding `vendor` in the CI docs page (#3623)
* Upgrade pieces of the Ugrading guide for Jekyll 3 (#3607)
* Showing how to access specific data items (#3468)
* Clarify pagination works from within HTML files (#3467)
* Add note to `excerpt_separator` documentation that it can be set globally (#3667)
* Fix some names on Troubleshooting page (#3683)
* 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)
* Add `jekyll-youtube` to the list of third-party plugins (#3931)
* Add Views Router plugin (#3950)
* Update install docs (Core dependencies, Windows reqs, etc) (#3769)
* Use Jekyll Feed for jekyllrb.com (#3736)
* Add jekyll-umlauts to plugins.md ($3966)
* Troubleshooting: fix broken link, add other mac-specific info (#3968)
* Add a new site for learning purposes (#3917)
* Added documentation for Jekyll environment variables (#3989)
* Fix broken configuration documentation page (#3994)
* Add troubleshooting docs for installing on El Capitan (#3999)
* Add Lazy Tweet Embedding to the list of third-party plugins (#4015)
* Add installation instructions for 2 of 3 options for plugins (#4013)
* Add alternative jekyll gem installation instructions (#4018)
* Fix a few typos and formatting problems. (#4022)
* Fix pretty permalink example (#4029)
* Note that `_config.yml` is not reloaded during regeneration (#4034)
* Apply code block figure syntax to blocks in CONTRIBUTING (#4046)
* Add jekyll-smartify to the list of third-party plugins (#3572)
## 2.5.3 / 2014-12-22
### Bug Fixes
* When checking a Markdown extname, include position of the `.` (#3147)
* Fix `jsonify` Liquid filter handling of boolean values (#3154)
* Add comma to value of `viewport` meta tag (#3170)
* Set the link type for the RSS feed to `application/rss+xml` (#3176)
* Refactor `#as_liquid` (#3158)
### Development Fixes
* Exclude built-in bundles from being added to coverage report (#3180)
### Site Enhancements
* Add `@alfredxing` to the `@jekyll/core` team. :tada: (#3218)
* Document the `-q` option for the `build` and `serve` commands (#3149)
* Fix some minor typos/flow fixes in documentation website content (#3165)
* Add `keep_files` to configuration documentation (#3162)
* Repeat warning about cleaning of the `destination` directory (#3161)
* Add jekyll-500px-embed to list of third-party plugins (#3163)
* Simplified platform detection in Gemfile example for Windows (#3177)
* Add the `jekyll-jalali` plugin added to the list of third-party plugins. (#3198)
* Add Table of Contents to Troubleshooting page (#3196)
* Add `inline_highlight` plugin to list of third-party plugins (#3212)
* Add `jekyll-mermaid` plugin to list of third-party plugins (#3222)
## 2.5.2 / 2014-11-17
### Minor Enhancements
* `post_url` should match `post.name` instead of slugs and dates (#3058)
### Bug Fixes
* Fix bundle require for `:jekyll_plugins` (#3119)
* Remove duplicate regexp phrase: `^\A` (#3089)
* Remove duplicate `Conversion error:` message in `Convertible` (#3088)
* Print full conversion error message in `Renderer#convert` (#3090)
### Site Enhancements
* Change variable names in Google Analytics script (#3093)
* Mention CSV files in the docs for data files (#3101)
* Add trailing slash to `paginate_path` example. (#3091)
* Get rid of noifniof (`excerpt_separator`) (#3094)
* Sass improvements, around nesting mostly. (#3123)
* Add webmentions.io plugin to the list of third-party plugins (#3127)
* Add Sass mixins and use them. (#2904)
* Slightly compress jekyll-sticker.jpg. (#3133)
* Update gridism and separate out related but custom styles. (#3132)
* Add remote-include plugin to list of third-party plugins (#3136)
## 2.5.1 / 2014-11-09
### Bug Fixes
* Fix path sanitation bug related to Windows drive names (#3077)
### Development Fixes
* Add development time dependencies on minitest and test-unit to gemspec for cygwin (#3064)
* Use Travis's built-in caching. (#3075)
## 2.5.0 / 2014-11-06
### Minor Enhancements
* Require gems in `:jekyll_plugins` Gemfile group unless `JEKYLL_NO_BUNDLER_REQUIRE` is specified in the environment. (#2865)
* Centralize path sanitation in the `Site` object (#2882)
* Allow placeholders in permalinks (#3031)
* Allow users to specify the log level via `JEKYLL_LOG_LEVEL`. (#3067)
* Fancy Indexing with WEBrick (#3018)
* Allow Enumerables to be used with `where` filter. (#2986)
* Meta descriptions in the site template now use `page.excerpt` if it's available (#2964)
* Change indentation in `head.html` of site template to 2 spaces from 4 (#2973)
* Use a `$content-width` variable instead of a fixed value in the site template CSS (#2972)
* Strip newlines in site template `` description. (#2982)
* Add link to atom feed in `head` of site template files (#2996)
* Performance optimizations (#2994)
* Use `Hash#each_key` instead of `Hash#keys.each` to speed up iteration over hash keys. (#3017)
* Further minor performance enhancements. (#3022)
* Add 'b' and 's' aliases for build and serve, respectively (#3065)
### Bug Fixes
* Fix Rouge's RedCarpet plugin interface integration (#2951)
* Remove `--watch` from the site template blog post since it defaults to watching in in 2.4.0 (#2922)
* Fix code for media query mixin in site template (#2946)
* Allow post URL's to have `.htm` extensions (#2925)
* `Utils.slugify`: Don't create new objects when gsubbing (#2997)
* The jsonify filter should deep-convert to Liquid when given an Array. (#3032)
* Apply `jsonify` filter to Hashes deeply and effectively (#3063)
* Use `127.0.0.1` as default host instead of `0.0.0.0` (#3053)
* In the case that a Gemfile does not exist, ensure Jekyll doesn't fail on requiring the Gemfile group (#3066)
### Development Fixes
* Fix a typo in the doc block for `Jekyll::URL.escape_path` (#3052)
* Add integration test for `jekyll new --blank` in TestUnit (#2913)
* Add unit test for `jekyll new --force` logic (#2929)
* Update outdated comment for `Convertible#transform` (#2957)
* Add Hakiri badge to README. (#2953)
* Add some simple benchmarking tools. (#2993)
### Site Enhancements
* `NOKOGIRI_USE_SYSTEM_LIBRARIES=true` **decreases** installation time. (#3040)
* Add FormKeep to resources as Jekyll form backend (#3010)
* Fixing a mistake in the name of the new Liquid tag (#2969)
* Update Font Awesome to v4.2.0. (#2898)
* Fix link to #2895 in 2.4.0 release post. (#2899)
* Add Big Footnotes for Kramdown plugin to list of third-party plugins (#2916)
* Remove warning regarding GHP use of singular types for front matter defaults (#2919)
* Fix quote character typo in site documentation for templates (#2917)
* Point Liquid links to Liquid’s GitHub wiki (#2887)
* Add HTTP Basic Auth (.htaccess) plugin to list of third-party plugins (#2931)
* (Minor) Grammar & `_config.yml` filename fixes (#2911)
* Added `mathml.rb` to the list of third-party plugins. (#2937)
* Add `--force_polling` to the list of configuration options (#2943)
* Escape unicode characters in site CSS (#2906)
* Add note about using the github-pages gem via pages.github.com/versions.json (#2939)
* Update usage documentation to reflect 2.4 auto-enabling of `--watch`. (#2954)
* Add `--skip-initial-build` to configuration docs (#2949)
* Fix a minor typo in Templates docs page (#2959)
* Add a ditaa-ditaa plugin under Other section on the Plugins page (#2967)
* Add `build/serve -V` option to configuration documentation (#2948)
* Add 'Jekyll Twitter Plugin' to list of third-party plugins (#2979)
* Docs: Update normalize.css to v3.0.2. (#2981)
* Fix typo in Continuous Integration documentation (#2984)
* Clarify behavior of `:categories` in permalinks (#3011)
## 2.4.0 / 2014-09-09
### Minor Enhancements
* Support a new `relative_include` tag (#2870)
* Auto-enable watch on 'serve' (#2858)
* Render Liquid in CoffeeScript files (#2830)
* Array Liquid filters: `push`, `pop`, `unshift`, `shift` (#2895)
* Add `:title` to collection URL template fillers (#2864)
* Add support for CSV files in the `_data` directory (#2761)
* Add the `name` variable to collection permalinks (#2799)
* Add `inspect` liquid filter. (#2867)
* Add a `slugify` Liquid filter (#2880)
### Bug Fixes
* Use `Jekyll.sanitized_path` when adding static files to Collections (#2849)
* Fix encoding of `main.scss` in site template (#2771)
* Fix orientation bugs in default site template (#2862)
### Development Fixes
* Update simplecov gem to 0.9 (#2748)
* Remove `docs/` dir (#2768)
* add class `<< self` idiom to `New` command (#2817)
* Allow Travis to 'parallelize' our tests (#2859)
* Fix test for Liquid rendering in Sass (#2856)
* Fixing "vertycal" typo in site template's `_base.scss` (#2889)
### Site Enhancements
* Document the `name` variable for collection permalinks (#2829)
* Adds info about installing jekyll in current dir (#2839)
* Remove deprecated `jekyll-projectlist` plugin from list of third-party plugins (#2742)
* Remove tag plugins that are built in to Jekyll (#2751)
* Add `markdown-writer` package for Atom Editor to list of third-party plugins (#2763)
* Fix typo in site documentation for collections (#2764)
* Fix minor typo on plugins docs page (#2765)
* Replace markdown with HTML in `sass_dir` note on assets page (#2791)
* Fixed "bellow" typo in datafiles docs (#2879)
* Fix code/markdown issue in documentation for variables (#2877)
* Remove Good Include third-party plugin from plugins page (#2881)
* Add some more docs on `include_relative` (#2884)
## 2.3.0 / 2014-08-10
### Minor Enhancements
* Allow Convertibles to be converted by >= 1 converters (#2704)
* Allow Sass files to be rendered in Liquid, but never place them in layouts. (#2733)
* Add `jekyll help` command (#2707)
* Use `.scss` for `site_template` styles. (#2667)
* Don't require the `scope` key in front matter defaults (#2659)
* No longer set `permalink: pretty` in the `_config.yml` for the site template (#2680)
* Rework site template to utilize Sass (#2687)
* Notify the user when auto-regeneration is disabled. (#2696)
* Allow partial variables in include tag filename argument (#2693)
* Move instances of `Time.parse` into a Utils method (#2682)
* Ignore subfolders in the `_posts` folder (#2705) REVERTS (#2633)
* Front Matter default types should always be pluralized (#2732)
* Read in static files into `collection.files` as `StaticFile`s (#2737)
* Add `sassify` and `scssify` Liquid filters (#2739)
* Replace `classifier` gem with `classifier-reborn` (#2721)
### Bug Fixes
* Use only the last extname when multiple converters exist (#2722)
* Call `#to_liquid` before calling `#to_json` in jsonify filter (#2729)
* Use non padded config in `strftime` to avoid parse string twice (#2673)
* Replace deprecated Ruby methods with undeprecated ones (#2664)
* Catch errors when parsing Post `date` front matter value & produce nice error message (#2649)
* Allow static files in Collections (#2615)
* Fixed typo in `Deprecator#gracefully_require` error message (#2694)
* Remove preemptive loading of the 'classifier' gem. (#2697)
* Use case-insensitive checking for the file extensions when loading config files (#2718)
* When Reading Documents, Respect `encoding` Option (#2720)
* Refactor based on jekyll-watch clean-up. (#2716)
* `Document#to_s` should produce just the content of the document (#2731)
### Development Fixes
* Only include lib files in the gem (#2671)
* Fix `git diff` command in `proof` script (#2672)
* Make default rake task a multitask so tests run in parallel (#2735)
### Site Enhancements
* Use Sass and a Docs Collection (#2651)
* Add `latest_version.txt` file to the site (#2740)
* Be more ambiguous about `page.content`. But more transparent. (#2522)
* Streamlining front matter wording (instead of front-matter/frontmatter) (#2674)
* Add note that source directory cannot be modified in GitHub Pages (#2669)
* Fix links from #2669 to be actual HTML. Whoops. (#2679)
* Add link to `jekyll-slim` in list of third-party plugins (#2689)
* Add Barry Clark's Smashing Magazine tutorial to resources page (#2688)
* Reorganize and update default configuration settings (#2456)
* Fixing indentation in the configuration docs about Redcarpet exts (#2717)
* Use `null` in YAML instead of `nil` in default config list (#2719)
* Fix typo in Continuous Integration docs (#2708)
## 2.2.0 / 2014-07-29
### Minor Enhancements
* Throw a warning if the specified layout does not exist (#2620)
* Whitelist Pygments options in safe mode (#2642)
### Bug Fixes
* Remove unnecessary `Jekyll::Tags::IncludeTag#blank?` method (#2625)
* Categories in the path are ignored (#2633)
### Development Fixes
* Refactoring Errors & Requires of Third-Party stuff (#2591)
* Add further tests for categories (#2584)
* Proof site with html-proofer on change (#2605)
* Fix up bug in #2605 which caused proofing the site not to function (#2608)
* Use `bundle exec` in `script/proof` (#2610)
### Site Enhancements
* Update Kramdown urls (#2588)
* Add `Jekyll::AutolinkEmail` and `Jekyll::GitMetadata` to the list of third-party plugins (#2596)
* Fix a bunch of broken links in the site (#2601)
* Replace dead links with working links (#2611)
* Add jekyll-hook to deployment methods (#2617)
* Added kramdown-with-pygments plugin to the list of third-party plugins (#2623)
* Update outdated "Extras" page and remove duplicate documentation (#2622)
* Add co2 plugin to list of third-party plugins (#2639)
* Attempt to clarify the way Sass imports happen (#2642)
## 2.1.1 / 2014-07-01
### Bug Fixes
* Patch read vulnerabilities for data & confirm none for layouts (#2563)
* Update Maruku dependency to allow use of the latest version (#2576)
* Remove conditional assignment from document URL to prevent stale urls (#2575)
### Site Enhancements
* Add vertical margin to `highlight` to separate code blocks (#2558)
* Add `html_pages` to Variables docs (#2567)
* Fixed broken link to Permalinks page (#2572)
* Update link to Windows installation guide (#2578)
## 2.1.0 / 2014-06-28
### Minor Enhancements
* Bump to the latest Liquid version, 2.6.1 (#2495)
* Add support for JSON files in the `_data` directory (#2369)
* Allow subclasses to override `EXCERPT_ATTRIBUTES_FOR_LIQUID` (#2408)
* Add `Jekyll.env` and `jekyll.environment` (the Liquid var) (#2417)
* Use `_config.yaml` or `_config.yml` (`.yml` takes precedence) (#2406)
* Override collection url template (#2418)
* Allow subdirectories in `_data` (#2395)
* Extract Pagination Generator into gem: `jekyll-paginate` (#2455)
* Utilize `date_to_rfc822` filter in site template (#2437)
* Add categories, last build datetime, and generator to site template feed (#2438)
* Configurable, replaceable Logger-compliant logger (#2444)
* Extract `gist` tag into a separate gem (#2469)
* Add `collection` attribute to `Document#to_liquid` to access the document's collection label. (#2436)
* Upgrade listen to `2.7.6 <= x < 3.0.0` (#2492)
* Allow configuration of different Twitter and GitHub usernames in site template (#2485)
* Bump Pygments to v0.6.0 (#2504)
* Front matter defaults for documents in collections (#2419)
* Include files with a url which ends in `/` in the `site.html_pages` list (#2524)
* Make `highlight` tag use `language-` prefix in CSS class (#2511)
* Lookup item property via `item#to_liquid` before `#data` or `#[]` in filters (#2493)
* Skip initial build of site on serve with flag (#2477)
* Add support for `hl_lines` in `highlight` tag (#2532)
* Spike out `--watch` flag into a separate gem (#2550)
### Bug Fixes
* Liquid `sort` filter should sort even if one of the values is `nil` (#2345)
* Remove padding on `pre code` in the site template CSS (#2383)
* Set `log_level` earlier to silence info level configuration output (#2393)
* Only list pages which have `title` in site template (#2411)
* Accept `Numeric` values for dates, not `Number` values (#2377)
* Prevent code from overflowing container in site template (#2429)
* Encode URLs in UTF-8 when escaping and unescaping (#2420)
* No Layouts or Liquid for Asset Files (#2431)
* Allow front matter defaults to set post categories (#2373)
* Fix command in subcommand deprecation warning (#2457)
* Keep all parent directories of files/dirs in `keep_files` (#2458)
* When using RedCarpet and Rouge without Rouge installed, fixed erroneous error which stated that redcarpet was missing, not rouge. (#2464)
* Ignore *all* directories and files that merit it on auto-generation (#2459)
* Before copying file, explicitly remove the old one (#2535)
* Merge file system categories with categories from YAML. (#2531)
* Deep merge front matter defaults (#2490)
* Ensure exclude and include arrays are arrays of strings (#2542)
* Allow collections to have dots in their filenames (#2552)
* Collections shouldn't try to read in directories as files (#2552)
* Be quiet very quickly. (#2520)
### Development Fixes
* Test Ruby 2.1.2 instead of 2.1.1 (#2374)
* Add test for sorting UTF-8 characters (#2384)
* Use `https` for GitHub links in documentation (#2470)
* Remove coverage reporting with Coveralls (#2494)
* Fix a bit of missing TomDoc to `Jekyll::Commands::Build#build` (#2554)
### Site Enhancements
* Set `timezone` to `America/Los_Angeles` (#2394)
* Improve JavaScript in `anchor_links.html` (#2368)
* Remove note on Quickstart page about default markdown converter (#2387)
* Remove broken link in extras.md to a Maruku fork (#2401)
* Update Font Awesome to v4.1.0. (#2410)
* Fix broken link on Installation page to Templates page (#2421)
* Prevent table from extending parent width in permalink style table (#2424)
* Add collections to info about pagination support (#2389)
* Add `jekyll_github_sample` plugin to list of third-party plugins (#2463)
* Clarify documentation around front matter defaults and add details about defaults for collections. (#2439)
* Add Jekyll Project Version Tag to list of third-party plugins (#2468)
* Use `https` for GitHub links across whole site (#2470)
* Add StickerMule + Jekyll post (#2476)
* Add Jekyll Asset Pipeline Reborn to list of third-party plugins (#2479)
* Add link to jekyll-compress-html to list of third-party plugins (#2514)
* Add Piwigo Gallery to list of third-party plugins (#2526)
* Set `show_drafts` to `false` in default configuration listing (#2536)
* Provide an updated link for Windows installation instructions (#2544)
* Remove `url` from configuration docs (#2547)
* Documentation for Continuous Integration for your Jekyll Site (#2432)
## 2.0.3 / 2014-05-08
### Bug Fixes
* Properly prefix links in site template with URL or baseurl depending upon need. (#2319)
* Update gist tag comments and error message to require username (#2326)
* Fix `permalink` setting in site template (#2331)
* Don't fail if any of the path objects are nil (#2325)
* Instantiate all descendants for converters and generators, not just direct subclasses (#2334)
* Replace all instances of `site.name` with `site.title` in site template (#2324)
* `Jekyll::Filters#time` now accepts UNIX timestamps in string or number form (#2339)
* Use `item_property` for `where` filter so it doesn't break on collections (#2359)
* Rescue errors thrown so `--watch` doesn't fail (#2364)
### Site Enhancements
* Add missing "as" to assets docs page (#2337)
* Update docs to reflect new `baseurl` default (#2341)
* Add links to headers who have an ID. (#2342)
* Use symbol instead of HTML number in `upgrading.md` (#2351)
* Fix link to front matter defaults docs (#2353)
* Fix for `History.markdown` in order to fix history page in docs (#2363)
## 2.0.2 / 2014-05-07
### Bug Fixes
* Correct use of `url` and `baseurl` in the site template. (#2317)
* Default `baseurl` to `""` (#2317)
### Site Enhancements
* Correct docs for the `gist` plugin so it always includes the username. (#2314)
* Clarify new (defaults, `where` filter) features in docs (#2316)
## 2.0.1 / 2014-05-06
### Bug Fixes
* Require `kramdown` gem instead of `maruku` gem
## 2.0.0 / 2014-05-06
### Major Enhancements
* Add "Collections" feature (#2199)
* Add gem-based plugin whitelist to safe mode (#1657)
* Replace the commander command line parser with a more robust solution for our needs called `mercenary` (#1706)
* Remove support for Ruby 1.8.x (#1780)
* Move to jekyll/jekyll from mojombo/jekyll (#1817)
* Allow custom markdown processors (#1872)
* Provide support for the Rouge syntax highlighter (#1859)
* Provide support for Sass (#1932)
* Provide a 300% improvement when generating sites that use `Post#next` or `Post#previous` (#1983)
* Provide support for CoffeeScript (#1991)
* Replace Maruku with Kramdown as Default Markdown Processor (#1988)
* Expose `site.static_files` to Liquid (#2075)
* Complete redesign of the template site generated by `jekyll new` (#2050)
* Update Listen from 1.x to 2.x (#2097)
* Front matter defaults (#2205)
* Deprecate `relative_permalinks` configuration option (default to `false`) (#2307)
* Exclude files based on prefix as well as `fnmatch?` (#2303)
### Minor Enhancements
* Move the EntryFilter class into the Jekyll module to avoid polluting the global namespace (#1800)
* Add `group_by` Liquid filter create lists of items grouped by a common property's value (#1788)
* Add support for Maruku's `fenced_code_blocks` option (#1799)
* Update Redcarpet dependency to ~> 3.0 (#1815)
* Automatically sort all pages by name (#1848)
* Better error message when time is not parseable (#1847)
* Allow `include` tag variable arguments to use filters (#1841)
* `post_url` tag should raise `ArgumentError` for invalid name (#1825)
* Bump dependency `mercenary` to `~> 0.2.0` (#1879)
* Bump dependency `safe_yaml` to `~> 1.0` (#1886)
* Allow sorting of content by custom properties (#1849)
* Add `--quiet` flag to silence output during build and serve (#1898)
* Add a `where` filter to filter arrays based on a key/value pair (#1875)
* Route 404 errors to a custom 404 page in development (#1899)
* Excludes are now relative to the site source (#1916)
* Bring MIME Types file for `jekyll serve` to complete parity with GH Pages servers (#1993)
* Adding Breakpoint to make new site template more responsive (#2038)
* Default to using the UTF-8 encoding when reading files. (#2031)
* Update Redcarpet dependency to ~> 3.1 (#2044)
* Remove support for Ruby 1.9.2 (#2045)
* Add `.mkdown` as valid Markdown extension (#2048)
* Add `index.xml` to the list of WEBrick directory index files (#2041)
* Make the `layouts` config key relative to CWD or to source (#2058)
* Update Kramdown to `~> 1.3` (#1894)
* Remove unnecessary references to `self` (#2090)
* Update to Mercenary v0.3.x (#2085)
* Ship Sass support as a separate gem (#2098)
* Extract core extensions into a Utils module (#2112)
* Refactor CLI & Commands For Greater Happiness (#2143)
* Provide useful error when Pygments returns `nil` and error out (#2148)
* Add support for unpublished drafts (#2164)
* Add `force_polling` option to the `serve` command (#2165)
* Clean up the `
` in the site template (#2186)
* Permit YAML blocks to end with three dots to better conform with the YAML spec (#2110)
* Use `File.exist?` instead of deprecated `File.exists?` (#2214)
* Require newline after start of YAML Front Matter header (#2211)
* Add the ability for pages to be marked as `published: false` (#1492)
* Add `Jekyll::LiquidExtensions` with `.lookup_variable` method for easy looking up of variable values in a Liquid context. (#2253)
* Remove literal lang name from class (#2292)
* Return `utf-8` encoding in header for webrick error page response (#2289)
* Make template site easier to customize (#2268)
* Add two-digit year to permalink template option (#2301)
* Add `site.documents` to Liquid payload (list of all docs) (#2295)
* Take into account missing values in the Liquid sort filter (#2299)
### Bug Fixes
* Don't allow nil entries when loading posts (#1796)
* Remove the scrollbar that's always displayed in new sites generated from the site template (#1805)
* Add `#path` to required methods in `Jekyll::Convertible` (#1866)
* Default Maruku fenced code blocks to ON for 2.0.0-dev (#1831)
* Change short opts for host and port for `jekyll docs` to be consistent with other subcommands (#1877)
* Fix typos (#1910)
* Lock Maruku at 0.7.0 to prevent bugs caused by Maruku 0.7.1 (#1958)
* Fixes full path leak to source directory when using include tag (#1951)
* Don't generate pages that aren't being published (#1931)
* Use `SafeYAML.load` to avoid conflicts with other projects (#1982)
* Relative posts should never fail to build (#1976)
* Remove executable bits of non executable files (#2056)
* `#path` for a draft is now `_drafts` instead of `_posts` (#2042)
* Patch a couple show-stopping security vulnerabilities (#1946)
* Sanitize paths uniformly, in a Windows-friendly way (#2065, #2109)
* Update gem build steps to work correctly on Windows (#2118)
* Remove obsolete `normalize_options` method call from `bin/jekyll` (#2121).
* Remove `+` characters from Pygments lexer names when adding as a CSS class (#994)
* Remove some code that caused Ruby interpreter warnings (#2178)
* Only strip the drive name if it begins the string (#2175)
* Remove default post with invalid date from site template (#2200)
* Fix `Post#url` and `Page#url` escape (#1568)
* Strip newlines from the `{% highlight %}` block content (#1823)
* Load in `rouge` only when it's been requested as the highlighter (#2189)
* Convert input to string before XML escaping (`xml_escape` liquid filter) (#2244)
* Modify configuration key for Collections and reset properly. (#2238)
* Avoid duplicated output using `highlight` tag (#2264)
* Only use Jekyll.logger for output (#2307)
* Close the file descriptor in `has_yaml_header?` (#2310)
* Add `output` to `Document` liquid output hash (#2309)
### Development Fixes
* Add a link to the site in the README.md file (#1795)
* Add in History and site changes from `v1-stable` branch (#1836)
* Testing additions on the Excerpt class (#1893)
* Fix the `highlight` tag feature (#1859)
* Test Jekyll under Ruby 2.1.0 (#1900)
* Add script/cibuild for fun and profit (#1912)
* Use `Forwardable` for delegation between `Excerpt` and `Post` (#1927)
* Rename `read_things` to `read_content` (#1928)
* Add `script/branding` script for ASCII art lovin' (#1936)
* Update the README to reflect the repo move (#1943)
* Add the project vision to the README (#1935)
* Speed up Travis CI builds by using Rebund (#1985)
* Use Yarp as a Gem proxy for Travis CI (#1984)
* Remove Yarp as a Gem proxy for Travis CI (#2004)
* Move the reading of layouts into its own class (#2020)
* Test Sass import (#2009)
* Switch Maruku and Kramdown in lists of Runtime vs. Development dependencies (#2049)
* Clean up the gemspec for the project (#2095)
* Add Japanese translation of README and CONTRIBUTING docs. (#2081)
* Re-align the tables in Cucumber (#2108)
* Trim trailing spaces and convert tabs to spaces (#2122)
* Fix the failing Travis scenarios due to Cucumber issues (#2155)
* Wrap `bundle install` in `travis_retry` to retry when RubyGems fails (#2160)
* Refactor tags and categories (#1639)
* Extract plugin management into its own class (#2197)
* Add missing tests for `Command` (#2216)
* Update `rr` link in CONTRIBUTING doc (#2247)
* Streamline Cucumber execution of `jekyll` subcommands (#2258)
* Refactor `Commands::Serve`. (#2269)
* Refactor `highlight` tag (#2154)
* Update `Util` hash functions with latest from Rails (#2273)
* Workaround for Travis bug (#2290)
### Site Enhancements
* Document Kramdown's GFM parser option (#1791)
* Move CSS to includes & update normalize.css to v2.1.3 (#1787)
* Minify CSS only in production (#1803)
* Fix broken link to installation of Ruby on Mountain Lion blog post on Troubleshooting docs page (#1797)
* Fix issues with 1.4.1 release blog post (#1804)
* Add note about deploying to OpenShift (#1812)
* Collect all Windows-related docs onto one page (#1818)
* Fixed typo in datafiles doc page (#1854)
* Clarify how to access `site` in docs (#1864)
* Add closing `` tag to `context.registers[:site]` note (#1867)
* Fix link to @mojombo's site source (#1897)
* Add `paginate: nil` to default configuration in docs (#1896)
* Add link to our License in the site footer (#1889)
* Add a charset note in "Writing Posts" doc page (#1902)
* Disallow selection of path and prompt in bash examples
* Add jekyll-compass to the plugin list (#1923)
* Add note in Posts docs about stripping `
` tags from excerpt (#1933)
* Add additional info about the new exclude behavior (#1938)
* Linkify 'awesome contributors' to point to the contributors graph on GitHub (#1940)
* Update `docs/sites.md` link to GitHub Training materials (#1949)
* Update `master` with the release info from 1.4.3 (#1947)
* Define docs nav in datafile (#1953)
* Clarify the docs around the naming convention for posts (#1971)
* Add missing `next` and `previous` docs for post layouts and templates (#1970)
* Add note to `Writing posts` page about how to strip html from excerpt (#1962)
* Add `jekyll-humanize` plugin to plugin list (#1998)
* Add `jekyll-font-awesome` plugin to plugin list (#1999)
* Add `sublime-jekyll` to list of Editor plugins (#2001)
* Add `vim-jekyll` to the list of Editor plugins (#2005)
* Fix non-semantic nesting of `p` tags in `news_item` layout (#2013)
* Document destination folder cleaning (#2016)
* Updated instructions for NearlyFreeSpeech.NET installation (#2015)
* Update link to rack-jekyll on "Deployment Methods" page (#2047)
* Fix typo in /docs/configuration (#2073)
* Fix count in docs for `site.static_files` (#2077)
* Update configuration docs to indicate utf-8 is the default for 2.0.0 and ASCII for 1.9.3 (#2074)
* Add info about unreleased feature to the site (#2061)
* Add whitespace to liquid example in GitHub Pages docs (#2084)
* Clarify the way Sass and CoffeeScript files are read in and output (#2067)
* Add lyche gallery tag plugin link to list of plugins (#2094)
* Add Jekyll Pages Directory plugin to list of plugins (#2096)
* Update Configuration docs page with new markdown extension (#2102)
* Add `jekyll-image-set` to the list of third-party plugins (#2105)
* Losslessly compress images (#2128)
* Update normalize.css to 3.0.0 (#2126)
* Update modernizr to v2.7.1 (#2129)
* Add `jekyll-ordinal` to list of third-party plugins (#2150)
* Add `jekyll_figure` to list of third-party plugins (#2158)
* Clarify the documentation for safe mode (#2163)
* Some HTML tidying (#2130)
* Remove modernizr and use html5shiv.js directly for IE less than v9 (#2131)
* Remove unused images (#2187)
* Use `array_to_sentence_string` filter when outputting news item categories (#2191)
* Add link to Help repo in primary navigation bar (#2177)
* Switch to using an ico file for the shortcut icon (#2193)
* Use numbers to specify font weights and only bring in font weights used (#2185)
* Add a link to the list of all tz database time zones (#1824)
* Clean-up and improve documentation `feed.xml` (#2192)
* Remove duplicate entry in list of third-party plugins (#2206)
* Reduce the whitespace in the favicon. (#2213)
* Add `jekyll-page-collections` to list of third-party plugins (#2215)
* Add a cross-reference about `post_url` (#2243)
* Add `jekyll-live-tiles` to list of third-party plugins (#2250)
* Fixed broken link to GitHub training material site source (#2257)
* Update link to help repo, now called `jekyll-help` (#2277)
* Fix capitalization of 'Jekyll' on Deployment Methods page (#2291)
* Include plugins by sonnym in list of third-party plugins (#2297)
* Add deprecated articles keeper filter to list of third-party plugins (#2300)
* Simplify and improve our CSS. (#2127)
* Use black text color for the mobile navbar (#2306)
* Use the built in date filter and `site.time` for the copyright year. (#2305)
* Update html5shiv to v3.7.2 (#2304)
* Add 2.0.0 release post (#2298)
* Add docs for custom markdown processors (#2298)
* Add docs for `where` and `group_by` Liquid filters (#2298)
* Remove notes in docs for unreleased features (#2309)
## 1.5.1 / 2014-03-27
### Bug Fixes
* Only strip the drive name if it begins the string (#2176)
## 1.5.0 / 2014-03-24
### Minor Enhancements
* Loosen `safe_yaml` dependency to `~> 1.0` (#2167)
* Bump `safe_yaml` dependency to `~> 1.0.0` (#1942)
### Bug Fixes
* Fix issue where filesystem traversal restriction broke Windows (#2167)
* Lock `maruku` at `0.7.0` (#2167)
### Development Fixes
* Lock `cucumber` at `1.3.11` (#2167)
## 1.4.3 / 2014-01-13
### Bug Fixes
* Patch show-stopping security vulnerabilities (#1944)
## 1.4.2 / 2013-12-16
### Bug Fixes
* Turn on Maruku fenced code blocks by default (#1830)
## 1.4.1 / 2013-12-09
### Bug Fixes
* Don't allow nil entries when loading posts (#1796)
## 1.4.0 / 2013-12-07
### Major Enhancements
* Add support for TOML config files (#1765)
### Minor Enhancements
* Sort plugins as a way to establish a load order (#1682)
* Update Maruku to 0.7.0 (#1775)
### Bug Fixes
* Add a space between two words in a Pagination warning message (#1769)
* Upgrade `toml` gem to `v0.1.0` to maintain compat with Ruby 1.8.7 (#1778)
### Development Fixes
* Remove some whitespace in the code (#1755)
* Remove some duplication in the reading of posts and drafts (#1779)
### Site Enhancements
* Fixed case of a word in the Jekyll v1.3.0 release post (#1762)
* Fixed the mime type for the favicon (#1772)
## 1.3.1 / 2013-11-26
### Minor Enhancements
* Add a `--prefix` option to passthrough for the importers (#1669)
* Push the paginator plugin lower in the plugin priority order so other plugins run before it (#1759)
### Bug Fixes
* Fix the include tag when ran in a loop (#1726)
* Fix errors when using `--watch` on 1.8.7 (#1730)
* Specify where the include is called from if an included file is missing (#1746)
### Development Fixes
* Extract `Site#filter_entries` into its own object (#1697)
* Enable Travis' bundle caching (#1734)
* Remove trailing whitespace in some files (#1736)
* Fix a duplicate test name (#1754)
### Site Enhancements
* Update link to example Rakefile to point to specific commit (#1741)
* Fix drafts docs to indicate that draft time is based on file modification time, not `Time.now` (#1695)
* Add `jekyll-monthly-archive-plugin` and `jekyll-category-archive-plugin` to list of third-party plugins (#1693)
* Add `jekyll-asset-path-plugin` to list of third-party plugins (#1670)
* Add `emoji-for-jekyll` to list of third-part plugins (#1708)
* Fix previous section link on plugins page to point to pagination page (#1707)
* Add `org-mode` converter plugin to third-party plugins (#1711)
* Point "Blog migrations" page to http://import.jekyllrb.com (#1732)
* Add docs for `post_url` when posts are in subdirectories (#1718)
* Update the docs to point to `example.com` (#1448)
## 1.3.0 / 2013-11-04
### Major Enhancements
* Add support for adding data as YAML files under a site's `_data` directory (#1003)
* Allow variables to be used with `include` tags (#1495)
* Allow using gems for plugin management (#1557)
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
* Add `encoding` configuration option (#1449)
* Provide better error handling for Jekyll's custom Liquid tags (#1514)
* If an included file causes a Liquid error, add the path to the include file that caused the error to the error message (#1596)
* If a layout causes a Liquid error, change the error message so that we know it comes from the layout (#1601)
* Update Kramdown dependency to `~> 1.2` (#1610)
* Update `safe_yaml` dependency to `~> 0.9.7` (#1602)
* Allow layouts to be in subfolders like includes (#1622)
* Switch to listen for site watching while serving (#1589)
* Add a `json` liquid filter to be used in sites (#1651)
* Point people to the migration docs when the `jekyll-import` gem is missing (#1662)
### Bug Fixes
* Fix up matching against source and destination when the two locations are similar (#1556)
* Fix the missing `pathname` require in certain cases (#1255)
* Use `+` instead of `Array#concat` when building `Post` attribute list (#1571)
* Print server address when launching a server (#1586)
* Downgrade to Maruku `~> 0.6.0` in order to avoid changes in rendering (#1598)
* Fix error with failing include tag when variable was file name (#1613)
* Downcase lexers before passing them to pygments (#1615)
* Capitalize the short verbose switch because it conflicts with the built-in Commander switch (#1660)
* Fix compatibility with 1.8.x (#1665)
* Fix an error with the new file watching code due to library version incompatibilities (#1687)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
* Refactor the Liquid `include` tag (#1490)
* Update launchy dependency to `~> 2.3` (#1608)
* Update rr dependency to `~> 1.1` (#1604)
* Update cucumber dependency to `~> 1.3` (#1607)
* Update coveralls dependency to `~> 0.7.0` (#1606)
* Update rake dependency to `~> 10.1` (#1603)
* Clean up `site.rb` comments to be more concise/uniform (#1616)
* Use the master branch for the build badge in the readme (#1636)
* Refactor Site#render (#1638)
* Remove duplication in command line options (#1637)
* Add tests for all the coderay options (#1543)
* Improve some of the Cucumber test code (#1493)
* Improve comparisons of timestamps by ignoring the seconds (#1582)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
* Add `jekyll-suggested-tweet` to list of third-party plugins (#1555)
* Link to Liquid's docs for tags and filters (#1553)
* Add note about installing Xcode on the Mac in the Installation docs (#1561)
* Simplify/generalize pagination docs (#1577)
* Add documentation for the new data sources feature (#1503)
* Add more information on how to create generators (#1590, #1592)
* Improve the instructions for mimicking GitHub Flavored Markdown (#1614)
* Add `jekyll-import` warning note of missing dependencies (#1626)
* Fix grammar in the Usage section (#1635)
* Add documentation for the use of gems as plugins (#1656)
* Document the existence of a few additional plugins (#1405)
* Document that the `date_to_string` always returns a two digit day (#1663)
* Fix navigation in the "Working with Drafts" page (#1667)
* Fix an error with the data documentation (#1691)
## 1.2.1 / 2013-09-14
### Minor Enhancements
* Print better messages for detached server. Mute output on detach. (#1518)
* Disable reverse lookup when running `jekyll serve` (#1363)
* Upgrade RedCarpet dependency to `~> 2.3.0` (#1515)
* Upgrade to Liquid `>= 2.5.2, < 2.6` (#1536)
### Bug Fixes
* Fix file discrepancy in gemspec (#1522)
* Force rendering of Include tag (#1525)
### Development Fixes
* Add a rake task to generate a new release post (#1404)
* Mute LSI output in tests (#1531)
* Update contributor documentation (#1537)
### Site Enhancements
* Fix a couple of validation errors on the site (#1511)
* Make navigation menus reusable (#1507)
* Fix link to History page from Release v1.2.0 notes post.
* Fix markup in History file for command line options (#1512)
* Expand 1.2 release post title to 1.2.0 (#1516)
## 1.2.0 / 2013-09-06
### Major Enhancements
* Disable automatically-generated excerpts when `excerpt_separator` is `""`. (#1386)
* Add checking for URL conflicts when running `jekyll doctor` (#1389)
### Minor Enhancements
* Catch and fix invalid `paginate` values (#1390)
* Remove superfluous `div.container` from the default html template for `jekyll new` (#1315)
* Add `-D` short-form switch for the drafts option (#1394)
* Update the links in the site template for Twitter and GitHub (#1400)
* Update dummy email address to example.com domain (#1408)
* Update normalize.css to v2.1.2 and minify; add rake task to update normalize.css with greater ease. (#1430)
* Add the ability to detach the server ran by `jekyll serve` from it's controlling terminal (#1443)
* Improve permalink generation for URLs with special characters (#944)
* Expose the current Jekyll version to posts and pages via a new `jekyll.version` variable (#1481)
### Bug Fixes
* Markdown extension matching matches only exact matches (#1382)
* Fixed NoMethodError when message passed to `Stevenson#message` is nil (#1388)
* Use binary mode when writing file (#1364)
* Fix 'undefined method `encoding` for "mailto"' errors w/ Ruby 1.8 and Kramdown > 0.14.0 (#1397)
* Do not force the permalink to be a dir if it ends on .html (#963)
* When a Liquid Exception is caught, show the full path rel. to site source (#1415)
* Properly read in the config options when serving the docs locally (#1444)
* Fixed `--layouts` option for `build` and `serve` commands (#1458)
* Remove kramdown as a runtime dependency since it's optional (#1498)
* Provide proper error handling for invalid file names in the include tag (#1494)
### Development Fixes
* Remove redundant argument to Jekyll::Commands::New#scaffold_post_content (#1356)
* Add new dependencies to the README (#1360)
* Fix link to contributing page in README (#1424)
* Update TomDoc in Pager#initialize to match params (#1441)
* Refactor `Site#cleanup` into `Jekyll::Site::Cleaner` class (#1429)
* Several other small minor refactorings (#1341)
* Ignore `_site` in jekyllrb.com deploy (#1480)
* Add Gem version and dependency badge to README (#1497)
### Site Enhancements
* Add info about new releases (#1353)
* Update plugin list with jekyll-rss plugin (#1354)
* Update the site list page with Ruby's official site (#1358)
* Add `jekyll-ditaa` to list of third-party plugins (#1370)
* Add `postfiles` to list of third-party plugins (#1373)
* For internal links, use full path including trailing `/` (#1411)
* Use curly apostrophes in the docs (#1419)
* Update the docs for Redcarpet in Jekyll (#1418)
* Add `pluralize` and `reading_time` filters to docs (#1439)
* Fix markup for the Kramdown options (#1445)
* Fix typos in the History file (#1454)
* Add trailing slash to site's post URL (#1462)
* Clarify that `--config` will take multiple files (#1474)
* Fix docs/templates.md private gist example (#1477)
* Use `site.repository` for Jekyll's GitHub URL (#1463)
* Add `jekyll-pageless-redirects` to list of third-party plugins (#1486)
* Clarify that `date_to_xmlschema` returns an ISO 8601 string (#1488)
* Add `jekyll-good-include` to list of third-party plugins (#1491)
* XML escape the blog post title in our feed (#1501)
* Add `jekyll-toc-generator` to list of third-party plugins (#1506)
## 1.1.2 / 2013-07-25
### Bug Fixes
* Require Liquid 2.5.1 (#1349)
## 1.1.1 / 2013-07-24
### Minor Enhancements
* Remove superfluous `table` selector from main.css in `jekyll new` template (#1328)
* Abort with non-zero exit codes (#1338)
### Bug Fixes
* Fix up the rendering of excerpts (#1339)
### Site Enhancements
* Add Jekyll Image Tag to the plugins list (#1306)
* Remove erroneous statement that `site.pages` are sorted alphabetically.
* Add info about the `_drafts` directory to the directory structure docs (#1320)
* Improve the layout of the plugin listing by organizing it into categories (#1310)
* Add generator-jekyllrb and grunt-jekyll to plugins page (#1330)
* Mention Kramdown as option for markdown parser on Extras page (#1318)
* Update Quick-Start page to include reminder that all requirements must be installed (#1327)
* Change filename in `include` example to an HTML file so as not to indicate that Jekyll will automatically convert them. (#1303)
* Add an RSS feed for commits to Jekyll (#1343)
## 1.1.0 / 2013-07-14
### Major Enhancements
* Add `docs` subcommand to read Jekyll's docs when offline. (#1046)
* Support passing parameters to templates in `include` tag (#1204)
* Add support for Liquid tags to post excerpts (#1302)
### Minor Enhancements
* Search the hierarchy of pagination path up to site root to determine template page for pagination. (#1198)
* Add the ability to generate a new Jekyll site without a template (#1171)
* Use redcarpet as the default markdown engine in newly generated sites (#1245, #1247)
* Add `redcarpet` as a runtime dependency so `jekyll build` works out-of-the-box for new sites. (#1247)
* In the generated site, remove files that will be replaced by a directory (#1118)
* Fail loudly if a user-specified configuration file doesn't exist (#1098)
* Allow for all options for Kramdown HTML Converter (#1201)
### Bug Fixes
* Fix pagination in subdirectories. (#1198)
* Fix an issue with directories and permalinks that have a plus sign (+) in them (#1215)
* Provide better error reporting when generating sites (#1253)
* Latest posts first in non-LSI `related_posts` (#1271)
### Development Fixes
* Merge the theme and layout Cucumber steps into one step (#1151)
* Restrict activesupport dependency to pre-4.0.0 to maintain compatibility with `<= 1.9.2`
* Include/exclude deprecation handling simplification (#1284)
* Convert README to Markdown. (#1267)
* Refactor Jekyll::Site (#1144)
### Site Enhancements
* Add "News" section for release notes, along with an RSS feed (#1093, #1285, #1286)
* Add "History" page.
* Restructured docs sections to include "Meta" section.
* Add message to "Templates" page that specifies that Python must be installed in order to use Pygments. (#1182)
* Update link to the official Maruku repo (#1175)
* Add documentation about `paginate_path` to "Templates" page in docs (#1129)
* Give the quick-start guide its own page (#1191)
* Update ProTip on Installation page in docs to point to all the info about Pygments and the 'highlight' tag. (#1196)
* Run `site/img` through ImageOptim (thanks @qrush!) (#1208)
* Added Jade Converter to `site/docs/plugins` (#1210)
* Fix location of docs pages in Contributing pages (#1214)
* Add ReadInXMinutes plugin to the plugin list (#1222)
* Remove plugins from the plugin list that have equivalents in Jekyll proper (#1223)
* Add jekyll-assets to the plugin list (#1225)
* Add jekyll-pandoc-mulitple-formats to the plugin list (#1229)
* Remove dead link to "Using Git to maintain your blog" (#1227)
* Tidy up the third-party plugins listing (#1228)
* Update contributor information (#1192)
* Update URL of article about Blogger migration (#1242)
* Specify that RedCarpet is the default for new Jekyll sites on Quickstart page (#1247)
* Added `site.pages` to Variables page in docs (#1251)
* Add Youku and Tudou Embed link on Plugins page. (#1250)
* Add note that `gist` tag supports private gists. (#1248)
* Add `jekyll-timeago` to list of third-party plugins. (#1260)
* Add `jekyll-swfobject` to list of third-party plugins. (#1263)
* Add `jekyll-picture-tag` to list of third-party plugins. (#1280)
* Update the GitHub Pages documentation regarding relative URLs (#1291)
* Update the S3 deployment documentation (#1294)
* Add suggestion for Xcode CLT install to troubleshooting page in docs (#1296)
* Add 'Working with drafts' page to docs (#1289)
* Add information about time zones to the documentation for a page's date (#1304)
## 1.0.3 / 2013-06-07
### Minor Enhancements
* Add support to gist tag for private gists. (#1189)
* Fail loudly when Maruku errors out (#1190)
* Move the building of related posts into their own class (#1057)
* Removed trailing spaces in several places throughout the code (#1116)
* Add a `--force` option to `jekyll new` (#1115)
* Convert IDs in the site template to classes (#1170)
### Bug Fixes
* Fix typo in Stevenson constant "ERROR". (#1166)
* Rename Jekyll::Logger to Jekyll::Stevenson to fix inheritance issue (#1106)
* Exit with a non-zero exit code when dealing with a Liquid error (#1121)
* Make the `exclude` and `include` options backwards compatible with versions of Jekyll prior to 1.0 (#1114)
* Fix pagination on Windows (#1063)
* Fix the application of Pygments' Generic Output style to Go code (#1156)
### Site Enhancements
* Add a Pro Tip to docs about front matter variables being optional (#1147)
* Add changelog to site as History page in /docs/ (#1065)
* Add note to Upgrading page about new config options in 1.0.x (#1146)
* Documentation for `date_to_rfc822` and `uri_escape` (#1142)
* Documentation highlight boxes shouldn't show scrollbars if not necessary (#1123)
* Add link to jekyll-minibundle in the doc's plugins list (#1035)
* Quick patch for importers documentation
* Fix prefix for WordpressDotCom importer in docs (#1107)
* Add jekyll-contentblocks plugin to docs (#1068)
* Make code bits in notes look more natural, more readable (#1089)
* Fix logic for `relative_permalinks` instructions on Upgrading page (#1101)
* Add docs for post excerpt (#1072)
* Add docs for gist tag (#1072)
* Add docs indicating that Pygments does not need to be installed separately (#1099, #1119)
* Update the migrator docs to be current (#1136)
* Add the Jekyll Gallery Plugin to the plugin list (#1143)
### Development Fixes
* Use Jekyll.logger instead of Jekyll::Stevenson to log things (#1149)
* Fix pesky Cucumber infinite loop (#1139)
* Do not write posts with timezones in Cucumber tests (#1124)
* Use ISO formatted dates in Cucumber features (#1150)
## 1.0.2 / 2013-05-12
### Major Enhancements
* Add `jekyll doctor` command to check site for any known compatibility problems (#1081)
* Backwards-compatibilize relative permalinks (#1081)
### Minor Enhancements
* Add a `data-lang=""` attribute to Redcarpet code blocks (#1066)
* Deprecate old config `server_port`, match to `port` if `port` isn't set (#1084)
* Update pygments.rb version to 0.5.0 (#1061)
* Update Kramdown version to 1.0.2 (#1067)
### Bug Fixes
* Fix issue when categories are numbers (#1078)
* Catching that Redcarpet gem isn't installed (#1059)
### Site Enhancements
* Add documentation about `relative_permalinks` (#1081)
* Remove pygments-installation instructions, as pygments.rb is bundled with it (#1079)
* Move pages to be Pages for realz (#985)
* Updated links to Liquid documentation (#1073)
## 1.0.1 / 2013-05-08
### Minor Enhancements
* Do not force use of `toc_token` when using `generate_tok` in RDiscount (#1048)
* Add newer `language-` class name prefix to code blocks (#1037)
* Commander error message now preferred over process abort with incorrect args (#1040)
### Bug Fixes
* Make Redcarpet respect the pygments configuration option (#1053)
* Fix the index build with LSI (#1045)
* Don't print deprecation warning when no arguments are specified. (#1041)
* Add missing `` to site template used by `new` subcommand, fixed typos in code (#1032)
### Site Enhancements
* Changed https to http in the GitHub Pages link (#1051)
* Remove CSS cruft, fix typos, fix HTML errors (#1028)
* Removing manual install of Pip and Distribute (#1025)
* Updated URL for Markdown references plugin (#1022)
### Development Fixes
* Markdownify history file (#1027)
* Update links on README to point to new jekyllrb.com (#1018)
## 1.0.0 / 2013-05-06
### Major Enhancements
* Add `jekyll new` subcommand: generate a Jekyll scaffold (#764)
* Refactored Jekyll commands into subcommands: build, serve, and migrate. (#690)
* Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793)
* Added ability to render drafts in `_drafts` folder via command line (#833)
* Add ordinal date permalink style (/:categories/:year/:y_day/:title.html) (#928)
### Minor Enhancements
* Site template HTML5-ified (#964)
* Use post's directory path when matching for the `post_url` tag (#998)
* Loosen dependency on Pygments so it's only required when it's needed (#1015)
* Parse strings into Time objects for date-related Liquid filters (#1014)
* Tell the user if there is no subcommand specified (#1008)
* Freak out if the destination of `jekyll new` exists and is non-empty (#981)
* Add `timezone` configuration option for compilation (#957)
* Add deprecation messages for pre-1.0 CLI options (#959)
* Refactor and colorize logging (#959)
* Refactor Markdown parsing (#955)
* Added application/vnd.apple.pkpass to mime.types served by WEBrick (#907)
* Move template site to default markdown renderer (#961)
* Expose new attribute to Liquid via `page`: `page.path` (#951)
* Accept multiple config files from command line (#945)
* Add page variable to liquid custom tags and blocks (#413)
* Add `paginator.previous_page_path` and `paginator.next_page_path` (#942)
* Backwards compatibility for 'auto' (#821, #934)
* Added date_to_rfc822 used on RSS feeds (#892)
* Upgrade version of pygments.rb to 0.4.2 (#927)
* Added short month (e.g. "Sep") to permalink style options for posts (#890)
* Expose site.baseurl to Liquid templates (#869)
* Adds excerpt attribute to posts which contains first paragraph of content (#837)
* Accept custom configuration file via CLI (#863)
* Load in GitHub Pages MIME Types on `jekyll serve` (#847, #871)
* Improve debugability of error message for a malformed highlight tag (#785)
* Allow symlinked files in unsafe mode (#824)
* Add 'gist' Liquid tag to core (#822, #861)
* New format of Jekyll output (#795)
* Reinstate `--limit_posts` and `--future` switches (#788)
* Remove ambiguity from command descriptions (#815)
* Fix SafeYAML Warnings (#807)
* Relaxed Kramdown version to 0.14 (#808)
* Aliased `jekyll server` to `jekyll serve`. (#792)
* Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744)
* Refactored Jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768)
* Rescue from import errors in Wordpress.com migrator (#671)
* Massively accelerate LSI performance (#664)
* Truncate post slugs when importing from Tumblr (#496)
* Add glob support to include, exclude option (#743)
* Layout of Page or Post defaults to 'page' or 'post', respectively (#580) REPEALED by (#977)
* "Keep files" feature (#685)
* Output full path & name for files that don't parse (#745)
* Add source and destination directory protection (#535)
* Better YAML error message (#718)
* Bug Fixes
* Paginate in subdirectories properly (#1016)
* Ensure post and page URLs have a leading slash (#992)
* Catch all exceptions, not just StandardError descendents (#1007)
* Bullet-proof `limit_posts` option (#1004)
* Read in YAML as UTF-8 to accept non-ASCII chars (#836)
* Fix the CLI option `--plugins` to actually accept dirs and files (#993)
* Allow 'excerpt' in YAML front matter to override the extracted excerpt (#946)
* Fix cascade problem with site.baseurl, site.port and site.host. (#935)
* Filter out directories with valid post names (#875)
* Fix symlinked static files not being correctly built in unsafe mode (#909)
* Fix integration with directory_watcher 1.4.x (#916)
* Accepting strings as arguments to jekyll-import command (#910)
* Force usage of older directory_watcher gem as 1.5 is broken (#883)
* Ensure all Post categories are downcase (#842, #872)
* Force encoding of the rdiscount TOC to UTF8 to avoid conversion errors (#555)
* Patch for multibyte URI problem with `jekyll serve` (#723)
* Order plugin execution by priority (#864)
* Fixed Page#dir and Page#url for edge cases (#536)
* Fix broken `post_url` with posts with a time in their YAML front matter (#831)
* Look for plugins under the source directory (#654)
* Tumblr Migrator: finds `_posts` dir correctly, fixes truncation of long post names (#775)
* Force Categories to be Strings (#767)
* Safe YAML plugin to prevent vulnerability (#777)
* Add SVG support to Jekyll/WEBrick. (#407, #406)
* Prevent custom destination from causing continuous regen on watch (#528, #820, #862)
### Site Enhancements
* Responsify (#860)
* Fix spelling, punctuation and phrasal errors (#989)
* Update quickstart instructions with `new` command (#966)
* Add docs for page.excerpt (#956)
* Add docs for page.path (#951)
* Clean up site docs to prepare for 1.0 release (#918)
* Bring site into master branch with better preview/deploy (#709)
* Redesigned site (#583)
### Development Fixes
* Exclude Cucumber 1.2.4, which causes tests to fail in 1.9.2 (#938)
* Added "features:html" rake task for debugging purposes, cleaned up Cucumber profiles (#832)
* Explicitly require HTTPS rubygems source in Gemfile (#826)
* Changed Ruby version for development to 1.9.3-p374 from p362 (#801)
* Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806)
* Added script/bootstrap (#776)
* Running Simplecov under 2 conditions: ENV(COVERAGE)=true and with Ruby version of greater than 1.9 (#771)
* Switch to Simplecov for coverage report (#765)
## 0.12.1 / 2013-02-19
### Minor Enhancements
* Update Kramdown version to 0.14.1 (#744)
* Test Enhancements
* Update Rake version to 10.0.3 (#744)
* Update Shoulda version to 3.3.2 (#744)
* Update Redcarpet version to 2.2.2 (#744)
## 0.12.0 / 2012-12-22
### Minor Enhancements
* Add ability to explicitly specify included files (#261)
* Add `--default-mimetype` option (#279)
* Allow setting of RedCloth options (#284)
* Add `post_url` Liquid tag for internal post linking (#369)
* Allow multiple plugin dirs to be specified (#438)
* Inline TOC token support for RDiscount (#333)
* Add the option to specify the paginated url format (#342)
* Swap out albino for pygments.rb (#569)
* Support Redcarpet 2 and fenced code blocks (#619)
* Better reporting of Liquid errors (#624)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
* Fix error with `limit_posts` (#442)
* Properly select dotfile during directory scan (#363, #431, #377)
* Allow setting of Kramdown `smart_quotes` (#482)
* Ensure front matter is at start of file (#562)
## 0.11.2 / 2011-12-27
* Bug Fixes
* Fix gemspec
## 0.11.1 / 2011-12-27
* Bug Fixes
* Fix extra blank line in highlight blocks (#409)
* Update dependencies
## 0.11.0 / 2011-07-10
### Major Enhancements
* Add command line importer functionality (#253)
* Add Redcarpet Markdown support (#318)
* Make markdown/textile extensions configurable (#312)
* Add `markdownify` filter
### Minor Enhancements
* Switch to Albino gem
* Bundler support
* Use English library to avoid hoops (#292)
* Add Posterous importer (#254)
* Fixes for Wordpress importer (#274, #252, #271)
* Better error message for invalid post date (#291)
* Print formatted fatal exceptions to stdout on build failure
* Add Tumblr importer (#323)
* Add Enki importer (#320)
* Bug Fixes
* Secure additional path exploits
## 0.10.0 / 2010-12-16
* Bug Fixes
* Add `--no-server` option.
## 0.9.0 / 2010-12-15
### Minor Enhancements
* Use OptionParser's `[no-]` functionality for better boolean parsing.
* Add Drupal migrator (#245)
* Complain about YAML and Liquid errors (#249)
* Remove orphaned files during regeneration (#247)
* Add Marley migrator (#28)
## 0.8.0 / 2010-11-22
### Minor Enhancements
* Add wordpress.com importer (#207)
* Add `--limit-posts` cli option (#212)
* Add `uri_escape` filter (#234)
* Add `--base-url` cli option (#235)
* Improve MT migrator (#238)
* Add kramdown support (#239)
* Bug Fixes
* Fixed filename basename generation (#208)
* Set mode to UTF8 on Sequel connections (#237)
* Prevent `_includes` dir from being a symlink
## 0.7.0 / 2010-08-24
### Minor Enhancements
* Add support for rdiscount extensions (#173)
* Bug Fixes
* Highlight should not be able to render local files
* The site configuration may not always provide a 'time' setting (#184)
## 0.6.2 / 2010-06-25
* Bug Fixes
* Fix Rakefile 'release' task (tag pushing was missing origin)
* Ensure that RedCloth is loaded when textilize filter is used (#183)
* Expand source, destination, and plugin paths (#180)
* Fix `page.url` to include full relative path (#181)
## 0.6.1 / 2010-06-24
* Bug Fixes
* Fix Markdown Pygments prefix and suffix (#178)
## 0.6.0 / 2010-06-23
### Major Enhancements
* Proper plugin system (#19, #100)
* Add safe mode so unsafe converters/generators can be added
* Maruku is now the only processor dependency installed by default. Other processors will be lazy-loaded when necessary (and prompt the user to install them when necessary) (#57)
### Minor Enhancements
* Inclusion/exclusion of future dated posts (#59)
* Generation for a specific time (#59)
* Allocate `site.time` on render not per site_payload invocation (#59)
* Pages now present in the site payload and can be used through the `site.pages` and `site.html_pages` variables
* Generate phase added to site#process and pagination is now a generator
* Switch to RakeGem for build/test process
* Only regenerate static files when they have changed (#142)
* Allow arbitrary options to Pygments (#31)
* Allow URL to be set via command line option (#147)
* Bug Fixes
* Render highlighted code for non markdown/textile pages (#116)
* Fix highlighting on Ruby 1.9 (#65)
* Fix extension munging when pretty permalinks are enabled (#64)
* Stop sorting categories (#33)
* Preserve generated attributes over front matter (#119)
* Fix source directory binding using `Dir.pwd` (#75)
## 0.5.7 / 2010-01-12
### Minor Enhancements
* Allow overriding of post date in the front matter (#62, #38)
* Bug Fixes
* Categories isn't always an array (#73)
* Empty tags causes error in read_posts (#84)
* Fix pagination to adhere to read/render/write paradigm
* Test Enhancement
* Cucumber features no longer use site.posts.first where a better alternative is available
## 0.5.6 / 2010-01-08
* Bug Fixes
* Require redcloth >= 4.2.1 in tests (#92)
* Don't break on triple dashes in yaml front matter (#93)
### Minor Enhancements
* Allow .mkd as markdown extension
* Use $stdout/err instead of constants (#99)
* Properly wrap code blocks (#91)
* Add javascript mime type for webrick (#98)
## 0.5.5 / 2010-01-08
* Bug Fixes
* Fix pagination % 0 bug (#78)
* Ensure all posts are processed first (#71) ## NOTE
* After this point I will no longer be giving credit in the history; that is what the commit log is for.
## 0.5.4 / 2009-08-23
* Bug Fixes
* Do not allow symlinks (security vulnerability)
## 0.5.3 / 2009-07-14
* Bug Fixes
* Solving the permalink bug where non-html files wouldn't work (@jeffrydegrande)
## 0.5.2 / 2009-06-24
* Enhancements
* Added --paginate option to the executable along with a paginator object for the payload (@calavera)
* Upgraded RedCloth to 4.2.1, which makes `` tags work once again.
* Configuration options set in config.yml are now available through the site payload (@vilcans)
* Posts can now have an empty YAML front matter or none at all (@ bahuvrihi)
* Bug Fixes
* Fixing Ruby 1.9 issue that requires `#to_s` on the err object (@Chrononaut)
* Fixes for pagination and ordering posts on the same day (@ujh)
* Made pages respect permalinks style and permalinks in yml front matter (@eugenebolshakov)
* Index.html file should always have index.html permalink (@eugenebolshakov)
* Added trailing slash to pretty permalink style so Apache is happy (@eugenebolshakov)
* Bad markdown processor in config fails sooner and with better message (@ gcnovus)
* Allow CRLFs in yaml front matter (@juretta)
* Added Date#xmlschema for Ruby versions < 1.9
## 0.5.1 / 2009-05-06
### Major Enhancements
* Next/previous posts in site payload (@pantulis, @tomo)
* Permalink templating system
* Moved most of the README out to the GitHub wiki
* Exclude option in configuration so specified files won't be brought over with generated site (@duritong)
* Bug Fixes
* Making sure config.yaml references are all gone, using only config.yml
* Fixed syntax highlighting breaking for UTF-8 code (@henrik)
* Worked around RDiscount bug that prevents Markdown from getting parsed after highlight (@henrik)
* CGI escaped post titles (@Chrononaut)
## 0.5.0 / 2009-04-07
### Minor Enhancements
* Ability to set post categories via YAML (@qrush)
* Ability to set prevent a post from publishing via YAML (@qrush)
* Add textilize filter (@willcodeforfoo)
* Add 'pretty' permalink style for wordpress-like urls (@dysinger)
* Made it possible to enter categories from YAML as an array (@Chrononaut)
* Ignore Emacs autosave files (@Chrononaut)
* Bug Fixes
* Use block syntax of popen4 to ensure that subprocesses are properly disposed (@jqr)
* Close open4 streams to prevent zombies (@rtomayko)
* Only query required fields from the WP Database (@ariejan)
* Prevent `_posts` from being copied to the destination directory (@bdimcheff)
* Refactors
* Factored the filtering code into a method (@Chrononaut)
* Fix tests and convert to Shoulda (@qrush, @technicalpickles)
* Add Cucumber acceptance test suite (@qrush, @technicalpickles)
## 0.4.1
### Minor Enhancements
* Changed date format on wordpress converter (zeropadding) (@dysinger)
* Bug Fixes
* Add Jekyll binary as executable to gemspec (@dysinger)
## 0.4.0 / 2009-02-03
### Major Enhancements
* Switch to Jeweler for packaging tasks
### Minor Enhancements
* Type importer (@codeslinger)
* `site.topics` accessor (@baz)
* Add `array_to_sentence_string` filter (@mchung)
* Add a converter for textpattern (@PerfectlyNormal)
* Add a working Mephisto / MySQL converter (@ivey)
* Allowing .htaccess files to be copied over into the generated site (@briandoll)
* Add option to not put file date in permalink URL (@mreid)
* Add line number capabilities to highlight blocks (@jcon)
* Bug Fixes
* Fix permalink behavior (@cavalle)
* Fixed an issue with pygments, markdown, and newlines (@zpinter)
* Ampersands need to be escaped (@pufuwozu, @ap)
* Test and fix the site.categories hash (@zzot)
* Fix site payload available to files (@matrix9180)
## 0.3.0 / 2008-12-24
### Major Enhancements
* Added `--server` option to start a simple WEBrick server on destination directory (@johnreilly and @mchung)
### Minor Enhancements
* Added post categories based on directories containing `_posts` (@mreid)
* Added post topics based on directories underneath `_posts`
* Added new date filter that shows the full month name (@mreid)
* Merge Post's YAML front matter into its to_liquid payload (@remi)
* Restrict includes to regular files underneath `_includes`
* Bug Fixes
* Change YAML delimiter matcher so as to not chew up 2nd level markdown headers (@mreid)
* Fix bug that meant page data (such as the date) was not available in templates (@mreid)
* Properly reject directories in `_layouts`
## 0.2.1 / 2008-12-15
* Major Changes
* Use Maruku (pure Ruby) for Markdown by default (@mreid)
* Allow use of RDiscount with `--rdiscount` flag
### Minor Enhancements
* Don't load directory_watcher unless it's needed (@pjhyett)
## 0.2.0 / 2008-12-14
* Major Changes
* related_posts is now found in `site.related_posts`
## 0.1.6 / 2008-12-13
* Major Features
* Include files in `_includes` with `{% include x.textile %}`
## 0.1.5 / 2008-12-12
### Major Enhancements
* Code highlighting with Pygments if `--pygments` is specified
* Disable true LSI by default, enable with `--lsi`
### Minor Enhancements
* Output informative message if RDiscount is not available (@JackDanger)
* Bug Fixes
* Prevent Jekyll from picking up the output directory as a source (@JackDanger)
* Skip `related_posts` when there is only one post (@JackDanger)
## 0.1.4 / 2008-12-08
* Bug Fixes
* DATA does not work properly with rubygems
## 0.1.3 / 2008-12-06
* Major Features
* Markdown support (@vanpelt)
* Mephisto and CSV converters (@vanpelt)
* Code hilighting (@vanpelt)
* Autobuild
* Bug Fixes
* Accept both `\r\n` and `\n` in YAML header (@vanpelt)
## 0.1.2 / 2008-11-22
* Major Features
* Add a real "related posts" implementation using Classifier
* Command Line Changes
* Allow cli to be called with 0, 1, or 2 args intuiting dir paths if they are omitted
## 0.1.1 / 2008-11-22
* Minor Additions
* Posts now support introspectional data e.g. `{{ page.url }}`
## 0.1.0 / 2008-11-05
* First release
* Converts posts written in Textile
* Converts regular site pages
* Simple copy of binary files
## 0.0.0 / 2008-10-19
* Birthday!
jekyll-3.1.6/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000476 12717414063 0015534 0 ustar 00root root 0000000 0000000 ###### What version of Jekyll are you using (`jekyll -v`)?
###### What operating system are you using?
###### What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
###### What did you expect to see?
###### What did you see instead?
jekyll-3.1.6/LICENSE 0000664 0000000 0000000 00000002102 12717414063 0014020 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2008-2016 Tom Preston-Werner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
jekyll-3.1.6/README.markdown 0000664 0000000 0000000 00000006557 12717414063 0015536 0 ustar 00root root 0000000 0000000 # [Jekyll](http://jekyllrb.com/)
[][ruby-gems]
[][travis]
[][coverage]
[][codeclimate]
[][gemnasium]
[][hakiri]
[ruby-gems]: https://rubygems.org/gems/jekyll
[gemnasium]: https://gemnasium.com/jekyll/jekyll
[codeclimate]: https://codeclimate.com/github/jekyll/jekyll
[coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
[hakiri]: https://hakiri.io/github/jekyll/jekyll/master
[travis]: https://travis-ci.org/jekyll/jekyll
Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](http://pages.github.com), which you can use to host sites right from your GitHub repositories.
## Philosophy
Jekyll does what you tell it to do — no more, no less. It doesn't try to outsmart users by making bold assumptions, nor does it burden them with needless complexity and configuration. Put simply, Jekyll gets out of your way and allows you to concentrate on what truly matters: your content.
## Having trouble with OS X El Capitan?
See: http://jekyllrb.com/docs/troubleshooting/#jekyll-amp-mac-os-x-1011
## Getting Started
* [Install](http://jekyllrb.com/docs/installation/) the gem
* Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
* Take a gander at some existing [Sites](https://wiki.github.com/jekyll/jekyll/sites)
* 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/)
## Code of Conduct
In order to have a more open and welcoming community, Jekyll adheres to a
[code of conduct](CONDUCT.markdown) 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
* [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system
* Learn how the [YAML Front Matter](http://jekyllrb.com/docs/frontmatter/) works
* Put information on your site with [Variables](http://jekyllrb.com/docs/variables/)
* Customize the [Permalinks](http://jekyllrb.com/docs/permalinks/) your posts are generated with
* Use the built-in [Liquid Extensions](http://jekyllrb.com/docs/templates/) to make your life easier
* Use custom [Plugins](http://jekyllrb.com/docs/plugins/) to generate content specific to your site
## License
See [LICENSE](https://github.com/jekyll/jekyll/blob/master/LICENSE).
jekyll-3.1.6/Rakefile 0000664 0000000 0000000 00000006046 12717414063 0014473 0 ustar 00root root 0000000 0000000 require 'rubygems'
require 'rake'
require 'rdoc'
require 'date'
require 'yaml'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
require 'jekyll/version'
Dir.glob('rake/**.rake').each { |f| import f }
#############################################################################
#
# Helper functions
#
#############################################################################
def name
"jekyll"
end
def version
Jekyll::VERSION
end
def docs_name
"#{name}-docs"
end
def gemspec_file
"#{name}.gemspec"
end
def gem_file
"#{name}-#{Gem::Version.new(version).to_s}.gem"
end
def normalize_bullets(markdown)
markdown.gsub(/\n\s{2}\*{1}/, "\n-")
end
def linkify_prs(markdown)
markdown.gsub(/#(\d+)/) do |word|
"[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
end
end
def linkify_users(markdown)
markdown.gsub(/(@\w+)/) do |username|
"[#{username}](https://github.com/#{username.delete("@")})"
end
end
def linkify(markdown)
linkify_users(linkify_prs(markdown))
end
def liquid_escape(markdown)
markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
end
def custom_release_header_anchors(markdown)
header_regexp = /^(\d{1,2})\.(\d{1,2})\.(\d{1,2}) \/ \d{4}-\d{2}-\d{2}/
section_regexp = /^### \w+ \w+$/
markdown.split(/^##\s/).map do |release_notes|
_, major, minor, patch = *release_notes.match(header_regexp)
release_notes
.gsub(header_regexp, "\\0\n{: #v\\1-\\2-\\3}")
.gsub(section_regexp) { |section| "#{section}\n{: ##{sluffigy(section)}-v#{major}-#{minor}-#{patch}}" }
end.join("\n## ")
end
def sluffigy(header)
header.gsub(/#/, '').strip.downcase.gsub(/\s+/, '-')
end
def remove_head_from_history(markdown)
index = markdown =~ /^##\s+\d+\.\d+\.\d+/
markdown[index..-1]
end
def converted_history(markdown)
remove_head_from_history(
custom_release_header_anchors(
liquid_escape(
linkify(
normalize_bullets(markdown)))))
end
#############################################################################
#
# Standard tasks
#
#############################################################################
multitask :default => [:test, :features]
task :spec => :test
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "#{name} #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.profile = "travis"
end
Cucumber::Rake::Task.new(:"features:html", "Run Cucumber features and produce HTML output") do |t|
t.profile = "html_report"
end
rescue LoadError
desc 'Cucumber rake task not available'
task :features do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r ./lib/#{name}.rb"
end
jekyll-3.1.6/benchmark/ 0000775 0000000 0000000 00000000000 12717414063 0014752 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/benchmark/end-with-vs-regexp 0000664 0000000 0000000 00000001226 12717414063 0020333 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
Benchmark.ips do |x|
path_without_ending_slash = '/some/very/very/long/path/to/a/file/i/like'
x.report('no slash regexp') { path_without_ending_slash =~ /\/$/ }
x.report('no slash end_with?') { path_without_ending_slash.end_with?("/") }
x.report('no slash [-1, 1]') { path_without_ending_slash[-1, 1] == "/" }
end
Benchmark.ips do |x|
path_with_ending_slash = '/some/very/very/long/path/to/a/file/i/like/'
x.report('slash regexp') { path_with_ending_slash =~ /\/$/ }
x.report('slash end_with?') { path_with_ending_slash.end_with?("/") }
x.report('slash [-1, 1]') { path_with_ending_slash[-1, 1] == "/" }
end
jekyll-3.1.6/benchmark/file-dir-ensure-trailing-slash 0000664 0000000 0000000 00000002402 12717414063 0022604 0 ustar 00root root 0000000 0000000 #!/usr/bin/env ruby
require 'benchmark/ips'
# For this pull request, which changes Page#dir
# https://github.com/jekyll/jekyll/pull/4403
FORWARD_SLASH = '/'.freeze
def pre_pr(url)
url[-1, 1] == FORWARD_SLASH ? url : File.dirname(url)
end
def pr(url)
if url.end_with?(FORWARD_SLASH)
url
else
url_dir = File.dirname(url)
url_dir.end_with?(FORWARD_SLASH) ? url_dir : "#{url_dir}/"
end
end
def envygeeks(url)
return url if url.end_with?(FORWARD_SLASH) || url == FORWARD_SLASH
url = File.dirname(url)
url == FORWARD_SLASH ? url : "#{url}/"
end
# Just a slash
Benchmark.ips do |x|
path = '/'
x.report("pre_pr:#{path}") { pre_pr(path) }
x.report("pr:#{path}") { pr(path) }
x.report("envygeeks:#{path}") { pr(path) }
x.compare!
end
# No trailing slash
Benchmark.ips do |x|
path = '/some/very/very/long/path/to/a/file/i/like'
x.report("pre_pr:#{path}") { pre_pr(path) }
x.report("pr:#{path}") { pr(path) }
x.report("envygeeks:#{path}") { pr(path) }
x.compare!
end
# No trailing slash
Benchmark.ips do |x|
path = '/some/very/very/long/path/to/a/file/i/like/'
x.report("pre_pr:#{path}") { pre_pr(path) }
x.report("pr:#{path}") { pr(path) }
x.report("envygeeks:#{path}") { pr(path) }
x.compare!
end
jekyll-3.1.6/benchmark/flat-map 0000664 0000000 0000000 00000000757 12717414063 0016407 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
enum = (0..50).to_a
nested = enum.map { |i| [i] }
def do_thing(blah)
blah * 1
end
Benchmark.ips do |x|
x.report('.map.flatten with nested arrays') { nested.map { |i| do_thing(i) }.flatten(1) }
x.report('.flat_map with nested arrays') { nested.flat_map { |i| do_thing(i) } }
x.report('.map.flatten with no nested arrays') { enum.map { |i| do_thing(i) }.flatten(1) }
x.report('.flat_map with no nested arrays') { enum.flat_map { |i| do_thing(i) } }
end
jekyll-3.1.6/benchmark/hash-fetch 0000664 0000000 0000000 00000000423 12717414063 0016706 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
h = {:bar => 'uco'}
Benchmark.ips do |x|
x.report('fetch with no block') { h.fetch(:bar, (0..9).to_a) }
x.report('fetch with a block') { h.fetch(:bar) { (0..9).to_a } }
x.report('brackets with an ||') { h[:bar] || (0..9).to_a }
end
jekyll-3.1.6/benchmark/jekyll-sanitize-path 0000664 0000000 0000000 00000003037 12717414063 0020750 0 ustar 00root root 0000000 0000000 #!/usr/bin/env ruby
require_relative '../lib/jekyll'
require 'benchmark/ips'
base_directory = Dir.pwd
Benchmark.ips do |x|
#
# Does not include the base_directory
#
x.report('with no questionable path') do
Jekyll.sanitized_path(base_directory, '')
end
x.report('with a single-part questionable path') do
Jekyll.sanitized_path(base_directory, 'thingy')
end
x.report('with a multi-part questionable path') do
Jekyll.sanitized_path(base_directory, 'thingy/in/my/soup')
end
x.report('with a single-part traversal path') do
Jekyll.sanitized_path(base_directory, '../thingy')
end
x.report('with a multi-part traversal path') do
Jekyll.sanitized_path(base_directory, '../thingy/in/my/../../soup')
end
#
# Including the base_directory
#
x.report('with the exact same paths') do
Jekyll.sanitized_path(base_directory, base_directory)
end
x.report('with a single-part absolute path including the base_directory') do
Jekyll.sanitized_path(base_directory, File.join(base_directory, 'thingy'))
end
x.report('with a multi-part absolute path including the base_directory') do
Jekyll.sanitized_path(base_directory, File.join(base_directory, 'thingy/in/my/soup'))
end
x.report('with a single-part traversal path including the base_directory') do
Jekyll.sanitized_path(base_directory, File.join(base_directory, 'thingy/..'))
end
x.report('with a multi-part traversal path including the base_directory') do
Jekyll.sanitized_path(base_directory, File.join('thingy/in/my/../../soup'))
end
end
jekyll-3.1.6/benchmark/proc-call-vs-yield 0000664 0000000 0000000 00000000312 12717414063 0020277 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
def fast
yield
end
def slow(&block)
block.call
end
Benchmark.ips do |x|
x.report('yield') { fast { (0..9).to_a } }
x.report('block.call') { slow { (0..9).to_a } }
end
jekyll-3.1.6/benchmark/sequential-assignment 0000664 0000000 0000000 00000000256 12717414063 0021220 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
Benchmark.ips do |x|
x.report('parallel assignment') do
a, b = 1, 2
end
x.report('multi-line assignment') do
a = 1
b = 2
end
end
jekyll-3.1.6/benchmark/string-concat 0000664 0000000 0000000 00000000217 12717414063 0017450 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
url = "http://jekyllrb.com"
Benchmark.ips do |x|
x.report('+=') { url += '/' }
x.report('<<') { url << '/' }
end
jekyll-3.1.6/benchmark/string-replacement 0000664 0000000 0000000 00000000556 12717414063 0020506 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
def str
'http://baruco.org/2014/some-talk-with-some-amount-of-value'
end
Benchmark.ips do |x|
x.report('#tr') { str.tr('some', 'a') }
x.report('#gsub') { str.gsub('some', 'a') }
x.report('#gsub!') { str.gsub!('some', 'a') }
x.report('#sub') { str.sub('some', 'a') }
x.report('#sub!') { str.sub!('some', 'a') }
end
jekyll-3.1.6/benchmark/symbol-to-proc 0000664 0000000 0000000 00000000225 12717414063 0017562 0 ustar 00root root 0000000 0000000 require 'benchmark/ips'
Benchmark.ips do |x|
x.report('block') { (1..100).map { |i| i.to_s } }
x.report('&:to_s') { (1..100).map(&:to_s) }
end
jekyll-3.1.6/bin/ 0000775 0000000 0000000 00000000000 12717414063 0013570 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/bin/jekyll 0000775 0000000 0000000 00000003343 12717414063 0015013 0 ustar 00root root 0000000 0000000 #!/usr/bin/env ruby
STDOUT.sync = true
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
require 'jekyll'
require 'mercenary'
Jekyll::PluginManager.require_from_bundler
Jekyll::Deprecator.process(ARGV)
Mercenary.program(:jekyll) do |p|
p.version Jekyll::VERSION
p.description 'Jekyll is a blog-aware, static site generator in Ruby'
p.syntax 'jekyll [options]'
p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
p.option 'safe', '--safe', 'Safe mode (defaults to false)'
p.option 'plugins_dir', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
p.option 'layouts_dir', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
p.option 'profile', '--profile', 'Generate a Liquid rendering profile'
Jekyll::External.require_if_present(Jekyll::External.blessed_gems) do |g|
cmd = g.split('-').last
p.command(cmd.to_sym) do |c|
c.syntax cmd
c.action do
Jekyll.logger.abort_with "You must install the '#{g}' gem to use the 'jekyll #{cmd}' command."
end
end
end
Jekyll::Command.subclasses.each { |c| c.init_with_program(p) }
p.action do |args, _|
if args.empty?
Jekyll.logger.error "A subcommand is required."
puts p
abort
else
subcommand = args.first
unless p.has_command? subcommand
Jekyll.logger.abort_with "fatal: 'jekyll #{args.first}' could not" \
" be found. You may need to install the jekyll-#{args.first} gem" \
" or a related gem to be able to use this subcommand."
end
end
end
end
jekyll-3.1.6/features/ 0000775 0000000 0000000 00000000000 12717414063 0014636 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/features/collections.feature 0000664 0000000 0000000 00000020255 12717414063 0020535 0 ustar 00root root 0000000 0000000 Feature: Collections
As a hacker who likes to structure content
I want to be able to create collections of similar information
And render them
Scenario: Unrendered collection
Given I have an "index.html" page that contains "Collections: {{ site.methods }}"
And I have fixture collections
And I have a configuration file with "collections" set to "['methods']"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections:
Use Jekyll.configuration to build a full configuration for use w/Jekyll.
\n\n
Whatever: foo.bar
\n
Signs are nice
\n
Jekyll.sanitized_path is used to make sure your path is in your source.
\n
Run your generators! default
\n
Page without title.
\n
Run your generators! default
" in "_site/index.html"
And the "_site/methods/configuration.html" file should not exist
Scenario: Rendered collection
Given I have an "index.html" page that contains "Collections: output => {{ site.collections[0].output }} label => {{ site.collections[0].label }}"
And I have an "collection_metadata.html" page that contains "Methods metadata: {{ site.collections[0].foo }} {{ site.collections[0] }}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
methods:
output: true
foo: bar
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: output => true" in "_site/index.html"
And I should see "label => methods" in "_site/index.html"
And I should see "Methods metadata: bar" in "_site/collection_metadata.html"
And I should see "
Whatever: foo.bar
" in "_site/methods/configuration.html"
Scenario: Rendered collection at a custom URL
Given I have an "index.html" page that contains "Collections: {{ site.collections }}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
methods:
output: true
permalink: /:collection/:path/
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "
Whatever: foo.bar
" in "_site/methods/configuration/index.html"
Scenario: Rendered document in a layout
Given I have an "index.html" page that contains "Collections: output => {{ site.collections[0].output }} label => {{ site.collections[0].label }} foo => {{ site.collections[0].foo }}"
And I have a default layout that contains "
Tom Preston-Werner
{{content}}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
methods:
output: true
foo: bar
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: output => true" in "_site/index.html"
And I should see "label => methods" in "_site/index.html"
And I should see "foo => bar" in "_site/index.html"
And I should see "
Run your generators! default
" in "_site/methods/site/generate.html"
And I should see "
Tom Preston-Werner
" in "_site/methods/site/generate.html"
Scenario: Collections specified as an array
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: Collections specified as an hash
Given I have an "index.html" page that contains "Collections: {% for method in site.methods %}{{ method.relative_path }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Collections: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: All the documents
Given I have an "index.html" page that contains "All documents: {% for doc in site.documents %}{{ doc.relative_path }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "All documents: _methods/configuration.md _methods/escape-\+ #%20\[\].md _methods/sanitized_path.md _methods/site/generate.md _methods/site/initialize.md _methods/um_hi.md" in "_site/index.html"
Scenario: Documents have an output attribute, which is the converted HTML
Given I have an "index.html" page that contains "First document's output: {{ site.documents.first.output }}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "First document's output:
Use Jekyll.configuration to build a full configuration for use w/Jekyll.
\n\n
Whatever: foo.bar
" in "_site/index.html"
Scenario: Filter documents by where
Given I have an "index.html" page that contains "{% assign items = site.methods | where: 'whatever','foo.bar' %}Item count: {{ items.size }}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Item count: 2" in "_site/index.html"
Scenario: Sort by title
Given I have an "index.html" page that contains "{% assign items = site.methods | sort: 'title' %}1. of {{ items.size }}: {{ items.first.output }}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "1. of 7:
Page without title.
" in "_site/index.html"
Scenario: Sort by relative_path
Given I have an "index.html" page that contains "Collections: {% assign methods = site.methods | sort: 'relative_path' %}{% for method in methods %}{{ method.title }}, {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
- methods
"""
When I run jekyll build
Then I should get a zero exit status
Then the _site directory should exist
And I should see "Collections: Jekyll.configuration, Jekyll.escape, Jekyll.sanitized_path, Site#generate, Initialize, Site#generate, YAML with Dots," in "_site/index.html"
Scenario: Rendered collection with date/dateless filename
Given I have an "index.html" page that contains "Collections: {% for method in site.thanksgiving %}{{ method.title }} {% endfor %}"
And I have fixture collections
And I have a "_config.yml" file with content:
"""
collections:
thanksgiving:
output: true
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Thanksgiving Black Friday" in "_site/index.html"
And I should see "Happy Thanksgiving" in "_site/thanksgiving/2015-11-26-thanksgiving.html"
And I should see "Black Friday" in "_site/thanksgiving/black-friday.html"
jekyll-3.1.6/features/create_sites.feature 0000664 0000000 0000000 00000022362 12717414063 0020672 0 ustar 00root root 0000000 0000000 Feature: Create sites
As a hacker who likes to blog
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
Scenario: Blank site
Given I do not have a "test_blank" directory
When I run jekyll new test_blank --blank
Then the test_blank/_layouts directory should exist
And the test_blank/_posts directory should exist
And the "test_blank/index.html" file should exist
Scenario: Basic site
Given I have an "index.html" file that contains "Basic Site"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site" in "_site/index.html"
Scenario: Basic site with a post
Given I have a _posts directory
And I have the following post:
| title | date | content |
| Hackers | 2009-03-27 | My First Exploit |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
Scenario: Basic site with layout and a page
Given I have a _layouts directory
And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
And I have a default layout that contains "Page Layout: {{ content }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
Scenario: Basic site with layout and a post
Given I have a _layouts directory
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout:
The only winning move is not to play.
" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layout inside a subfolder and a post
Given I have a _layouts directory
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | post/simple | The only winning move is not to play. |
And I have a post/simple layout that contains "Post Layout: {{ content }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout:
The only winning move is not to play.
" in "_site/2009/03/27/wargames.html"
Scenario: Basic site with layouts, pages, posts and files
Given I have a _layouts directory
And I have a page layout that contains "Page {{ page.title }}: {{ content }}"
And I have a post layout that contains "Post {{ page.title }}: {{ content }}"
And I have an "index.html" page with layout "page" that contains "Site contains {{ site.pages.size }} pages and {{ site.posts.size }} posts"
And I have a blog directory
And I have a "blog/index.html" page with layout "page" that contains "blog category index page"
And I have an "about.html" file that contains "No replacement {{ site.posts.size }}"
And I have an "another_file" file that contains ""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2009-03-27 | post | content for entry1. |
| entry2 | 2009-04-27 | post | content for entry2. |
And I have a category/_posts directory
And I have the following posts in "category":
| title | date | layout | content |
| entry3 | 2009-05-27 | post | content for entry3. |
| entry4 | 2009-06-27 | post | content for entry4. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
And I should see "" in "_site/another_file"
And I should see "Page : blog category index page" in "_site/blog/index.html"
And I should see "Post entry1:
content for entry1.
" in "_site/2009/03/27/entry1.html"
And I should see "Post entry2:
content for entry2.
" in "_site/2009/04/27/entry2.html"
And I should see "Post entry3:
content for entry3.
" in "_site/category/2009/05/27/entry3.html"
And I should see "Post entry4:
content for entry4.
" in "_site/category/2009/06/27/entry4.html"
Scenario: Basic site with include tag
Given I have a _includes directory
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with subdir include tag
Given I have a _includes directory
And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
And I have an info directory
And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html"
Scenario: Basic site with nested include tag
Given I have a _includes directory
And I have an "_includes/about.textile" file that contains "Generated by {% include jekyll.textile %}"
And I have an "_includes/jekyll.textile" file that contains "Jekyll"
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
Scenario: Basic site with internal post linking
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 _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2008-01-01 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "URL: /2008/01/01/entry2/" in "_site/index.html"
Scenario: Basic site with whitelisted dotfile
Given I have an ".htaccess" file that contains "SomeDirective"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "SomeDirective" in "_site/.htaccess"
Scenario: File was replaced by a directory
Given I have a "test" file that contains "some stuff"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
When I delete the file "test"
Given I have a test directory
And I have a "test/index.html" file that contains "some other stuff"
When I run jekyll build
Then the _site/test directory should exist
And I should see "some other stuff" in "_site/test/index.html"
Scenario: Basic site with unpublished page
Given I have an "index.html" page with title "index" that contains "Published page"
And I have a "public.html" page with published "true" that contains "Explicitly published page"
And I have a "secret.html" page with published "false" that contains "Unpublished page"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.html" file should exist
And the "_site/public.html" file should exist
But the "_site/secret.html" file should not exist
When I run jekyll build --unpublished
Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.html" file should exist
And the "_site/public.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 I should get a zero exit status
And the _site directory should exist
And I should see "content for entry2" in "_site/2007/12/31/entry2.html"
And the "_site/2020/12/31/entry1.html" file should not exist
When I run jekyll build --future
Then I should get a zero exit status
And the _site directory should exist
And the "_site/2020/12/31/entry1.html" file should exist
jekyll-3.1.6/features/data.feature 0000664 0000000 0000000 00000010512 12717414063 0017123 0 ustar 00root root 0000000 0000000 Feature: Data
In order to use well-formatted data in my blog
As a blog's user
I want to use _data directory in my site
Scenario: autoload *.yaml files in _data directory
Given I have a _data directory
And I have a "_data/products.yaml" file with content:
"""
- name: sugar
price: 5.3
- name: salt
price: 2.5
"""
And I have an "index.html" page that contains "{% for product in site.data.products %}{{product.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "sugar" in "_site/index.html"
And I should see "salt" in "_site/index.html"
Scenario: autoload *.yml files in _data directory
Given I have a _data directory
And I have a "_data/members.yml" file with content:
"""
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data.members %}{{member.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: autoload *.json files in _data directory
Given I have a _data directory
And I have a "_data/members.json" file with content:
"""
[{"name": "Jack", "age": 28},{"name": "Leon", "age": 34}]
"""
And I have an "index.html" page that contains "{% for member in site.data.members %}{{member.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: autoload *.csv files in _data directory
Given I have a _data directory
And I have a "_data/members.csv" file with content:
"""
name,age
Jack,28
Leon,34
"""
And I have an "index.html" page that contains "{% for member in site.data.members %}{{member.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: autoload *.yml files in _data directory with space in file name
Given I have a _data directory
And I have a "_data/team members.yml" file with content:
"""
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data.team_members %}{{member.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
Scenario: autoload *.yaml files in subdirectories in _data directory
Given I have a _data directory
And I have a _data/categories directory
And I have a "_data/categories/dairy.yaml" file with content:
"""
name: Dairy Products
"""
And I have an "index.html" page that contains "{{ site.data.categories.dairy.name }}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Dairy Products" in "_site/index.html"
Scenario: folders should have precedence over files with the same name
Given I have a _data directory
And I have a _data/categories directory
And I have a "_data/categories/dairy.yaml" file with content:
"""
name: Dairy Products
"""
And I have a "_data/categories.yaml" file with content:
"""
dairy:
name: Should not display this
"""
And I have an "index.html" page that contains "{{ site.data.categories.dairy.name }}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Dairy Products" in "_site/index.html"
Scenario: should be backward compatible with site.data in _config.yml
Given I have a "_config.yml" file with content:
"""
data:
- name: Jack
age: 28
- name: Leon
age: 34
"""
And I have an "index.html" page that contains "{% for member in site.data %}{{member.name}}{% endfor %}"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "Jack" in "_site/index.html"
And I should see "Leon" in "_site/index.html"
jekyll-3.1.6/features/drafts.feature 0000664 0000000 0000000 00000004260 12717414063 0017500 0 ustar 00root root 0000000 0000000 Feature: Draft Posts
As a hacker who likes to blog
I want to be able to preview drafts locally
In order to see if they look alright before publishing
Scenario: Preview a draft
Given I have a configuration file with "permalink" set to "none"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll build --drafts
Then I should get a zero exit status
And the _site directory should exist
And I should see "Not baked yet." in "_site/recipe.html"
Scenario: Don't preview a draft
Given I have a configuration file with "permalink" set to "none"
And I have an "index.html" page that contains "Totally index"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | content |
| Recipe | 2009-03-27 | default | Not baked yet. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/recipe.html" file should not exist
Scenario: Don't preview a draft that is not published
Given I have a configuration file with "permalink" set to "none"
And I have an "index.html" page that contains "Totally index"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | published | content |
| Recipe | 2009-03-27 | default | false | Not baked yet. |
When I run jekyll build --drafts
Then I should get a zero exit status
And the _site directory should exist
And the "_site/recipe.html" file should not exist
Scenario: Use page.path variable
Given I have a configuration file with "permalink" set to "none"
And I have a _drafts directory
And I have the following draft:
| title | date | layout | content |
| Recipe | 2009-03-27 | simple | Post path: {{ page.path }} |
When I run jekyll build --drafts
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post path: _drafts/recipe.markdown" in "_site/recipe.html"
jekyll-3.1.6/features/embed_filters.feature 0000664 0000000 0000000 00000012401 12717414063 0021015 0 ustar 00root root 0000000 0000000 Feature: Embed filters
As a hacker who likes to blog
I want to be able to transform text inside a post or page
In order to perform cool stuff in my posts
Scenario: Convert date to XML schema
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see today's date in "_site/2009/03/27/star-wars.html"
Scenario: Escape text for XML
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.title | xml_escape }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html"
Scenario: Calculate number of words
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ content | number_of_words }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "7" in "_site/2009/03/27/star-wars.html"
Scenario: Convert an array into a sentence
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | tags | content |
| Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
Scenario: Markdownify a given string
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. |
And I have a default layout that contains "By {{ '_Obi-wan_' | markdownify }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "By
Obi-wan
" in "_site/2009/03/27/star-wars.html"
Scenario: Sort by an arbitrary variable
Given I have a _layouts directory
And I have the following page:
| title | layout | value | content |
| Page-1 | default | 8 | Something |
And I have the following page:
| title | layout | value | content |
| Page-2 | default | 6 | Something |
And I have a default layout that contains "{{ site.pages | sort:'value' | map:'title' | join:', ' }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "Page-2, Page-1" in "_site/page-1.html"
And I should see exactly "Page-2, Page-1" in "_site/page-2.html"
Scenario: Sort pages by the title
Given I have a _layouts directory
And I have the following pages:
| title | layout | content |
| Dog | default | Run |
| Bird | default | Fly |
And I have the following page:
| layout | content |
| default | Jump |
And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "The rule of 3: Jump, Fly, Run," in "_site/bird.html"
Scenario: Sort pages by the title ordering pages without title last
Given I have a _layouts directory
And I have the following pages:
| title | layout | content |
| Dog | default | Run |
| Bird | default | Fly |
And I have the following page:
| layout | content |
| default | Jump |
And I have a default layout that contains "{% assign sorted_pages = site.pages | sort: 'title', 'last' %}The rule of {{ sorted_pages.size }}: {% for p in sorted_pages %}{{ p.content | strip_html | strip_newlines }}, {% endfor %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "The rule of 3: Fly, Run, Jump," in "_site/bird.html"
jekyll-3.1.6/features/frontmatter_defaults.feature 0000664 0000000 0000000 00000022550 12717414063 0022453 0 ustar 00root root 0000000 0000000 Feature: frontmatter defaults
Scenario: Use default for frontmatter variables internally
Given I have a _layouts directory
And I have a pretty layout that contains "THIS IS THE LAYOUT: {{content}}"
And I have a _posts directory
And I have the following post:
| title | date | content |
| default layout | 2013-09-11 | just some post |
And I have an "index.html" page with title "some title" that contains "just some page"
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {layout: "pretty"}}]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "THIS IS THE LAYOUT:
just some post
" in "_site/2013/09/11/default-layout.html"
And I should see "THIS IS THE LAYOUT: just some page" in "_site/index.html"
Scenario: Use default for frontmatter variables in Liquid
Given I have a _posts directory
And I have the following post:
| title | date | content |
| default data | 2013-09-11 |
{{page.custom}}
{{page.author}}
|
And I have an "index.html" page that contains "just {{page.custom}} by {{page.author}}"
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {custom: "some special data", author: "Ben"}}]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "
some special data
\n
Ben
" in "_site/2013/09/11/default-data.html"
And I should see "just some special data by Ben" in "_site/index.html"
Scenario: Override frontmatter defaults by path
Given I have a _layouts directory
And I have a root layout that contains "root: {{ content }}"
And I have a subfolder layout that contains "subfolder: {{ content }}"
And I have a _posts directory
And I have the following post:
| title | date | content |
| about | 2013-10-14 | info on {{page.description}} |
And I have a special/_posts directory
And I have the following post in "special":
| title | date | path | content |
| about | 2013-10-14 | local | info on {{page.description}} |
And I have an "index.html" page with title "overview" that contains "Overview for {{page.description}}"
And I have an "special/index.html" page with title "section overview" that contains "Overview for {{page.description}}"
And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "subfolder", description: "the special section"}}, {scope: {path: ""}, values: {layout: "root", description: "the webpage"}}]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "root:
info on the webpage
" in "_site/2013/10/14/about.html"
And I should see "subfolder:
info on the special section
" in "_site/special/2013/10/14/about.html"
And I should see "root: Overview for the webpage" in "_site/index.html"
And I should see "subfolder: Overview for the special section" in "_site/special/index.html"
Scenario: Use frontmatter variables by relative path
Given I have a _layouts directory
And I have a main layout that contains "main: {{ content }}"
And I have a _posts directory
And I have the following post:
| title | date | content |
| about | 2013-10-14 | content of site/2013/10/14/about.html |
And I have a special/_posts directory
And I have the following post in "special":
| title | date | path | content |
| about1 | 2013-10-14 | local | content of site/special/2013/10/14/about1.html |
| about2 | 2013-10-14 | local | content of site/special/2013/10/14/about2.html |
And I have a configuration file with "defaults" set to "[{scope: {path: "special"}, values: {layout: "main"}}, {scope: {path: "special/_posts"}, values: {layout: "main"}}, {scope: {path: "_posts"}, values: {layout: "main"}}]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "main:
content of site/2013/10/14/about.html
" in "_site/2013/10/14/about.html"
And I should see "main:
content of site/special/2013/10/14/about1.html
" in "_site/special/2013/10/14/about1.html"
And I should see "main:
content of site/special/2013/10/14/about2.html
" in "_site/special/2013/10/14/about2.html"
Scenario: Use frontmatter scopes for subdirectories
Given I have a _layouts directory
And I have a main layout that contains "main: {{ content }}"
And I have a _posts/en directory
And I have the following post under "en":
| title | date | content |
| helloworld | 2014-09-01 | {{page.lang}} is the current language |
And I have a _posts/de directory
And I have the following post under "de":
| title | date | content |
| hallowelt | 2014-09-01 | {{page.lang}} is the current language |
And I have a configuration file with "defaults" set to "[{scope: {path: "_posts/en"}, values: {layout: "main", lang: "en"}}, {scope: {path: "_posts/de"}, values: {layout: "main", lang: "de"}}]"
When I run jekyll build
Then the _site directory should exist
And I should see "main:
en is the current language
" in "_site/2014/09/01/helloworld.html"
And I should see "main:
de is the current language
" in "_site/2014/09/01/hallowelt.html"
Scenario: Override frontmatter defaults by type
Given I have a _posts directory
And I have the following post:
| title | date | content |
| this is a post | 2013-10-14 | blabla |
And I have an "index.html" page that contains "interesting stuff"
And I have a configuration file with "defaults" set to "[{scope: {path: "", type: "post"}, values: {permalink: "/post.html"}}, {scope: {path: "", type: "page"}, values: {permalink: "/page.html"}}, {scope: {path: ""}, values: {permalink: "/perma.html"}}]"
When I run jekyll build
Then I should see "blabla" in "_site/post.html"
And I should see "interesting stuff" in "_site/page.html"
But the "_site/perma.html" file should not exist
Scenario: Actual frontmatter overrides defaults
Given I have a _posts directory
And I have the following post:
| title | date | permalink | author | content |
| override | 2013-10-14 | /frontmatter.html | some guy | a blog by {{page.author}} |
And I have an "index.html" page with permalink "override.html" that contains "nothing"
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {permalink: "/perma.html", author: "Chris"}}]"
When I run jekyll build
Then I should see "a blog by some guy" in "_site/frontmatter.html"
And I should see "nothing" in "_site/override.html"
But the "_site/perma.html" file should not exist
Scenario: Define permalink default for posts
Given I have a _posts directory
And I have the following post:
| title | date | category | content |
| testpost | 2013-10-14 | blog | blabla |
And I have a configuration file with "defaults" set to "[{scope: {path: "", type: "posts"}, values: {permalink: "/:categories/:title/"}}]"
When I run jekyll build
Then I should see "blabla" in "_site/blog/testpost/index.html"
Scenario: Use frontmatter defaults in collections
Given I have a _slides directory
And I have a "index.html" file that contains "nothing"
And I have a "_slides/slide1.html" file with content:
"""
---
---
Value: {{ page.myval }}
"""
And I have a "_config.yml" file with content:
"""
collections:
slides:
output: true
defaults:
-
scope:
path: ""
type: slides
values:
myval: "Test"
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Value: Test" in "_site/slides/slide1.html"
Scenario: Override frontmatter defaults inside a collection
Given I have a _slides directory
And I have a "index.html" file that contains "nothing"
And I have a "_slides/slide2.html" file with content:
"""
---
myval: Override
---
Value: {{ page.myval }}
"""
And I have a "_config.yml" file with content:
"""
collections:
slides:
output: true
defaults:
-
scope:
path: ""
type: slides
values:
myval: "Test"
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Value: Override" in "_site/slides/slide2.html"
Scenario: Deep merge frontmatter defaults
Given I have an "index.html" page with fruit "{orange: 1}" that contains "Fruits: {{ page.fruit.orange | plus: page.fruit.apple }}"
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {fruit: {apple: 2}}}]"
When I run jekyll build
Then I should see "Fruits: 3" in "_site/index.html"
jekyll-3.1.6/features/hooks.feature 0000664 0000000 0000000 00000027401 12717414063 0017342 0 ustar 00root root 0000000 0000000 Feature: Hooks
As a plugin author
I want to be able to run code during various stages of the build process
Scenario: Run some code after site reset
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :site, :after_reset do |site|
pageklass = Class.new(Jekyll::Page) do
def initialize(site, base)
@site = site
@base = base
@data = {}
@dir = '/'
@name = 'foo.html'
@content = 'mytinypage'
self.process(@name)
end
end
site.pages << pageklass.new(site, site.source)
end
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "mytinypage" in "_site/foo.html"
Scenario: Modify the payload before rendering the site
Given I have a _plugins directory
And I have a "index.html" page that contains "{{ site.injected }}!"
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :site, :pre_render do |site, payload|
payload['site']['injected'] = 'myparam'
end
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "myparam!" in "_site/index.html"
Scenario: Modify the site contents after reading
Given I have a _plugins directory
And I have a "page1.html" page that contains "page1"
And I have a "page2.html" page that contains "page2"
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :site, :post_read do |site|
site.pages.delete_if { |p| p.name == 'page1.html' }
end
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/page1.html" file should not exist
And I should see "page2" in "_site/page2.html"
Scenario: Work with the site files after they've been written to disk
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :site, :post_write do |site|
firstpage = site.pages.first
content = File.read firstpage.destination(site.dest)
File.write(File.join(site.dest, 'firstpage.html'), content)
end
"""
And I have a "page1.html" page that contains "page1"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "page1" in "_site/firstpage.html"
Scenario: Alter a page right after it is initialized
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :pages, :post_init do |page|
page.name = 'renamed.html'
page.process(page.name)
end
"""
And I have a "page1.html" page that contains "page1"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "page1" in "_site/renamed.html"
Scenario: Alter the payload for one page but not another
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :pages, :pre_render do |page, payload|
payload['page']['myparam'] = 'special' if page.name == 'page1.html'
end
"""
And I have a "page1.html" page that contains "{{ page.myparam }}"
And I have a "page2.html" page that contains "{{ page.myparam }}"
When I run jekyll build
Then I should see "special" in "_site/page1.html"
And I should not see "special" in "_site/page2.html"
Scenario: Modify page contents before writing to disk
Given I have a _plugins directory
And I have a "index.html" page that contains "WRAP ME"
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :pages, :post_render do |page|
page.output = "{{{{{ #{page.output.chomp} }}}}}"
end
"""
When I run jekyll build
Then I should see "{{{{{ WRAP ME }}}}}" in "_site/index.html"
Scenario: Work with a page after writing it to disk
Given I have a _plugins directory
And I have a "index.html" page that contains "HELLO FROM A PAGE"
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :pages, :post_write do |page|
require 'fileutils'
filename = page.destination(page.site.dest)
FileUtils.mv(filename, "#{filename}.moved")
end
"""
When I run jekyll build
Then I should see "HELLO FROM A PAGE" in "_site/index.html.moved"
Scenario: Alter a post right after it is initialized
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :posts, :post_init do |post|
post.data['harold'] = "content for entry1.".tr!('abcdefghijklmnopqrstuvwxyz',
'nopqrstuvwxyzabcdefghijklm')
end
"""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2015-03-14 | nil | {{ page.harold }} |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "pbagrag sbe ragel1." in "_site/2015/03/14/entry1.html"
Scenario: Alter the payload for certain posts
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
# Add myvar = 'old' to posts before 2015-03-15, and myvar = 'new' for
# others
Jekyll::Hooks.register :posts, :pre_render do |post, payload|
if post.date < Time.new(2015, 3, 15)
payload['myvar'] = 'old'
else
payload['myvar'] = 'new'
end
end
"""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2015-03-14 | nil | {{ myvar }} post |
| entry2 | 2015-03-15 | nil | {{ myvar }} post |
When I run jekyll build
Then I should see "old post" in "_site/2015/03/14/entry1.html"
And I should see "new post" in "_site/2015/03/15/entry2.html"
Scenario: Modify post contents before writing to disk
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
# Replace content after rendering
Jekyll::Hooks.register :posts, :post_render do |post|
post.output.gsub! /42/, 'the answer to life, the universe and everything'
end
"""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2015-03-14 | nil | {{ 6 \| times: 7 }} |
| entry2 | 2015-03-15 | nil | {{ 6 \| times: 8 }} |
When I run jekyll build
Then I should see "the answer to life, the universe and everything" in "_site/2015/03/14/entry1.html"
And I should see "48" in "_site/2015/03/15/entry2.html"
Scenario: Work with a post after writing it to disk
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
# Log all post filesystem writes
Jekyll::Hooks.register :posts, :post_write do |post|
filename = post.destination(post.site.dest)
open('_site/post-build.log', 'a') do |f|
f.puts "Wrote #{filename} at #{Time.now}"
end
end
"""
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2015-03-14 | nil | entry one |
| entry2 | 2015-03-15 | nil | entry two |
When I run jekyll build
Then I should see "_site/2015/03/14/entry1.html at" in "_site/post-build.log"
Then I should see "_site/2015/03/15/entry2.html at" in "_site/post-build.log"
Scenario: Register a hook on multiple owners at the same time
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register [:pages, :posts], :post_render do |owner|
owner.output = "{{{{{ #{owner.output.chomp} }}}}}"
end
"""
And I have a "index.html" page that contains "WRAP ME"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2015-03-14 | nil | entry one |
When I run jekyll build
Then I should see "{{{{{ WRAP ME }}}}}" in "_site/index.html"
And I should see "{{{{{
entry one
}}}}}" in "_site/2015/03/14/entry1.html"
Scenario: Allow hooks to have a named priority
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :pages, :post_render, priority: :normal do |owner|
# first normal runs second
owner.output = "1 #{owner.output.chomp}"
end
Jekyll::Hooks.register :pages, :post_render, priority: :high do |owner|
# high runs last
owner.output = "2 #{owner.output.chomp}"
end
Jekyll::Hooks.register :pages, :post_render do |owner|
# second normal runs third (normal is default)
owner.output = "3 #{owner.output.chomp}"
end
Jekyll::Hooks.register :pages, :post_render, priority: :low do |owner|
# low runs first
owner.output = "4 #{owner.output.chomp}"
end
"""
And I have a "index.html" page that contains "WRAP ME"
When I run jekyll build
Then I should see "2 3 1 4 WRAP ME" in "_site/index.html"
Scenario: Alter a document right after it is initialized
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :documents, :pre_render do |doc, payload|
doc.data['text'] = doc.data['text'] << ' are belong to us'
end
"""
And I have a "_config.yml" file that contains "collections: [ memes ]"
And I have a _memes directory
And I have a "_memes/doc1.md" file with content:
"""
---
text: all your base
---
"""
And I have an "index.md" file with content:
"""
---
---
{{ site.memes.first.text }}
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "all your base are belong to us" in "_site/index.html"
Scenario: Update a document after rendering it, but before writing it to disk
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :documents, :post_render do |doc|
doc.output.gsub! /
/, '
'
end
"""
And I have a "_config.yml" file with content:
"""
collections:
memes:
output: true
"""
And I have a _memes directory
And I have a "_memes/doc1.md" file with content:
"""
---
text: all your base are belong to us
---
{{ page.text }}
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "
all your base are belong to us" in "_site/memes/doc1.html"
Scenario: Perform an action after every document is written
Given I have a _plugins directory
And I have a "_plugins/ext.rb" file with content:
"""
Jekyll::Hooks.register :documents, :post_write do |doc|
open('_site/document-build.log', 'a') do |f|
f.puts "Wrote document #{doc.collection.docs.index doc} at #{Time.now}"
end
end
"""
And I have a "_config.yml" file with content:
"""
collections:
memes:
output: true
"""
And I have a _memes directory
And I have a "_memes/doc1.md" file with content:
"""
---
text: all your base are belong to us
---
{{ page.text }}
"""
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Wrote document 0" in "_site/document-build.log"
jekyll-3.1.6/features/include_tag.feature 0000664 0000000 0000000 00000015777 12717414063 0020512 0 ustar 00root root 0000000 0000000 Feature: Include tags
In order to share their content across several pages
As a hacker who likes to blog
I want to be able to include files in my blog posts
Scenario: Include a file with parameters
Given I have an _includes directory
And I have an "_includes/header.html" file that contains "My awesome blog header: {{include.param}}"
And I have an "_includes/params.html" file that contains "Parameters:
{% for param in include %}
{{param[0]}} = {{param[1]}}
{% endfor %}
"
And I have an "_includes/ignore.html" file that contains ""
And I have a _posts directory
And I have the following posts:
| title | date | type | content |
| Include Files | 2013-03-21 | html | {% include header.html param="myparam" %} |
| Ignore params if unused | 2013-03-21 | html | {% include ignore.html date="today" %} |
| List multiple parameters | 2013-03-21 | html | {% include params.html date="today" start="tomorrow" %} |
| Dont keep parameters | 2013-03-21 | html | {% include ignore.html param="test" %}\n{% include header.html %} |
| Allow params with spaces and quotes | 2013-04-07 | html | {% include params.html cool="param with spaces" super="\\"quoted\\"" single='has "quotes"' escaped='\\'single\\' quotes' %} |
| Parameter syntax | 2013-04-12 | html | {% include params.html param1_or_2="value" %} |
| Pass a variable | 2013-06-22 | html | {% assign var = 'some text' %}{% include params.html local=var title=page.title %} |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "My awesome blog header: myparam" in "_site/2013/03/21/include-files.html"
And I should not see "myparam" in "_site/2013/03/21/ignore-params-if-unused.html"
And I should see "
date = today
" in "_site/2013/03/21/list-multiple-parameters.html"
And I should see "
start = tomorrow
" in "_site/2013/03/21/list-multiple-parameters.html"
And I should not see "My awesome blog header: myparam" in "_site/2013/03/21/dont-keep-parameters.html"
But I should see "My awesome blog header: " in "_site/2013/03/21/dont-keep-parameters.html"
And I should see "
cool = param with spaces
" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "
super = \"quoted\"
" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "
single = has \"quotes\"
" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "
escaped = 'single' quotes
" in "_site/2013/04/07/allow-params-with-spaces-and-quotes.html"
And I should see "
param1_or_2 = value
" in "_site/2013/04/12/parameter-syntax.html"
And I should see "
local = some text
" in "_site/2013/06/22/pass-a-variable.html"
And I should see "
title = Pass a variable
" in "_site/2013/06/22/pass-a-variable.html"
Scenario: Include a file from a variable
Given I have an _includes directory
And I have an "_includes/snippet.html" file that contains "a snippet"
And I have an "_includes/parametrized.html" file that contains "works with {{include.what}}"
And I have a configuration file with:
| key | value |
| include_file1 | snippet.html |
| include_file2 | parametrized.html |
And I have an "index.html" page that contains "{% include {{site.include_file1}} %} that {% include {{site.include_file2}} what='parameters' %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "a snippet that works with parameters" in "_site/index.html"
Scenario: Include a variable file in a loop
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "one"
And I have an "_includes/two.html" file that contains "two"
And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "one two" in "_site/index.html"
Scenario: Include a file with variables and filters
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "one included"
And I have a configuration file with:
| key | value |
| include_file | one |
And I have an "index.html" page that contains "{% include {{ site.include_file | append: '.html' }} %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "one included" in "_site/index.html"
Scenario: Include a file with partial variables
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "one included"
And I have a configuration file with:
| key | value |
| include_file | one |
And I have an "index.html" page that contains "{% include {{ site.include_file }}.html %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "one included" in "_site/index.html"
Scenario: Include a file and rebuild when include content is changed
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "include"
And I have an "index.html" page that contains "{% include one.html %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "include" in "_site/index.html"
When I wait 1 second
Then I have an "_includes/one.html" file that contains "include content changed"
When I run jekyll build
Then I should see "include content changed" in "_site/index.html"
Scenario: Include a file with multiple variables
Given I have an _includes directory
And I have an "_includes/header-en.html" file that contains "include"
And I have an "index.html" page that contains "{% assign name = 'header' %}{% assign locale = 'en' %}{% include {{name}}-{{locale}}.html %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "include" in "_site/index.html"
jekyll-3.1.6/features/incremental_rebuild.feature 0000664 0000000 0000000 00000006334 12717414063 0022230 0 ustar 00root root 0000000 0000000 Feature: Incremental rebuild
As an impatient hacker who likes to blog
I want to be able to make a static site
Without waiting too long for it to build
Scenario: Produce correct output site
Given I have a _layouts directory
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
And I have a default layout that contains "Post Layout: {{ content }}"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout:
The only winning move is not to play.
" in "_site/2009/03/27/wargames.html"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post Layout:
The only winning move is not to play.
" in "_site/2009/03/27/wargames.html"
Scenario: Generate a metadata file
Given I have an "index.html" file that contains "Basic Site"
When I run jekyll build -I
Then the ".jekyll-metadata" file should exist
Scenario: Rebuild when content is changed
Given I have an "index.html" file that contains "Basic Site"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site" in "_site/index.html"
When I wait 1 second
Then I have an "index.html" file that contains "Bacon Site"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Bacon Site" in "_site/index.html"
Scenario: Rebuild when layout is changed
Given I have a _layouts directory
And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
And I have a default layout that contains "Page Layout: {{ content }}"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
When I wait 1 second
Then I have a default layout that contains "Page Layout Changed: {{ content }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout Changed: Basic Site with Layout" in "_site/index.html"
Scenario: Rebuild when an include is changed
Given I have a _includes directory
And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
When I wait 1 second
Then I have an "_includes/about.textile" file that contains "Regenerated by Jekyll"
When I run jekyll build -I
Then I should get a zero exit status
And the _site directory should exist
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"
jekyll-3.1.6/features/layout_data.feature 0000664 0000000 0000000 00000004435 12717414063 0020527 0 ustar 00root root 0000000 0000000 Feature: Layout data
As a hacker who likes to avoid repetition
I want to be able to embed data into my layouts
In order to make the layouts slightly dynamic
Scenario: Use custom layout data
Given I have a _layouts directory
And I have a "_layouts/custom.html" file with content:
"""
---
foo: my custom data
---
{{ content }} foo: {{ layout.foo }}
"""
And I have an "index.html" page with layout "custom" that contains "page content"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "page content\n foo: my custom data" in "_site/index.html"
Scenario: Inherit custom layout data
Given I have a _layouts directory
And I have a "_layouts/custom.html" file with content:
"""
---
layout: base
foo: my custom data
---
{{ content }}
"""
And I have a "_layouts/base.html" file with content:
"""
{{ content }} foo: {{ layout.foo }}
"""
And I have an "index.html" page with layout "custom" that contains "page content"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "page content\n foo: my custom data" in "_site/index.html"
Scenario: Inherit custom layout data and clear when not present
Given I have a _layouts directory
And I have a "_layouts/default.html" file with content:
"""
---
bar: i'm default
---
{{ content }} foo: '{{ layout.foo }}' bar: '{{ layout.bar }}'
"""
And I have a "_layouts/special.html" file with content:
"""
---
layout: default
foo: my special data
bar: im special
---
{{ content }}
"""
And I have a "_layouts/page.html" file with content:
"""
---
layout: default
bar: im page
---
{{ content }}
"""
And I have an "index.html" page with layout "special" that contains "page content"
And I have an "jekyll.html" page with layout "page" that contains "page content"
When I run jekyll build
Then the "_site/index.html" file should exist
And I should see "page content\n foo: 'my special data' bar: 'im special'" in "_site/index.html"
And I should see "page content\n foo: '' bar: 'im page'" in "_site/jekyll.html"
jekyll-3.1.6/features/markdown.feature 0000664 0000000 0000000 00000003143 12717414063 0020036 0 ustar 00root root 0000000 0000000 Feature: Markdown
As a hacker who likes to blog
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
Scenario: Markdown in list on index
Given I have a configuration file with "paginate" set to "5"
And I have an "index.html" page that contains "Index - {% for post in site.posts %} {{ post.content }} {% endfor %}"
And I have a _posts directory
And I have the following post:
| title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Index" in "_site/index.html"
And I should see "
My Title
" in "_site/2009/03/27/hackers.html"
And I should see "
My Title
" in "_site/index.html"
Scenario: Markdown in pagination on index
Given I have a configuration file with:
| key | value |
| paginate | 5 |
| gems | [jekyll-paginate] |
And I have an "index.html" page that contains "Index - {% for post in paginator.posts %} {{ post.content }} {% endfor %}"
And I have a _posts directory
And I have the following post:
| title | date | content | type |
| Hackers | 2009-03-27 | # My Title | markdown |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Index" in "_site/index.html"
And I should see "
My Title
" in "_site/index.html"
jekyll-3.1.6/features/pagination.feature 0000664 0000000 0000000 00000010445 12717414063 0020350 0 ustar 00root root 0000000 0000000 Feature: Site pagination
In order to paginate my blog
As a blog's user
I want divide the posts in several pages
Scenario Outline: Paginate with N posts per page
Given I have a configuration file with:
| key | value |
| paginate | |
| gems | [jekyll-paginate] |
And I have a _layouts directory
And I have an "index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
When I run jekyll build
Then the _site/page directory should exist
And the "_site/page/index.html" file should exist
And I should see "" in "_site/page/index.html"
And the "_site/page/index.html" file should not exist
Examples:
| num | exist | posts | not_exist |
| 1 | 4 | 1 | 5 |
| 2 | 2 | 2 | 3 |
| 3 | 2 | 1 | 3 |
Scenario Outline: Setting a custom pagination path
Given I have a configuration file with:
| key | value |
| paginate | 1 |
| paginate_path | /blog/page-:num |
| permalink | /blog/:year/:month/:day/:title |
| gems | [jekyll-paginate] |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
When I run jekyll build
Then the _site/blog/page- directory should exist
And the "_site/blog/page-/index.html" file should exist
And I should see "" in "_site/blog/page-/index.html"
And the "_site/blog/page-/index.html" file should not exist
Examples:
| exist | posts | not_exist |
| 2 | 1 | 5 |
| 3 | 1 | 6 |
| 4 | 1 | 7 |
Scenario Outline: Setting a custom pagination path without an index.html in it
Given I have a configuration file with:
| key | value |
| paginate | 1 |
| paginate_path | /blog/page/:num |
| permalink | /blog/:year/:month/:day/:title |
| gems | [jekyll-paginate] |
And I have a blog directory
And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}"
And I have an "index.html" page that contains "Don't pick me!"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| Wargames | 2009-03-27 | default | The only winning move is not to play. |
| Wargames2 | 2009-04-27 | default | The only winning move is not to play2. |
| Wargames3 | 2009-05-27 | default | The only winning move is not to play3. |
| Wargames4 | 2009-06-27 | default | The only winning move is not to play4. |
When I run jekyll build
Then the _site/blog/page/ directory should exist
And the "_site/blog/page//index.html" file should exist
And I should see "" in "_site/blog/page//index.html"
And the "_site/blog/page//index.html" file should not exist
Examples:
| exist | posts | not_exist |
| 2 | 1 | 5 |
| 3 | 1 | 6 |
| 4 | 1 | 7 |
jekyll-3.1.6/features/permalinks.feature 0000664 0000000 0000000 00000015770 12717414063 0020372 0 ustar 00root root 0000000 0000000 Feature: Fancy permalinks
As a hacker who likes to blog
I want to be able to set permalinks
In order to make my blog URLs awesome
Scenario: Use none permalink schema
Given I have a _posts directory
And I have the following post:
| title | date | content |
| None Permalink Schema | 2009-03-27 | Totally nothing. |
And I have a configuration file with "permalink" set to "none"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally nothing." in "_site/none-permalink-schema.html"
Scenario: Use pretty permalink schema
Given I have a _posts directory
And I have the following post:
| title | date | content |
| Pretty Permalink Schema | 2009-03-27 | Totally wordpress. |
And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
Scenario: Use pretty permalink schema for pages
Given I have an "index.html" page that contains "Totally index"
And I have an "awesome.html" page that contains "Totally awesome"
And I have an "sitemap.xml" page that contains "Totally uhm, sitemap"
And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally index" in "_site/index.html"
And I should see "Totally awesome" in "_site/awesome/index.html"
And I should see "Totally uhm, sitemap" in "_site/sitemap.xml"
Scenario: Use custom permalink schema with prefix
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title/"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html"
Scenario: Use custom permalink schema with category
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/:categories/:title.html"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html"
Scenario: Use custom permalink schema with squished date
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. |
And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
Scenario: Use custom permalink schema with date and time
Given I have a _posts directory
And I have the following post:
| title | category | date | content |
| Custom Permalink Schema | stuff | 2009-03-27 22:31:07 | Totally custom. |
And I have a configuration file with:
| key | value |
| permalink | "/:year:month:day:hour:minute:second.html" |
| timezone | UTC |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally custom." in "_site/20090327223107.html"
Scenario: Use per-post permalink
Given I have a _posts directory
And I have the following post:
| title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/1/ | bla bla |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the _site/custom/posts/1 directory should exist
And I should see "bla bla" in "_site/custom/posts/1/index.html"
Scenario: Use per-post ending in .html
Given I have a _posts directory
And I have the following post:
| title | date | permalink | content |
| Some post | 2013-04-14 | /custom/posts/some.html | bla bla |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the _site/custom/posts directory should exist
And I should see "bla bla" in "_site/custom/posts/some.html"
Scenario: Use pretty permalink schema with cased file name
Given I have a _posts directory
And I have an "_posts/2009-03-27-Pretty-Permalink-Schema.md" page that contains "Totally wordpress"
And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally wordpress." in "_site/2009/03/27/Pretty-Permalink-Schema/index.html"
Scenario: Use custom permalink schema with cased file name
Given I have a _posts directory
And I have an "_posts/2009-03-27-Custom-Schema.md" page with title "Custom Schema" that contains "Totally awesome"
And I have a configuration file with "permalink" set to "/:year/:month/:day/:slug/"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally awesome" in "_site/2009/03/27/custom-schema/index.html"
Scenario: Use pretty permalink schema with title containing underscore
Given I have a _posts directory
And I have an "_posts/2009-03-27-Custom_Schema.md" page with title "Custom Schema" that contains "Totally awesome"
And I have a configuration file with "permalink" set to "pretty"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Totally awesome" in "_site/2009/03/27/Custom_Schema/index.html"
Scenario: Use a non-HTML file extension in the permalink
Given I have a _posts directory
And I have an "_posts/2016-01-18-i-am-php.md" page with permalink "/2016/i-am-php.php" that contains "I am PHP"
And I have a "i-am-also-php.md" page with permalink "/i-am-also-php.php" that contains "I am also PHP"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "I am PHP" in "_site/2016/i-am-php.php"
And I should see "I am also PHP" in "_site/i-am-also-php.php"
jekyll-3.1.6/features/plugins.feature 0000664 0000000 0000000 00000003247 12717414063 0017702 0 ustar 00root root 0000000 0000000 Feature: Configuring and using plugins
As a hacker
I want to specify my own plugins that can modify Jekyll's behaviour
Scenario: Add a gem-based plugin
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And I should see "this is a test" in "_site/test.txt"
Scenario: Add an empty whitelist to restrict all gems
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with:
| key | value |
| gems | [jekyll_test_plugin] |
| whitelist | [] |
When I run jekyll build --safe
Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And the "_site/test.txt" file should not exist
Scenario: Add a whitelist to restrict some gems but allow others
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with:
| key | value |
| gems | [jekyll_test_plugin, jekyll_test_plugin_malicious] |
| whitelist | [jekyll_test_plugin] |
When I run jekyll build --safe
Then I should get a zero exit status
And the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And the "_site/test.txt" file should exist
And I should see "this is a test" in "_site/test.txt"
jekyll-3.1.6/features/post_data.feature 0000664 0000000 0000000 00000041146 12717414063 0020177 0 ustar 00root root 0000000 0000000 Feature: Post data
As a hacker who likes to blog
I want to be able to embed data into my posts
In order to make the posts slightly dynamic
Scenario: Use post.title variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post title: {{ page.title }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.url variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post url: {{ page.url }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.date variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post date: 27 Mar 2009" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.date variable with invalid
Given I have a _posts directory
And I have a "_posts/2016-01-01-test.md" page with date "tuesday" that contains "I have a bad date."
When I run jekyll build
Then the _site directory should not exist
And I should see "Document '_posts/2016-01-01-test.md' does not have a valid date in the YAML front matter." in the build output
Scenario: Invalid date in filename
Given I have a _posts directory
And I have a "_posts/2016-22-01-test.md" page that contains "I have a bad date."
When I run jekyll build
Then the _site directory should not exist
And I should see "Document '_posts/2016-22-01-test.md' does not have a valid date in the filename." in the build output
Scenario: Use post.id variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post id: {{ page.id }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.content variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post content: {{ content }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post content:
Luke, I am your father.
" in "_site/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder
Given I have a movies directory
And I have a movies/_posts directory
And I have a _layouts directory
And I have the following post in "movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and has category in YAML
Given I have a movies directory
And I have a movies/_posts directory
And I have a _layouts directory
And I have the following post in "movies":
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | film | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and has categories in YAML
Given I have a movies directory
And I have a movies/_posts directory
And I have a _layouts directory
And I have the following post in "movies":
| title | date | layout | categories | content |
| Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML
Given I have a movies directory
And I have a movies/_posts directory
And I have a _layouts directory
And I have the following post in "movies":
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.tags variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | tag | content |
| Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. |
And I have a simple layout that contains "Post tags: {{ page.tags }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html"
Scenario: Use post.categories variable when categories are in folders
Given I have a scifi directory
And I have a scifi/movies directory
And I have a scifi/movies/_posts directory
And I have a _layouts directory
And I have the following post in "scifi/movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in folders with mixed case
Given I have a scifi directory
And I have a scifi/Movies directory
And I have a scifi/Movies/_posts directory
And I have a _layouts directory
And I have the following post in "scifi/Movies":
| title | date | layout | content |
| Star Wars | 2009-03-27 | simple | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when category is in YAML and is mixed-case
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | category | content |
| Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: Movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | categories | content |
| Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML and are duplicated
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | categories | content |
| Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. |
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Superdirectories of _posts applied to post.categories
Given I have a movies/_posts directory
And I have a "movies/_posts/2009-03-27-star-wars.html" page with layout "simple" that contains "hi"
And I have a _layouts directory
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Subdirectories of _posts not applied to post.categories
Given I have a movies/_posts/scifi directory
And I have a "movies/_posts/scifi/2009-03-27-star-wars.html" page with layout "simple" that contains "hi"
And I have a _layouts directory
And I have a simple layout that contains "Post category: {{ page.categories }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
Scenario: Use post.categories variable when categories are in YAML with mixed case
Given I have a _posts directory
And I have a _layouts directory
And I have the following posts:
| title | date | layout | categories | content |
| Star Wars | 2009-03-27 | simple | ['scifi', 'Movies'] | Luke, I am your father. |
| Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. |
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post categories: scifi and Movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
And I should see "Post categories: SciFi and movies" in "_site/scifi/movies/2013/03/17/star-trek.html"
Scenario Outline: Use page.path variable
Given I have a /_posts directory
And I have the following post in "":
| title | type | date | content |
| my-post | html | 2013-04-12 | Source path: {{ page.path }} |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Source path: _posts/2013-04-12-my-post.html" in "_site//2013/04/12/my-post.html"
Examples:
| dir | path_prefix |
| . | |
| dir | dir/ |
| dir/nested | dir/nested/ |
Scenario: Cannot override page.path variable
Given I have a _posts directory
And I have the following post:
| title | date | path | content |
| override | 2013-04-12 | override-path.html | Non-custom path: {{ page.path }} |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Non-custom path: _posts/2013-04-12-override.markdown" in "_site/2013/04/12/override.html"
Scenario: Disable a post from being published
Given I have a _posts directory
And I have an "index.html" file that contains "Published!"
And I have the following post:
| title | date | layout | published | content |
| Star Wars | 2009-03-27 | simple | false | Luke, I am your father. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/2009/03/27/star-wars.html" file should not exist
And I should see "Published!" in "_site/index.html"
Scenario: Use a custom variable
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | author | content |
| Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. |
And I have a simple layout that contains "Post author: {{ page.author }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html"
Scenario: Use a variable which is a reserved keyword in Ruby
Given I have a _posts directory
And I have a _layouts directory
And I have the following post:
| title | date | layout | class | content |
| My post | 2016-01-21 | simple | kewl-post | Luke, I am your father. |
And I have a simple layout that contains "{{page.title}} has class {{page.class}}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "My post has class kewl-post" in "_site/2016/01/21/my-post.html"
Scenario: Previous and next posts title
Given I have a _posts directory
And I have a _layouts directory
And I have the following posts:
| title | date | layout | author | content |
| Star Wars | 2009-03-27 | ordered | Darth Vader | Luke, I am your father. |
| Some like it hot | 2009-04-27 | ordered | Osgood | Nobody is perfect. |
| Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby |
And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "next post: Some like it hot" in "_site/2009/03/27/star-wars.html"
And I should see "Previous post: Some like it hot" in "_site/2009/05/27/terminator.html"
jekyll-3.1.6/features/post_excerpts.feature 0000664 0000000 0000000 00000005264 12717414063 0021124 0 ustar 00root root 0000000 0000000 Feature: Post excerpts
As a hacker who likes to blog
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
But some people can only focus for a few moments
So just give them a taste
Scenario: An excerpt without a layout
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see exactly "
content for entry1.
" in "_site/index.html"
Scenario: An excerpt from a post with a layout
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have a _layouts directory
And I have a post layout that contains "{{ page.excerpt }}"
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the _site/2007 directory should exist
And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist
And the "_site/2007/12/31/entry1.html" file should exist
And I should see exactly "
content for entry1.
" in "_site/2007/12/31/entry1.html"
And I should see exactly "
content for entry1.
" in "_site/index.html"
Scenario: An excerpt from a post with a layout which has context
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have a _layouts directory
And I have a post layout that contains "{{ page.excerpt }}"
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the _site/2007 directory should exist
And the _site/2007/12 directory should exist
And the _site/2007/12/31 directory should exist
And the "_site/2007/12/31/entry1.html" file should exist
And I should see "
content for entry1.
" in "_site/index.html"
And I should see "
content for entry1.
\n" in "_site/2007/12/31/entry1.html"
jekyll-3.1.6/features/rendering.feature 0000664 0000000 0000000 00000005354 12717414063 0020177 0 ustar 00root root 0000000 0000000 Feature: Rendering
As a hacker who likes to blog
I want to be able to make a static site
In order to share my awesome ideas with the interwebs
But I want to make it as simply as possible
So render with Liquid and place in Layouts
Scenario: When receiving bad Liquid
Given I have a "index.html" page with layout "simple" that contains "{% include invalid.html %}"
And I have a simple layout that contains "{{ content }}"
When I run jekyll build
Then I should get a non-zero exit-status
And I should see "Liquid Exception" in the build output
Scenario: Render Liquid and place in layout
Given I have a "index.html" page with layout "simple" that contains "Hi there, Jekyll {{ jekyll.environment }}!"
And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Hi there, Jekyll development!\nAhoy, indeed" in "_site/index.html"
Scenario: Don't place asset files in layout
Given I have an "index.scss" page with layout "simple" that contains ".foo-bar { color:black; }"
And I have an "index.coffee" page with layout "simple" that contains "whatever()"
And I have a configuration file with "gems" set to "[jekyll-coffeescript]"
And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should not see "Ahoy, indeed!" in "_site/index.css"
And I should not see "Ahoy, indeed!" in "_site/index.js"
Scenario: Render liquid in Sass
Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }"
And I have a configuration file with "color" set to "red"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see ".foo-bar {\n color: red; }" in "_site/index.css"
Scenario: Not render liquid in CoffeeScript without explicitly including jekyll-coffeescript
Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/index.js" file should not exist
Scenario: Render liquid in CoffeeScript with jekyll-coffeescript enabled
Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'"
And I have a configuration file with "gems" set to "[jekyll-coffeescript]"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "hey = 'for cicada';" in "_site/index.js"
jekyll-3.1.6/features/site_configuration.feature 0000664 0000000 0000000 00000032071 12717414063 0022111 0 ustar 00root root 0000000 0000000 Feature: Site configuration
As a hacker who likes to blog
I want to be able to configure jekyll
In order to make setting up a site easier
Scenario: Change source directory
Given I have a blank site in "_sourcedir"
And I have an "_sourcedir/index.html" file that contains "Changing source directory"
And I have a configuration file with "source" set to "_sourcedir"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Changing source directory" in "_site/index.html"
Scenario: Change destination directory
Given I have an "index.html" file that contains "Changing destination directory"
And I have a configuration file with "destination" set to "_mysite"
When I run jekyll build
Then the _mysite directory should exist
And I should see "Changing destination directory" in "_mysite/index.html"
Scenario Outline: Similarly named source and destination
Given I have a blank site in ""
And I have an "/index.md" page that contains "markdown"
And I have a configuration file with:
| key | value |
| source | |
| destination | |
When I run jekyll build
Then the directory should exist
And the "/index.html" file should exist
And I should see "markdown" in "/index.md"
Examples:
| source | dest | file_exist |
| mysite_source | mysite | |
| mysite | mysite_dest | |
| mysite/ | mysite | not |
| mysite | ./mysite | not |
| mysite/source | mysite | not |
| mysite | mysite/dest | |
Scenario: Exclude files inline
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
And I have an "index.html" file that contains "I want to be included"
And I have a configuration file with "exclude" set to "['Rakefile', 'README']"
When I run jekyll build
Then I should see "I want to be included" in "_site/index.html"
And the "_site/Rakefile" file should not exist
And the "_site/README" file should not exist
Scenario: Exclude files with YAML array
Given I have an "Rakefile" file that contains "I want to be excluded"
And I have an "README" file that contains "I want to be excluded"
And I have an "index.html" file that contains "I want to be included"
And I have a configuration file with "exclude" set to:
| value |
| README |
| Rakefile |
When I run jekyll build
Then I should see "I want to be included" in "_site/index.html"
And the "_site/Rakefile" file should not exist
And the "_site/README" file should not exist
Scenario: Use RDiscount for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "rdiscount"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Google" in "_site/index.html"
Scenario: Use Kramdown for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "kramdown"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Google" in "_site/index.html"
Scenario: Use Redcarpet for markup
Given I have an "index.markdown" page that contains "[Google](http://google.com)"
And I have a configuration file with "markdown" set to "redcarpet"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Google" in "_site/index.html"
Scenario: Highlight code with pygments
Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Hello world!" in "_site/index.html"
And I should see "class=\"highlight\"" in "_site/index.html"
Scenario: Highlight code with rouge
Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
And I have a configuration file with "highlighter" set to "rouge"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Hello world!" in "_site/index.html"
And I should see "class=\"highlight\"" in "_site/index.html"
Scenario: Rouge renders code block once
Given I have a configuration file with "highlighter" set to "rouge"
And I have a _posts directory
And I have the following post:
| title | date | layout | content |
| foo | 2014-04-27 11:34 | default | {% highlight text %} test {% endhighlight %} |
When I run jekyll build
Then I should not see "highlight(.*)highlight" in "_site/2014/04/27/foo.html"
Scenario: Set time and no future dated posts
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post layout that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | false |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout:
content for entry1.
" in "_site/2007/12/31/entry1.html"
And the "_site/2020/01/31/entry2.html" file should not exist
Scenario: Set time and future dated posts allowed
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post layout that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | true |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout:
content for entry1.
" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout:
content for entry2.
" in "_site/2020/01/31/entry2.html"
Scenario: Generate proper dates with explicitly set timezone (same as posts' time)
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }}"
And I have a post layout that contains "Post Layout: {{ content }} built at {{ page.date | date_to_xmlschema }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| timezone | America/New_York |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2013-04-09 23:22 -0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 -0400 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html"
And I should see "Post Layout:
content for entry1.
\n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html"
And I should see "Post Layout:
content for entry2.
\n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html"
Scenario: Generate proper dates with explicitly set timezone (different than posts' time)
Given I have a _layouts directory
And I have a page layout that contains "Page Layout: {{ site.posts.size }}"
And I have a post layout that contains "Post Layout: {{ content }} built at {{ page.date | date_to_xmlschema }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| timezone | Pacific/Honolulu |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2013-04-09 23:22 +0400 | post | content for entry1. |
| entry2 | 2013-04-10 03:14 +0400 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2" in "_site/index.html"
And the "_site/2013/04/09/entry1.html" file should exist
And the "_site/2013/04/09/entry2.html" file should exist
And I should see "Post Layout:
content for entry1.
\n built at 2013-04-09T09:22:00-10:00" in "_site/2013/04/09/entry1.html"
And I should see "Post Layout:
content for entry2.
\n built at 2013-04-09T13:14:00-10:00" in "_site/2013/04/09/entry2.html"
Scenario: Limit the number of posts generated by most recent date
Given I have a _posts directory
And I have a configuration file with:
| key | value |
| limit_posts | 2 |
And I have the following posts:
| title | date | content |
| Apples | 2009-03-27 | An article about apples |
| Oranges | 2009-04-01 | An article about oranges |
| Bananas | 2009-04-05 | An article about bananas |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And the "_site/2009/04/05/bananas.html" file should exist
And the "_site/2009/04/01/oranges.html" file should exist
And the "_site/2009/03/27/apples.html" file should not exist
Scenario: Copy over normally excluded files when they are explicitly included
Given I have a ".gitignore" file that contains ".DS_Store"
And I have an ".htaccess" file that contains "SomeDirective"
And I have a configuration file with "include" set to:
| value |
| .gitignore |
| .foo |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see ".DS_Store" in "_site/.gitignore"
And the "_site/.htaccess" file should not exist
Scenario: Using a different layouts directory
Given I have a _theme directory
And I have a page theme that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
And I have a post theme that contains "Post Layout: {{ content }}"
And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with:
| key | value |
| time | 2010-01-01 |
| future | true |
| layouts_dir | _theme |
And I have a _posts directory
And I have the following posts:
| title | date | layout | content |
| entry1 | 2007-12-31 | post | content for entry1. |
| entry2 | 2020-01-31 | post | content for entry2. |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout:
content for entry1.
" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout:
content for entry2.
" in "_site/2020/01/31/entry2.html"
Scenario: arbitrary file reads via layouts
Given I have an "index.html" page with layout "page" that contains "FOO"
And I have a "_config.yml" file that contains "layouts: '../../../../../../../../../../../../../../usr/include'"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "FOO" in "_site/index.html"
And I should not see " " in "_site/index.html"
jekyll-3.1.6/features/site_data.feature 0000664 0000000 0000000 00000012377 12717414063 0020162 0 ustar 00root root 0000000 0000000 Feature: Site data
As a hacker who likes to blog
I want to be able to embed data into my site
In order to make the site slightly dynamic
Scenario: Use page variable in a page
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Contact: email@example.com" in "_site/contact.html"
Scenario Outline: Use page.path variable in a page
Given I have a directory
And I have a "" page that contains "Source path: {{ page.path }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Source path: " in "_site/"
Examples:
| dir | path |
| . | index.html |
| dir | dir/about.html |
| dir/nested | dir/nested/page.html |
Scenario: Override page.path
Given I have an "override.html" page with path "custom-override.html" that contains "Custom path: {{ page.path }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Custom path: custom-override.html" in "_site/override.html"
Scenario: Use site.time variable
Given I have an "index.html" page that contains "{{ site.time }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see today's time in "_site/index.html"
Scenario: Use site.posts variable for latest post
Given I have a _posts directory
And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}"
And I have the following posts:
| title | date | content |
| First Post | 2009-03-25 | My First Post |
| Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html"
Scenario: Use site.posts variable in a loop
Given I have a _posts directory
And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}"
And I have the following posts:
| title | date | content |
| First Post | 2009-03-25 | My First Post |
| Second Post | 2009-03-26 | My Second Post |
| Third Post | 2009-03-27 | My Third Post |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Third Post Second Post First Post" in "_site/index.html"
Scenario: Use site.categories.code variable
Given I have a _posts directory
And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}"
And I have the following posts:
| title | date | category | content |
| Awesome Hack | 2009-03-26 | code | puts 'Hello World' |
| Delicious Beer | 2009-03-26 | food | 1) Yuengling |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Awesome Hack" in "_site/index.html"
Scenario: Use site.tags variable
Given I have a _posts directory
And I have an "index.html" page that contains "{% for post in site.tags.beer %} {{ post.content }} {% endfor %}"
And I have the following posts:
| title | date | tag | content |
| Delicious Beer | 2009-03-26 | beer | 1) Yuengling |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "Yuengling" in "_site/index.html"
Scenario: Order Posts by name when on the same date
Given I have a _posts directory
And I have an "index.html" page that contains "{% for post in site.posts %}{{ post.title }}:{{ post.previous.title}},{{ post.next.title}} {% endfor %}"
And I have the following posts:
| title | date | content |
| first | 2009-02-26 | first |
| A | 2009-03-26 | A |
| B | 2009-03-26 | B |
| C | 2009-03-26 | C |
| last | 2009-04-26 | last |
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html"
Scenario: Use configuration date in site payload
Given I have an "index.html" page that contains "{{ site.url }}"
And I have a configuration file with "url" set to "http://example.com"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "http://example.com" in "_site/index.html"
Scenario: Access Jekyll version via jekyll.version
Given I have an "index.html" page that contains "{{ jekyll.version }}"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should see "\d+\.\d+\.\d+" in "_site/index.html"
jekyll-3.1.6/features/step_definitions.rb 0000664 0000000 0000000 00000012726 12717414063 0020541 0 ustar 00root root 0000000 0000000 Before do
FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory?
Dir.chdir(Paths.test_dir)
end
#
After do
Paths.test_dir.rmtree if Paths.test_dir.exist?
Paths.output_file.delete if Paths.output_file.exist?
Paths.status_file.delete if Paths.status_file.exist?
Dir.chdir(Paths.test_dir.parent)
end
#
Given %r{^I have a blank site in "(.*)"$} do |path|
if !File.exist?(path)
then FileUtils.mkdir_p(path)
end
end
#
Given %r{^I do not have a "(.*)" directory$} do |path|
Paths.test_dir.join(path).directory?
end
#
Given %r{^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$} do |file, key, value, text|
File.write(file, Jekyll::Utils.strip_heredoc(<<-DATA))
---
#{key || 'layout'}: #{value || 'nil'}
---
#{text}
DATA
end
#
Given %r{^I have an? "(.*)" file that contains "(.*)"$} do |file, text|
File.write(file, text)
end
#
Given %r{^I have an? (.*) (layout|theme) that contains "(.*)"$} do |name, type, text|
folder = type == "layout" ? "_layouts" : "_theme"
destination_file = Pathname.new(File.join(folder, "#{name}.html"))
FileUtils.mkdir_p(destination_file.parent) unless destination_file.parent.directory?
File.write(destination_file, text)
end
#
Given %r{^I have an? "(.*)" file with content:$} do |file, text|
File.write(file, text)
end
#
Given %r{^I have an? (.*) directory$} do |dir|
if !File.directory?(dir)
then FileUtils.mkdir_p(dir)
end
end
#
Given %r{^I have the following (draft|page|post)s?(?: (in|under) "([^"]+)")?:$} do |status, direction, folder, table|
table.hashes.each do |input_hash|
title = slug(input_hash["title"])
ext = input_hash["type"] || "markdown"
filename = filename = "#{title}.#{ext}" if %w(draft page).include?(status)
before, after = location(folder, direction)
dest_folder = "_drafts" if status == "draft"
dest_folder = "_posts" if status == "post"
dest_folder = "" if status == "page"
if status == "post"
parsed_date = Time.xmlschema(input_hash['date']) rescue Time.parse(input_hash['date'])
filename = "#{parsed_date.strftime('%Y-%m-%d')}-#{title}.#{ext}"
end
path = File.join(before, dest_folder, after, filename)
File.write(path, file_content_from_hash(input_hash))
end
end
#
Given %r{^I have a configuration file with "(.*)" set to "(.*)"$} do |key, value|
config = if source_dir.join("_config.yml").exist?
SafeYAML.load_file(source_dir.join("_config.yml"))
else
{}
end
config[key] = YAML.load(value)
File.write("_config.yml", YAML.dump(config))
end
#
Given %r{^I have a configuration file with:$} do |table|
table.hashes.each do |row|
step %(I have a configuration file with "#{row["key"]}" set to "#{row["value"]}")
end
end
#
Given %r{^I have a configuration file with "([^\"]*)" set to:$} do |key, table|
File.open("_config.yml", "w") do |f|
f.write("#{key}:\n")
table.hashes.each do |row|
f.write("- #{row["value"]}\n")
end
end
end
#
Given %r{^I have fixture collections$} do
FileUtils.cp_r Paths.source_dir.join("test", "source", "_methods"), source_dir
FileUtils.cp_r Paths.source_dir.join("test", "source", "_thanksgiving"), source_dir
end
#
Given %r{^I wait (\d+) second(s?)$} do |time, plural|
sleep(time.to_f)
end
#
When %r{^I run jekyll(.*)$} do |args|
run_jekyll(args)
if args.include?("--verbose") || ENV["DEBUG"]
$stderr.puts "\n#{jekyll_run_output}\n"
end
end
#
When %r{^I run bundle(.*)$} do |args|
run_bundle(args)
if args.include?("--verbose") || ENV['DEBUG']
$stderr.puts "\n#{jekyll_run_output}\n"
end
end
#
When %r{^I change "(.*)" to contain "(.*)"$} do |file, text|
File.open(file, "a") do |f|
f.write(text)
end
end
#
When %r{^I delete the file "(.*)"$} do |file|
File.delete(file)
end
#
Then %r{^the (.*) directory should +(not )?exist$} do |dir, negative|
if negative.nil?
expect(Pathname.new(dir)).to exist
else
expect(Pathname.new(dir)).to_not exist
end
end
#
Then %r{^I should (not )?see "(.*)" in "(.*)"$} do |negative, text, file|
step %(the "#{file}" file should exist)
regexp = Regexp.new(text, Regexp::MULTILINE)
if negative.nil? || negative.empty?
expect(file_contents(file)).to match regexp
else
expect(file_contents(file)).not_to match regexp
end
end
#
Then %r{^I should see exactly "(.*)" in "(.*)"$} do |text, file|
step %(the "#{file}" file should exist)
expect(file_contents(file).strip).to eq text
end
#
Then %r{^I should see escaped "(.*)" in "(.*)"$} do |text, file|
step %(I should see "#{Regexp.escape(text)}" in "#{file}")
end
#
Then %r{^the "(.*)" file should +(not )?exist$} do |file, negative|
if negative.nil?
expect(Pathname.new(file)).to exist
else
expect(Pathname.new(file)).to_not exist
end
end
#
Then %r{^I should see today's time in "(.*)"$} do |file|
step %(I should see "#{seconds_agnostic_time(Time.now)}" in "#{file}")
end
#
Then %r{^I should see today's date in "(.*)"$} do |file|
step %(I should see "#{Date.today.to_s}" in "#{file}")
end
#
Then %r{^I should (not )?see "(.*)" in the build output$} do |negative, text|
if negative.nil? || negative.empty?
expect(jekyll_run_output).to match Regexp.new(text)
else
expect(jekyll_run_output).not_to match Regexp.new(text)
end
end
#
Then %r{^I should get a zero exit(?:\-| )status$} do
step %(I should see "EXIT STATUS: 0" in the build output)
end
#
Then %r{^I should get a non-zero exit(?:\-| )status$} do
step %(I should not see "EXIT STATUS: 0" in the build output)
end
jekyll-3.1.6/features/support/ 0000775 0000000 0000000 00000000000 12717414063 0016352 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/features/support/formatter.rb 0000664 0000000 0000000 00000007146 12717414063 0020712 0 ustar 00root root 0000000 0000000 require 'fileutils'
require 'colorator'
require 'cucumber/formatter/console'
require 'cucumber/formatter/io'
module Jekyll
module Cucumber
class Formatter
attr_accessor :indent, :runtime
include ::Cucumber::Formatter::Console
include ::Cucumber::Formatter::Io
include FileUtils
CHARS = {
:failed => "\u2718".red,
:pending => "\u203D".yellow,
:undefined => "\u2718".red,
:passed => "\u2714".green,
:skipped => "\u203D".blue
}
#
def initialize(runtime, path_or_io, options)
@runtime = runtime
@snippets_input = []
@io = ensure_io(path_or_io)
@prefixes = options[:prefixes] || {}
@delayed_messages = []
@options = options
@exceptions = []
@indent = 0
end
#
def before_features(features)
print_profile_information
end
#
def after_features(features)
@io.puts
print_summary(features)
end
#
def before_feature(feature)
@exceptions = []
@indent = 0
end
#
def tag_name(tag_name); end
def comment_line(comment_line); end
def after_feature_element(feature_element); end
def after_tags(tags); end
#
def before_feature_element(feature_element)
@indent = 2
@scenario_indent = 2
end
#
def before_background(background)
@scenario_indent = 2
@in_background = true
@indent = 2
end
#
def after_background(background)
@in_background = nil
end
#
def background_name(keyword, name, source_line, indend)
print_feature_element_name(
keyword, name, source_line, indend
)
end
#
def scenario_name(keyword, name, source_line, indent)
print_feature_element_name(
keyword, name, source_line, indent
)
end
#
def before_step(step)
@current_step = step
end
#
def before_step_result(keyword, step_match, multiline_arg, status, exception, \
source_indent, background, file_colon_line)
@hide_this_step = false
if exception
if @exceptions.include?(exception)
@hide_this_step = true
return
end
@exceptions << exception
end
if status != :failed && @in_background ^ background
@hide_this_step = true
return
end
@status = status
end
#
def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
@io.print CHARS[status]
@io.print " "
end
#
def exception(exception, status)
return if @hide_this_step
@io.puts
print_exception(exception, status, @indent)
@io.flush
end
#
def after_test_step(test_step, result)
collect_snippet_data(
test_step, result
)
end
#
private
def print_feature_element_name(keyword, name, source_line, indent)
@io.puts
names = name.empty? ? [name] : name.each_line.to_a
line = " #{keyword}: #{names[0]}"
@io.print(source_line) if @options[:source]
@io.print(line)
@io.print " "
@io.flush
end
#
def cell_prefix(status)
@prefixes[status]
end
#
def print_summary(features)
@io.puts
print_stats(features, @options)
print_snippets(@options)
print_passing_wip(@options)
end
end
end
end
jekyll-3.1.6/features/support/helpers.rb 0000664 0000000 0000000 00000005476 12717414063 0020355 0 ustar 00root root 0000000 0000000 require "fileutils"
require "jekyll/utils"
require "open3"
require "time"
require "safe_yaml/load"
class Paths
SOURCE_DIR = Pathname.new(File.expand_path("../..", __dir__))
def self.test_dir; source_dir.join("tmp", "jekyll"); end
def self.output_file; test_dir.join("jekyll_output.txt"); end
def self.status_file; test_dir.join("jekyll_status.txt"); end
def self.jekyll_bin; source_dir.join("bin", "jekyll"); end
def self.source_dir; SOURCE_DIR; end
end
#
def file_content_from_hash(input_hash)
matter_hash = input_hash.reject { |k, v| k == "content" }
matter = matter_hash.map do |k, v| "#{k}: #{v}\n"
end
matter = matter.join.chomp
content = \
if !input_hash['input'] || !input_hash['filter']
then input_hash['content']
else "{{ #{input_hash['input']} | " \
"#{input_hash['filter']} }}"
end
Jekyll::Utils.strip_heredoc(<<-EOF)
---
#{matter.gsub(
/\n/, "\n "
)}
---
#{content}
EOF
end
#
def source_dir(*files)
return Paths.test_dir(*files)
end
#
def all_steps_to_path(path)
source = source_dir
dest = Pathname.new(path).expand_path
paths = []
dest.ascend do |f|
break if f == source
paths.unshift f.to_s
end
paths
end
#
def jekyll_run_output
if Paths.output_file.file?
then return Paths.output_file.read
end
end
#
def jekyll_run_status
if Paths.status_file.file?
then return Paths.status_file.read
end
end
#
def run_bundle(args)
run_in_shell("bundle", *args.strip.split(' '))
end
#
def run_jekyll(args)
args = args.strip.split(" ") # Shellwords?
process = run_in_shell(Paths.jekyll_bin.to_s, *args, "--trace")
process.exitstatus == 0
end
#
def run_in_shell(*args)
i, o, e, p = Open3.popen3(*args)
out = o.read.strip
err = e.read.strip
[i, o, e].each do |m|
m.close
end
File.write(Paths.status_file, p.value.exitstatus)
File.open(Paths.output_file, "wb") do |f|
f.puts "$ " << args.join(" ")
f.puts out
f.puts err
f.puts "EXIT STATUS: #{p.value.exitstatus}"
end
p.value
end
#
def slug(title = nil)
if !title
then Time.now.strftime("%s%9N") # nanoseconds since the Epoch
else title.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
end
end
#
def location(folder, direction)
if folder
before = folder if direction == "in"
after = folder if direction == "under"
end
[before || '.',
after || '.']
end
#
def file_contents(path)
return Pathname.new(path).read
end
#
def seconds_agnostic_datetime(datetime = Time.now)
date, time, zone = datetime.to_s.split(" ")
time = seconds_agnostic_time(time)
[
Regexp.escape(date),
"#{time}:\\d{2}",
Regexp.escape(zone)
] \
.join("\\ ")
end
#
def seconds_agnostic_time(time)
time = time.strftime("%H:%M:%S") if time.is_a?(Time)
hour, minutes, _ = time.split(":")
"#{hour}:#{minutes}"
end
jekyll-3.1.6/jekyll.gemspec 0000664 0000000 0000000 00000002757 12717414063 0015672 0 ustar 00root root 0000000 0000000 # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'jekyll/version'
Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.rubygems_version = '2.2.2'
s.required_ruby_version = '>= 2.0.0'
s.name = 'jekyll'
s.version = Jekyll::VERSION
s.license = 'MIT'
s.summary = 'A simple, blog aware, static site generator.'
s.description = 'Jekyll is a simple, blog aware, static site generator.'
s.authors = ['Tom Preston-Werner']
s.email = 'tom@mojombo.com'
s.homepage = 'https://github.com/jekyll/jekyll'
all_files = `git ls-files -z`.split("\x0")
s.files = all_files.grep(%r{^(bin|lib)/|^.rubocop.yml$})
s.executables = all_files.grep(%r{^bin/}) { |f| File.basename(f) }
s.require_paths = ['lib']
s.rdoc_options = ['--charset=UTF-8']
s.extra_rdoc_files = %w[README.markdown LICENSE]
s.add_runtime_dependency('liquid', '~> 3.0')
s.add_runtime_dependency('kramdown', '~> 1.3')
s.add_runtime_dependency('mercenary', '~> 0.3.3')
s.add_runtime_dependency('safe_yaml', '~> 1.0')
s.add_runtime_dependency('colorator', '~> 0.1')
s.add_runtime_dependency('rouge', '~> 1.7')
s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0')
s.add_runtime_dependency('jekyll-watch', '~> 1.1')
end
jekyll-3.1.6/lib/ 0000775 0000000 0000000 00000000000 12717414063 0013566 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll.rb 0000664 0000000 0000000 00000013752 12717414063 0015415 0 ustar 00root root 0000000 0000000 $LOAD_PATH.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
# Require all of the Ruby files in the given directory.
#
# path - The String relative path from here to the directory.
#
# Returns nothing.
def require_all(path)
glob = File.join(File.dirname(__FILE__), path, '*.rb')
Dir[glob].sort.each do |f|
require f
end
end
# rubygems
require 'rubygems'
# stdlib
require 'forwardable'
require 'fileutils'
require 'time'
require 'English'
require 'pathname'
require 'logger'
require 'set'
# 3rd party
require 'safe_yaml/load'
require 'liquid'
require 'kramdown'
require 'colorator'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
# internal requires
autoload :Cleaner, 'jekyll/cleaner'
autoload :Collection, 'jekyll/collection'
autoload :Configuration, 'jekyll/configuration'
autoload :Convertible, 'jekyll/convertible'
autoload :Deprecator, 'jekyll/deprecator'
autoload :Document, 'jekyll/document'
autoload :Draft, 'jekyll/draft'
autoload :EntryFilter, 'jekyll/entry_filter'
autoload :Errors, 'jekyll/errors'
autoload :Excerpt, 'jekyll/excerpt'
autoload :External, 'jekyll/external'
autoload :Filters, 'jekyll/filters'
autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults'
autoload :Hooks, 'jekyll/hooks'
autoload :Layout, 'jekyll/layout'
autoload :CollectionReader, 'jekyll/readers/collection_reader'
autoload :DataReader, 'jekyll/readers/data_reader'
autoload :LayoutReader, 'jekyll/readers/layout_reader'
autoload :PostReader, 'jekyll/readers/post_reader'
autoload :PageReader, 'jekyll/readers/page_reader'
autoload :StaticFileReader, 'jekyll/readers/static_file_reader'
autoload :LogAdapter, 'jekyll/log_adapter'
autoload :Page, 'jekyll/page'
autoload :PluginManager, 'jekyll/plugin_manager'
autoload :Publisher, 'jekyll/publisher'
autoload :Reader, 'jekyll/reader'
autoload :Regenerator, 'jekyll/regenerator'
autoload :RelatedPosts, 'jekyll/related_posts'
autoload :Renderer, 'jekyll/renderer'
autoload :LiquidRenderer, 'jekyll/liquid_renderer'
autoload :Site, 'jekyll/site'
autoload :StaticFile, 'jekyll/static_file'
autoload :Stevenson, 'jekyll/stevenson'
autoload :URL, 'jekyll/url'
autoload :Utils, 'jekyll/utils'
autoload :VERSION, 'jekyll/version'
# extensions
require 'jekyll/plugin'
require 'jekyll/converter'
require 'jekyll/generator'
require 'jekyll/command'
require 'jekyll/liquid_extensions'
class << self
# Public: Tells you which Jekyll environment you are building in so you can skip tasks
# if you need to. This is useful when doing expensive compression tasks on css and
# images and allows you to skip that when working in development.
def env
ENV["JEKYLL_ENV"] || "development"
end
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.
#
# override - A Hash of config directives that override any options in both
# the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a
# list of option names and their defaults.
#
# Returns the final configuration Hash.
def configuration(override = Hash.new)
config = Configuration.new
unless override.delete('skip_config_files')
config = config.read_config_files(config.config_files(override))
end
# Merge DEFAULTS < _config.yml < override
Configuration.from(Utils.deep_merge_hashes(config, override)).tap do |config|
set_timezone(config['timezone']) if config['timezone']
end
end
# Public: Set the TZ environment variable to use the timezone specified
#
# timezone - the IANA Time Zone
#
# Returns nothing
def set_timezone(timezone)
ENV['TZ'] = timezone
end
# Public: Fetch the logger instance for this Jekyll process.
#
# Returns the LogAdapter instance.
def logger
@logger ||= LogAdapter.new(Stevenson.new, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
end
# Public: Set the log writer.
# New log writer must respond to the same methods
# as Ruby's interal Logger.
#
# writer - the new Logger-compatible log transport
#
# Returns the new logger.
def logger=(writer)
@logger = LogAdapter.new(writer, (ENV["JEKYLL_LOG_LEVEL"] || :info).to_sym)
end
# Public: An array of sites
#
# Returns the Jekyll sites created.
def sites
@sites ||= []
end
# Public: Ensures the questionable path is prefixed with the base directory
# and prepends the questionable path with the base directory if false.
#
# base_directory - the directory with which to prefix the questionable path
# questionable_path - the path we're unsure about, and want prefixed
#
# Returns the sanitized path.
def sanitized_path(base_directory, questionable_path)
return base_directory if base_directory.eql?(questionable_path)
questionable_path.insert(0, '/') if questionable_path.start_with?('~')
clean_path = File.expand_path(questionable_path, "/")
clean_path.sub!(/\A\w\:\//, '/')
if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
clean_path
else
File.join(base_directory, clean_path)
end
end
# Conditional optimizations
Jekyll::External.require_if_present('liquid-c')
end
end
require "jekyll/drops/drop"
require "jekyll/drops/document_drop"
require_all 'jekyll/commands'
require_all 'jekyll/converters'
require_all 'jekyll/converters/markdown'
require_all 'jekyll/drops'
require_all 'jekyll/generators'
require_all 'jekyll/tags'
require 'jekyll-sass-converter'
jekyll-3.1.6/lib/jekyll/ 0000775 0000000 0000000 00000000000 12717414063 0015060 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/cleaner.rb 0000664 0000000 0000000 00000005662 12717414063 0017027 0 ustar 00root root 0000000 0000000 require 'set'
module Jekyll
# Handles the cleanup of a site's destination before it is built.
class Cleaner
HIDDEN_FILE_REGEX = /\/\.{1,2}$/
attr_reader :site
def initialize(site)
@site = site
end
# Cleans up the site's destination directory
def cleanup!
FileUtils.rm_rf(obsolete_files)
FileUtils.rm_rf(metadata_file) unless @site.incremental?
end
private
# Private: The list of files and directories to be deleted during cleanup process
#
# Returns an Array of the file and directory paths
def obsolete_files
(existing_files - new_files - new_dirs + replaced_files).to_a
end
# Private: The metadata file storing dependency tree and build history
#
# Returns an Array with the metdata file as the only item
def metadata_file
[site.regenerator.metadata_file]
end
# Private: The list of existing files, apart from those included in keep_files and hidden files.
#
# Returns a Set with the file paths
def existing_files
files = Set.new
regex = keep_file_regex
dirs = keep_dirs
Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
files << file
end
files
end
# Private: The list of files to be created when site is built.
#
# Returns a Set with the file paths
def new_files
files = Set.new
site.each_site_file { |item| files << item.destination(site.dest) }
files
end
# Private: The list of directories to be created when site is built.
# These are the parent directories of the files in #new_files.
#
# Returns a Set with the directory paths
def new_dirs
new_files.map { |file| parent_dirs(file) }.flatten.to_set
end
# Private: The list of parent directories of a given file
#
# Returns an Array with the directory paths
def parent_dirs(file)
parent_dir = File.dirname(file)
if parent_dir == site.dest
[]
else
[parent_dir] + parent_dirs(parent_dir)
end
end
# Private: The list of existing files that will be replaced by a directory during build
#
# Returns a Set with the file paths
def replaced_files
new_dirs.select { |dir| File.file?(dir) }.to_set
end
# Private: The list of directories that need to be kept because they are parent directories
# of files specified in keep_files
#
# Returns a Set with the directory paths
def keep_dirs
site.keep_files.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
end
# Private: Creates a regular expression from the config's keep_files array
#
# Examples
# ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
#
# Returns the regular expression
def keep_file_regex
Regexp.union(site.keep_files)
end
end
end
jekyll-3.1.6/lib/jekyll/collection.rb 0000664 0000000 0000000 00000014440 12717414063 0017543 0 ustar 00root root 0000000 0000000 module Jekyll
class Collection
attr_reader :site, :label, :metadata
attr_writer :docs
# Create a new Collection.
#
# site - the site to which this collection belongs.
# label - the name of the collection
#
# Returns nothing.
def initialize(site, label)
@site = site
@label = sanitize_label(label)
@metadata = extract_metadata
end
# Fetch the Documents in this collection.
# Defaults to an empty array if no documents have been read in.
#
# Returns an array of Jekyll::Document objects.
def docs
@docs ||= []
end
# Override of normal respond_to? to match method_missing's logic for
# looking in @data.
def respond_to?(method, include_private = false)
docs.respond_to?(method.to_sym, include_private) || super
end
# Override of method_missing to check in @data for the key.
def method_missing(method, *args, &blck)
if docs.respond_to?(method.to_sym)
Jekyll.logger.warn "Deprecation:", "#{label}.#{method} should be changed to #{label}.docs.#{method}."
Jekyll.logger.warn "", "Called by #{caller.first}."
docs.public_send(method.to_sym, *args, &blck)
else
super
end
end
# Fetch the static files in this collection.
# Defaults to an empty array if no static files have been read in.
#
# Returns an array of Jekyll::StaticFile objects.
def files
@files ||= []
end
# Read the allowed documents into the collection's array of docs.
#
# Returns the sorted array of docs.
def read
filtered_entries.each do |file_path|
full_path = collection_dir(file_path)
next if File.directory?(full_path)
if Utils.has_yaml_header? full_path
doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
doc.read
if site.publisher.publish?(doc) || !write?
docs << doc
else
Jekyll.logger.debug "Skipped From Publishing:", doc.relative_path
end
else
relative_dir = Jekyll.sanitized_path(relative_directory, File.dirname(file_path)).chomp("/.")
files << StaticFile.new(site, site.source, relative_dir, File.basename(full_path), self)
end
end
docs.sort!
end
# All the entries in this collection.
#
# Returns an Array of file paths to the documents in this collection
# relative to the collection's directory
def entries
return [] unless exists?
@entries ||=
Utils.safe_glob(collection_dir, ["**", "*.*"]).map do |entry|
entry["#{collection_dir}/"] = ''
entry
end
end
# Filtered version of the entries in this collection.
# See `Jekyll::EntryFilter#filter` for more information.
#
# Returns a list of filtered entry paths.
def filtered_entries
return [] unless exists?
@filtered_entries ||=
Dir.chdir(directory) do
entry_filter.filter(entries).reject do |f|
path = collection_dir(f)
File.directory?(path) || (File.symlink?(f) && site.safe)
end
end
end
# The directory for this Collection, relative to the site source.
#
# Returns a String containing the directory name where the collection
# is stored on the filesystem.
def relative_directory
@relative_directory ||= "_#{label}"
end
# The full path to the directory containing the collection.
#
# Returns a String containing th directory name where the collection
# is stored on the filesystem.
def directory
@directory ||= site.in_source_dir(relative_directory)
end
# The full path to the directory containing the collection, with
# optional subpaths.
#
# *files - (optional) any other path pieces relative to the
# directory to append to the path
#
# Returns a String containing th directory name where the collection
# is stored on the filesystem.
def collection_dir(*files)
return directory if files.empty?
site.in_source_dir(relative_directory, *files)
end
# Checks whether the directory "exists" for this collection.
# The directory must exist on the filesystem and must not be a symlink
# if in safe mode.
#
# Returns false if the directory doesn't exist or if it's a symlink
# and we're in safe mode.
def exists?
File.directory?(directory) && !(File.symlink?(directory) && site.safe)
end
# The entry filter for this collection.
# Creates an instance of Jekyll::EntryFilter.
#
# Returns the instance of Jekyll::EntryFilter for this collection.
def entry_filter
@entry_filter ||= Jekyll::EntryFilter.new(site, relative_directory)
end
# An inspect string.
#
# Returns the inspect string
def inspect
"#"
end
# Produce a sanitized label name
# Label names may not contain anything but alphanumeric characters,
# underscores, and hyphens.
#
# label - the possibly-unsafe label
#
# Returns a sanitized version of the label.
def sanitize_label(label)
label.gsub(/[^a-z0-9_\-\.]/i, '')
end
# Produce a representation of this Collection for use in Liquid.
# Exposes two attributes:
# - label
# - docs
#
# Returns a representation of this collection for use in Liquid.
def to_liquid
Drops::CollectionDrop.new self
end
# Whether the collection's documents ought to be written as individual
# files in the output.
#
# Returns true if the 'write' metadata is true, false otherwise.
def write?
!!metadata.fetch('output', false)
end
# The URL template to render collection's documents at.
#
# Returns the URL template to render collection's documents at.
def url_template
@url_template ||= metadata.fetch('permalink') do
Utils.add_permalink_suffix("/:collection/:path", site.permalink_style)
end
end
# Extract options for this collection from the site configuration.
#
# Returns the metadata for this collection
def extract_metadata
if site.config['collections'].is_a?(Hash)
site.config['collections'][label] || {}
else
{}
end
end
end
end
jekyll-3.1.6/lib/jekyll/command.rb 0000664 0000000 0000000 00000004677 12717414063 0017041 0 ustar 00root root 0000000 0000000 module Jekyll
class Command
class << self
# A list of subclasses of Jekyll::Command
def subclasses
@subclasses ||= []
end
# Keep a list of subclasses of Jekyll::Command every time it's inherited
# Called automatically.
#
# base - the subclass
#
# Returns nothing
def inherited(base)
subclasses << base
super(base)
end
# Run Site#process and catch errors
#
# site - the Jekyll::Site object
#
# Returns nothing
def process_site(site)
site.process
rescue Jekyll::Errors::FatalException => e
Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
Jekyll.logger.error "", "------------------------------------"
Jekyll.logger.error "", e.message
exit(1)
end
# Create a full Jekyll configuration with the options passed in as overrides
#
# options - the configuration overrides
#
# Returns a full Jekyll configuration
def configuration_from_options(options)
Jekyll.configuration(options)
end
# Add common options to a command for building configuration
#
# c - the Jekyll::Command to add these options to
#
# Returns nothing
def add_build_options(c)
c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option 'destination', '-d', '--destination DESTINATION', 'The current folder will be generated into DESTINATION'
c.option 'source', '-s', '--source SOURCE', 'Custom source directory'
c.option 'future', '--future', 'Publishes posts with a future date'
c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option 'watch', '-w', '--[no-]watch', 'Watch for changes and rebuild'
c.option 'force_polling', '--force_polling', 'Force watch to use polling'
c.option 'lsi', '--lsi', 'Use LSI for improved related posts'
c.option 'show_drafts', '-D', '--drafts', 'Render posts in the _drafts folder'
c.option 'unpublished', '--unpublished', 'Render posts that were marked as unpublished'
c.option 'quiet', '-q', '--quiet', 'Silence output.'
c.option 'verbose', '-V', '--verbose', 'Print verbose output.'
c.option 'incremental', '-I', '--incremental', 'Enable incremental rebuild.'
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/ 0000775 0000000 0000000 00000000000 12717414063 0016661 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/commands/build.rb 0000664 0000000 0000000 00000005115 12717414063 0020307 0 ustar 00root root 0000000 0000000 module Jekyll
module Commands
class Build < Command
class << self
# Create the Mercenary command for the Jekyll CLI for this Command
def init_with_program(prog)
prog.command(:build) do |c|
c.syntax 'build [options]'
c.description 'Build your site'
c.alias :b
add_build_options(c)
c.action do |_, options|
options["serving"] = false
Jekyll::Commands::Build.process(options)
end
end
end
# Build your jekyll site
# Continuously watch if `watch` is set to true in the config.
def process(options)
# Adjust verbosity quickly
Jekyll.logger.adjust_verbosity(options)
options = configuration_from_options(options)
site = Jekyll::Site.new(options)
if options.fetch('skip_initial_build', false)
Jekyll.logger.warn "Build Warning:", "Skipping the initial build. This may result in an out-of-date site."
else
build(site, options)
end
if options.fetch('detach', false)
Jekyll.logger.info "Auto-regeneration:", "disabled when running server detached."
elsif options.fetch('watch', false)
watch(site, options)
else
Jekyll.logger.info "Auto-regeneration:", "disabled. Use --watch to enable."
end
end
# Build your Jekyll site.
#
# site - the Jekyll::Site instance to build
# options - A Hash of options passed to the command
#
# Returns nothing.
def build(site, options)
t = Time.now
source = options['source']
destination = options['destination']
incremental = options['incremental']
Jekyll.logger.info "Source:", source
Jekyll.logger.info "Destination:", destination
Jekyll.logger.info "Incremental build:", (incremental ? "enabled" : "disabled. Enable with --incremental")
Jekyll.logger.info "Generating..."
process_site(site)
Jekyll.logger.info "", "done in #{(Time.now - t).round(3)} seconds."
end
# Private: Watch for file changes and rebuild the site.
#
# site - A Jekyll::Site instance
# options - A Hash of options passed to the command
#
# Returns nothing.
def watch(_site, options)
External.require_with_graceful_fail 'jekyll-watch'
Jekyll::Watcher.watch(options)
end
end # end of class << self
end
end
end
jekyll-3.1.6/lib/jekyll/commands/clean.rb 0000664 0000000 0000000 00000002377 12717414063 0020301 0 ustar 00root root 0000000 0000000 module Jekyll
module Commands
class Clean < Command
class << self
def init_with_program(prog)
prog.command(:clean) do |c|
c.syntax 'clean [subcommand]'
c.description 'Clean the site (removes site output and metadata file) without building.'
add_build_options(c)
c.action do |_, options|
Jekyll::Commands::Clean.process(options)
end
end
end
def process(options)
options = configuration_from_options(options)
destination = options['destination']
metadata_file = File.join(options['source'], '.jekyll-metadata')
if File.directory? destination
Jekyll.logger.info "Cleaning #{destination}..."
FileUtils.rm_rf(destination)
Jekyll.logger.info "", "done."
else
Jekyll.logger.info "Nothing to do for #{destination}."
end
if File.file? metadata_file
Jekyll.logger.info "Removing #{metadata_file}..."
FileUtils.rm_rf(metadata_file)
Jekyll.logger.info "", "done."
else
Jekyll.logger.info "Nothing to do for #{metadata_file}."
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/doctor.rb 0000664 0000000 0000000 00000007230 12717414063 0020502 0 ustar 00root root 0000000 0000000 module Jekyll
module Commands
class Doctor < Command
class << self
def init_with_program(prog)
prog.command(:doctor) do |c|
c.syntax 'doctor'
c.description 'Search site and print specific deprecation warnings'
c.alias(:hyde)
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.action do |_, options|
Jekyll::Commands::Doctor.process(options)
end
end
end
def process(options)
site = Jekyll::Site.new(configuration_from_options(options))
site.read
if healthy?(site)
Jekyll.logger.info "Your test results", "are in. Everything looks fine."
else
abort
end
end
def healthy?(site)
[
fsnotify_buggy?(site),
!deprecated_relative_permalinks(site),
!conflicting_urls(site),
!urls_only_differ_by_case(site)
].all?
end
def deprecated_relative_permalinks(site)
if site.config['relative_permalinks']
Jekyll::Deprecator.deprecation_message "Your site still uses relative" \
" permalinks, which was removed in" \
" Jekyll v3.0.0."
return true
end
end
def conflicting_urls(site)
conflicting_urls = false
urls = {}
urls = collect_urls(urls, site.pages, site.dest)
urls = collect_urls(urls, site.posts.docs, site.dest)
urls.each do |url, paths|
next unless paths.size > 1
conflicting_urls = true
Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
" for the following pages: #{paths.join(", ")}"
end
conflicting_urls
end
def fsnotify_buggy?(_site)
return true unless Utils::Platforms.osx?
if Dir.pwd != `pwd`.strip
Jekyll.logger.error " " + <<-STR.strip.gsub(/\n\s+/, "\n ")
We have detected that there might be trouble using fsevent on your
operating system, you can read https://github.com/thibaudgg/rb-fsevent/wiki/no-fsevents-fired-(OSX-bug)
for possible work arounds or you can work around it immediately
with `--force-polling`.
STR
false
end
true
end
def urls_only_differ_by_case(site)
urls_only_differ_by_case = false
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
urls.each do |case_insensitive_url, real_urls|
next unless real_urls.uniq.size > 1
urls_only_differ_by_case = true
Jekyll.logger.warn "Warning:", "The following URLs only differ" \
" by case. On a case-insensitive file system one of the URLs" \
" will be overwritten by the other: #{real_urls.join(", ")}"
end
urls_only_differ_by_case
end
private
def collect_urls(urls, things, destination)
things.each do |thing|
dest = thing.destination(destination)
if urls[dest]
urls[dest] << thing.path
else
urls[dest] = [thing.path]
end
end
urls
end
def case_insensitive_urls(things, destination)
things.inject({}) do |memo, thing|
dest = thing.destination(destination)
(memo[dest.downcase] ||= []) << dest
memo
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/help.rb 0000664 0000000 0000000 00000001573 12717414063 0020144 0 ustar 00root root 0000000 0000000 module Jekyll
module Commands
class Help < Command
class << self
def init_with_program(prog)
prog.command(:help) do |c|
c.syntax 'help [subcommand]'
c.description 'Show the help message, optionally for a given subcommand.'
c.action do |args, _|
cmd = (args.first || "").to_sym
if args.empty?
puts prog
elsif prog.has_command? cmd
puts prog.commands[cmd]
else
invalid_command(prog, cmd)
abort
end
end
end
end
def invalid_command(prog, cmd)
Jekyll.logger.error "Error:", "Hmm... we don't know what the '#{cmd}' command is."
Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ")
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/new.rb 0000664 0000000 0000000 00000004717 12717414063 0020010 0 ustar 00root root 0000000 0000000 require 'erb'
module Jekyll
module Commands
class New < Command
class << self
def init_with_program(prog)
prog.command(:new) do |c|
c.syntax 'new PATH'
c.description 'Creates a new Jekyll site scaffold in PATH'
c.option 'force', '--force', 'Force creation even if PATH already exists'
c.option 'blank', '--blank', 'Creates scaffolding but with empty files'
c.action do |args, options|
Jekyll::Commands::New.process(args, options)
end
end
end
def process(args, options = {})
raise ArgumentError.new('You must specify a path.') if args.empty?
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
FileUtils.mkdir_p new_blog_path
if preserve_source_location?(new_blog_path, options)
Jekyll.logger.abort_with "Conflict:", "#{new_blog_path} exists and is not empty."
end
if options["blank"]
create_blank_site new_blog_path
else
create_sample_files new_blog_path
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
f.write(scaffold_post_content)
end
end
Jekyll.logger.info "New jekyll site installed in #{new_blog_path}."
end
def create_blank_site(path)
Dir.chdir(path) do
FileUtils.mkdir(%w(_layouts _posts _drafts))
FileUtils.touch("index.html")
end
end
def scaffold_post_content
ERB.new(File.read(File.expand_path(scaffold_path, site_template))).result
end
# Internal: Gets the filename of the sample post to be created
#
# Returns the filename of the sample post, as a String
def initialized_post_name
"_posts/#{Time.now.strftime('%Y-%m-%d')}-welcome-to-jekyll.markdown"
end
private
def preserve_source_location?(path, options)
!options["force"] && !Dir["#{path}/**/*"].empty?
end
def create_sample_files(path)
FileUtils.cp_r site_template + '/.', path
FileUtils.rm File.expand_path(scaffold_path, path)
end
def site_template
File.expand_path("../../site_template", File.dirname(__FILE__))
end
def scaffold_path
"_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/serve.rb 0000664 0000000 0000000 00000015171 12717414063 0020337 0 ustar 00root root 0000000 0000000 module Jekyll
module Commands
class Serve < Command
class << self
COMMAND_OPTIONS = {
"ssl_cert" => ["--ssl-cert [CERT]", "X.509 (SSL) certificate."],
"host" => ["host", "-H", "--host [HOST]", "Host to bind to"],
"open_url" => ["-o", "--open-url", "Launch your browser with your site."],
"detach" => ["-B", "--detach", "Run the server in the background (detach)"],
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
"port" => ["-P", "--port [PORT]", "Port to listen on"],
"baseurl" => ["-b", "--baseurl [URL]", "Base URL"],
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
"Skips the initial site build which occurs before the server is started."]
}
#
def init_with_program(prog)
prog.command(:serve) do |cmd|
cmd.description "Serve your site locally"
cmd.syntax "serve [options]"
cmd.alias :server
cmd.alias :s
add_build_options(cmd)
COMMAND_OPTIONS.each do |key, val|
cmd.option key, *val
end
cmd.action do |_, opts|
opts["serving"] = true
opts["watch" ] = true unless opts.key?("watch")
Build.process(opts)
Serve.process(opts)
end
end
end
#
def process(opts)
opts = configuration_from_options(opts)
destination = opts["destination"]
setup(destination)
server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
server.mount(opts["baseurl"], Servlet, destination, file_handler_opts)
Jekyll.logger.info "Server address:", server_address(server, opts)
launch_browser server, opts if opts["open_url"]
boot_or_detach server, opts
end
# Do a base pre-setup of WEBRick so that everything is in place
# when we get ready to party, checking for an setting up an error page
# and making sure our destination exists.
private
def setup(destination)
require_relative "serve/servlet"
FileUtils.mkdir_p(destination)
if File.exist?(File.join(destination, "404.html"))
WEBrick::HTTPResponse.class_eval do
def create_error_page
@header["Content-Type"] = "text/html; charset=UTF-8"
@body = IO.read(File.join(@config[:DocumentRoot], "404.html"))
end
end
end
end
#
private
def webrick_opts(opts)
opts = {
:JekyllOptions => opts,
:DoNotReverseLookup => true,
:MimeTypes => mime_types,
:DocumentRoot => opts["destination"],
:StartCallback => start_callback(opts["detach"]),
:BindAddress => opts["host"],
:Port => opts["port"],
:DirectoryIndex => %W(
index.htm
index.html
index.rhtml
index.cgi
index.xml
)
}
enable_ssl(opts)
enable_logging(opts)
opts
end
# Recreate NondisclosureName under utf-8 circumstance
private
def file_handler_opts
WEBrick::Config::FileHandler.merge({
:FancyIndexing => true,
:NondisclosureName => [
'.ht*', '~*'
]
})
end
#
private
def server_address(server, opts)
"%{prefix}://%{address}:%{port}%{baseurl}" % {
:prefix => server.config[:SSLEnable] ? "https" : "http",
:baseurl => opts["baseurl"] ? "#{opts["baseurl"]}/" : "",
:address => server.config[:BindAddress],
:port => server.config[:Port]
}
end
#
private
def launch_browser(server, opts)
command =
if Utils::Platforms.windows?
"start"
elsif Utils::Platforms.osx?
"open"
else
"xdg-open"
end
system command, server_address(server, opts)
end
# Keep in our area with a thread or detach the server as requested
# by the user. This method determines what we do based on what you
# ask us to do.
private
def boot_or_detach(server, opts)
if opts["detach"]
pid = Process.fork do
server.start
end
Process.detach(pid)
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
"Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
else
t = Thread.new { server.start }
trap("INT") { server.shutdown }
t.join
end
end
# Make the stack verbose if the user requests it.
private
def enable_logging(opts)
opts[:AccessLog] = []
level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN)
opts[:Logger] = WEBrick::Log.new($stdout, level)
end
# Add SSL to the stack if the user triggers --enable-ssl and they
# provide both types of certificates commonly needed. Raise if they
# forget to add one of the certificates.
private
def enable_ssl(opts)
return if !opts[:JekyllOptions]["ssl_cert"] && !opts[:JekyllOptions]["ssl_key"]
if !opts[:JekyllOptions]["ssl_cert"] || !opts[:JekyllOptions]["ssl_key"]
raise RuntimeError, "--ssl-cert or --ssl-key missing."
end
require "openssl"
require "webrick/https"
source_key = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], opts[:JekyllOptions]["ssl_key" ])
source_certificate = Jekyll.sanitized_path(opts[:JekyllOptions]["source"], opts[:JekyllOptions]["ssl_cert"])
opts[:SSLCertificate] = OpenSSL::X509::Certificate.new(File.read(source_certificate))
opts[:SSLPrivateKey ] = OpenSSL::PKey::RSA.new(File.read(source_key))
opts[:SSLEnable] = true
end
private
def start_callback(detached)
unless detached
proc do
Jekyll.logger.info("Server running...", "press ctrl-c to stop.")
end
end
end
private
def mime_types
file = File.expand_path('../mime.types', File.dirname(__FILE__))
WEBrick::HTTPUtils.load_mime_types(file)
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/commands/serve/ 0000775 0000000 0000000 00000000000 12717414063 0020005 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/commands/serve/servlet.rb 0000664 0000000 0000000 00000003170 12717414063 0022017 0 ustar 00root root 0000000 0000000 require "webrick"
module Jekyll
module Commands
class Serve
class Servlet < WEBrick::HTTPServlet::FileHandler
DEFAULTS = {
"Cache-Control" => "private, max-age=0, proxy-revalidate, " \
"no-store, no-cache, must-revalidate"
}
def initialize(server, root, callbacks)
# So we can access them easily.
@jekyll_opts = server.config[:JekyllOptions]
set_defaults
super
end
# Add the ability to tap file.html the same way that Nginx does on our
# Docker images (or on GitHub Pages.) The difference is that we might end
# up with a different preference on which comes first.
def search_file(req, res, basename)
# /file.* > /file/index.html > /file.html
super || super(req, res, "#{basename}.html")
end
#
def do_GET(req, res)
rtn = super
validate_and_ensure_charset(req, res)
res.header.merge!(@headers)
rtn
end
#
private
def validate_and_ensure_charset(_req, res)
key = res.header.keys.grep(/content-type/i).first
typ = res.header[key]
unless typ =~ /;\s*charset=/
res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
end
end
#
private
def set_defaults
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
hash[key] = val unless hash.key?(key)
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/configuration.rb 0000664 0000000 0000000 00000027176 12717414063 0020271 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
class Configuration < Hash
# Default options. Overridden by values in _config.yml.
# Strings rather than symbols are used for compatibility with YAML.
DEFAULTS = Configuration[{
# Where things are
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins_dir' => '_plugins',
'layouts_dir' => '_layouts',
'data_dir' => '_data',
'includes_dir' => '_includes',
'collections' => {},
# Handling Reading
'safe' => false,
'include' => ['.htaccess'],
'exclude' => [],
'keep_files' => ['.git', '.svn'],
'encoding' => 'utf-8',
'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md',
# Filtering Content
'show_drafts' => nil,
'limit_posts' => 0,
'future' => false,
'unpublished' => false,
# Plugins
'whitelist' => [],
'gems' => [],
# Conversion
'markdown' => 'kramdown',
'highlighter' => 'rouge',
'lsi' => false,
'excerpt_separator' => "\n\n",
'incremental' => false,
# Serving
'detach' => false, # default to not detaching the server
'port' => '4000',
'host' => '127.0.0.1',
'baseurl' => '',
# Output Configuration
'permalink' => 'date',
'paginate_path' => '/page:num',
'timezone' => nil, # use the local timezone
'quiet' => false,
'verbose' => false,
'defaults' => [],
'rdiscount' => {
'extensions' => []
},
'redcarpet' => {
'extensions' => []
},
'kramdown' => {
'auto_ids' => true,
'toc_levels' => '1..6',
'entity_output' => 'as_char',
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
'input' => "GFM",
'hard_wrap' => false,
'footnote_nr' => 1
}
}.map { |k, v| [k, v.freeze] }].freeze
class << self
# Static: Produce a Configuration ready for use in a Site.
# It takes the input, fills in the defaults where values do not
# exist, and patches common issues including migrating options for
# backwards compatiblity. Except where a key or value is being fixed,
# the user configuration will override the defaults.
#
# user_config - a Hash or Configuration of overrides.
#
# Returns a Configuration filled with defaults and fixed for common
# problems and backwards-compatibility.
def from(user_config)
Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys).
fix_common_issues.add_default_collections
end
end
# Public: Turn all keys into string
#
# Return a copy of the hash where all its keys are strings
def stringify_keys
reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }
end
def get_config_value_with_override(config_key, override)
override[config_key] || self[config_key] || DEFAULTS[config_key]
end
# Public: Directory of the Jekyll source folder
#
# override - the command-line options hash
#
# Returns the path to the Jekyll source directory
def source(override)
get_config_value_with_override('source', override)
end
def quiet(override = {})
get_config_value_with_override('quiet', override)
end
alias_method :quiet?, :quiet
def verbose(override = {})
get_config_value_with_override('verbose', override)
end
alias_method :verbose?, :verbose
def safe_load_file(filename)
case File.extname(filename)
when /\.toml/i
Jekyll::External.require_with_graceful_fail('toml') unless defined?(TOML)
TOML.load_file(filename)
when /\.ya?ml/i
SafeYAML.load_file(filename) || {}
else
raise ArgumentError, "No parser for '#{filename}' is available. Use a .toml or .y(a)ml file instead."
end
end
# Public: Generate list of configuration files from the override
#
# override - the command-line options hash
#
# Returns an Array of config files
def config_files(override)
# Adjust verbosity quickly
Jekyll.logger.adjust_verbosity(:quiet => quiet?(override), :verbose => verbose?(override))
# Get configuration from /_config.yml or /
config_files = override.delete('config')
if config_files.to_s.empty?
default = %w(yml yaml).find(-> { 'yml' }) do |ext|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
end
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
@default_config_file = true
end
config_files = [config_files] unless config_files.is_a? Array
config_files
end
# Public: Read configuration and return merged Hash
#
# file - the path to the YAML file to be read in
#
# Returns this configuration, overridden by the values in the file
def read_config_file(file)
next_config = safe_load_file(file)
check_config_is_hash!(next_config, file)
Jekyll.logger.info "Configuration file:", file
next_config
rescue SystemCallError
if @default_config_file
Jekyll.logger.warn "Configuration file:", "none"
{}
else
Jekyll.logger.error "Fatal:", "The configuration file '#{file}' could not be found."
raise LoadError, "The Configuration file '#{file}' could not be found."
end
end
# Public: Read in a list of configuration files and merge with this hash
#
# files - the list of configuration file paths
#
# Returns the full configuration, with the defaults overridden by the values in the
# configuration files
def read_config_files(files)
configuration = clone
begin
files.each do |config_file|
next if config_file.nil? or config_file.empty?
new_config = read_config_file(config_file)
configuration = Utils.deep_merge_hashes(configuration, new_config)
end
rescue ArgumentError => err
Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
"Using defaults (and options)."
$stderr.puts "#{err}"
end
configuration.fix_common_issues.backwards_compatibilize.add_default_collections
end
# Public: Split a CSV string into an array containing its values
#
# csv - the string of comma-separated values
#
# Returns an array of the values contained in the CSV
def csv_to_array(csv)
csv.split(",").map(&:strip)
end
# Public: Ensure the proper options are set in the configuration to allow for
# backwards-compatibility with Jekyll pre-1.0
#
# Returns the backwards-compatible configuration
def backwards_compatibilize
config = clone
# Provide backwards-compatibility
if config.key?('auto') || config.key?('watch')
Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
" be set from your configuration file(s). Use the"\
" --[no-]watch/-w command-line option instead."
config.delete('auto')
config.delete('watch')
end
if config.key? 'server'
Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
" is no longer accepted. Use the 'jekyll serve'" \
" subcommand to serve your site with WEBrick."
config.delete('server')
end
renamed_key 'server_port', 'port', config
renamed_key 'plugins', 'plugins_dir', config
renamed_key 'layouts', 'layouts_dir', config
renamed_key 'data_source', 'data_dir', config
if config.key? 'pygments'
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
" has been renamed to 'highlighter'. Please update your" \
" config file accordingly. The allowed values are 'rouge', " \
"'pygments' or null."
config['highlighter'] = 'pygments' if config['pygments']
config.delete('pygments')
end
%w(include exclude).each do |option|
if config[option].is_a?(String)
Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
" must now be specified as an array, but you specified" \
" a string. For now, we've treated the string you provided" \
" as a list of comma-separated values."
config[option] = csv_to_array(config[option])
end
config[option].map!(&:to_s) if config[option]
end
if (config['kramdown'] || {}).key?('use_coderay')
Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
" to 'enable_coderay' in your configuration file."
config['kramdown']['use_coderay'] = config['kramdown'].delete('enable_coderay')
end
if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
"Markdown processor, which has been removed as of 3.0.0. " \
"We recommend you switch to Kramdown. To do this, replace " \
"`markdown: maruku` with `markdown: kramdown` in your " \
"`_config.yml` file."
end
config
end
def fix_common_issues
config = clone
if config.key?('paginate') && (!config['paginate'].is_a?(Integer) || config['paginate'] < 1)
Jekyll.logger.warn "Config Warning:", "The `paginate` key must be a" \
" positive integer or nil. It's currently set to '#{config['paginate'].inspect}'."
config['paginate'] = nil
end
config
end
def add_default_collections
config = clone
# It defaults to `{}`, so this is only if someone sets it to null manually.
return config if config['collections'].nil?
# Ensure we have a hash.
if config['collections'].is_a?(Array)
config['collections'] = Hash[config['collections'].map { |c| [c, {}] }]
end
config['collections'] = Utils.deep_merge_hashes(
{ 'posts' => {} }, config['collections']
).tap do |collections|
collections['posts']['output'] = true
if config['permalink']
collections['posts']['permalink'] ||= style_to_permalink(config['permalink'])
end
end
config
end
def renamed_key(old, new, config, _ = 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
private
def style_to_permalink(permalink_style)
case permalink_style.to_sym
when :pretty
"/:categories/:year/:month/:day/:title/"
when :none
"/:categories/:title:output_ext"
when :date
"/:categories/:year/:month/:day/:title:output_ext"
when :ordinal
"/:categories/:year/:y_day/:title:output_ext"
else
permalink_style.to_s
end
end
# Private: Checks if a given config is a hash
#
# extracted_config - the value to check
# file - the file from which the config was extracted
#
# Raises an ArgumentError if given config is not a hash
def check_config_is_hash!(extracted_config, file)
unless extracted_config.is_a?(Hash)
raise ArgumentError.new("Configuration file: (INVALID) #{file}".yellow)
end
end
end
end
jekyll-3.1.6/lib/jekyll/converter.rb 0000664 0000000 0000000 00000002546 12717414063 0017423 0 ustar 00root root 0000000 0000000 module Jekyll
class Converter < Plugin
# Public: Get or set the highlighter prefix. When an argument is specified,
# the prefix will be set. If no argument is specified, the current prefix
# will be returned.
#
# highlighter_prefix - The String prefix (default: nil).
#
# Returns the String prefix.
def self.highlighter_prefix(highlighter_prefix = nil)
@highlighter_prefix = highlighter_prefix if highlighter_prefix
@highlighter_prefix
end
# Public: Get or set the highlighter suffix. When an argument is specified,
# the suffix will be set. If no argument is specified, the current suffix
# will be returned.
#
# highlighter_suffix - The String suffix (default: nil).
#
# Returns the String suffix.
def self.highlighter_suffix(highlighter_suffix = nil)
@highlighter_suffix = highlighter_suffix if highlighter_suffix
@highlighter_suffix
end
# Initialize the converter.
#
# Returns an initialized Converter.
def initialize(config = {})
@config = config
end
# Get the highlighter prefix.
#
# Returns the String prefix.
def highlighter_prefix
self.class.highlighter_prefix
end
# Get the highlighter suffix.
#
# Returns the String suffix.
def highlighter_suffix
self.class.highlighter_suffix
end
end
end
jekyll-3.1.6/lib/jekyll/converters/ 0000775 0000000 0000000 00000000000 12717414063 0017252 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/converters/identity.rb 0000664 0000000 0000000 00000000422 12717414063 0021426 0 ustar 00root root 0000000 0000000 module Jekyll
module Converters
class Identity < Converter
safe true
priority :lowest
def matches(_ext)
true
end
def output_ext(ext)
ext
end
def convert(content)
content
end
end
end
end
jekyll-3.1.6/lib/jekyll/converters/markdown.rb 0000664 0000000 0000000 00000005237 12717414063 0021430 0 ustar 00root root 0000000 0000000 module Jekyll
module Converters
class Markdown < Converter
highlighter_prefix "\n"
highlighter_suffix "\n"
safe true
def setup
return if @setup
unless (@parser = get_processor)
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
end
@setup = true
end
def get_processor
case @config["markdown"].downcase
when "redcarpet" then return RedcarpetParser.new(@config)
when "kramdown" then return KramdownParser.new(@config)
when "rdiscount" then return RDiscountParser.new(@config)
else
get_custom_processor
end
end
# Public: Provides you with a list of processors, the ones we
# support internally and the ones that you have provided to us (if you
# are not in safe mode.)
def valid_processors
%W(rdiscount kramdown redcarpet) + third_party_processors
end
# Public: A list of processors that you provide via plugins.
# This is really only available if you are not in safe mode, if you are
# in safe mode (re: GitHub) then there will be none.
def third_party_processors
self.class.constants - \
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
&:to_sym
)
end
def extname_list
@extname_list ||= @config['markdown_ext'].split(',').map do |e|
".#{e.downcase}"
end
end
def matches(ext)
extname_list.include?(ext.downcase)
end
def output_ext(_ext)
".html"
end
def convert(content)
setup
@parser.convert(content)
end
private
def get_custom_processor
converter_name = @config["markdown"]
if custom_class_allowed?(converter_name)
self.class.const_get(converter_name).new(@config)
end
end
# Private: Determine whether a class name is an allowed custom
# markdown class name.
#
# parser_name - the name of the parser class
#
# Returns true if the parser name contains only alphanumeric
# characters and is defined within Jekyll::Converters::Markdown
private
def custom_class_allowed?(parser_name)
parser_name !~ /[^A-Za-z0-9_]/ && self.class.constants.include?(
parser_name.to_sym
)
end
end
end
end
jekyll-3.1.6/lib/jekyll/converters/markdown/ 0000775 0000000 0000000 00000000000 12717414063 0021074 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/converters/markdown/kramdown_parser.rb 0000664 0000000 0000000 00000007156 12717414063 0024630 0 ustar 00root root 0000000 0000000 # Frozen-string-literal: true
# Encoding: utf-8
module Jekyll
module Converters
class Markdown
class KramdownParser
CODERAY_DEFAULTS = {
"css" => "style",
"bold_every" => 10,
"line_numbers" => "inline",
"line_number_start" => 1,
"tab_width" => 4,
"wrap" => "div"
}.freeze
def initialize(config)
Jekyll::External.require_with_graceful_fail "kramdown"
@main_fallback_highlighter = config["highlighter"] || "rouge"
@config = config["kramdown"] || {}
setup
end
# Setup and normalize the configuration:
# * Create Kramdown if it doesn't exist.
# * Set syntax_highlighter, detecting enable_coderay and merging highlighter if none.
# * Merge kramdown[coderay] into syntax_highlighter_opts stripping coderay_.
# * Make sure `syntax_highlighter_opts` exists.
def setup
@config["syntax_highlighter"] ||= highlighter
@config["syntax_highlighter_opts"] ||= {}
@config["coderay"] ||= {} # XXX: Legacy.
modernize_coderay_config
make_accessible
end
def convert(content)
Kramdown::Document.new(content, @config).to_html
end
private
def make_accessible(hash = @config)
proc_ = proc { |hash_, key| hash_[key.to_s] if key.is_a?(Symbol) }
hash.default_proc = proc_
hash.each do |_, val|
make_accessible val if val.is_a?(
Hash
)
end
end
# config[kramdown][syntax_higlighter] > config[kramdown][enable_coderay] > config[highlighter]
# Where `enable_coderay` is now deprecated because Kramdown
# supports Rouge now too.
private
def highlighter
return @highlighter if @highlighter
if @config["syntax_highlighter"]
return @highlighter = @config[
"syntax_highlighter"
]
end
@highlighter = begin
if @config.key?("enable_coderay") && @config["enable_coderay"]
Jekyll::Deprecator.deprecation_message "You are using 'enable_coderay', " \
"use syntax_highlighter: coderay in your configuration file."
"coderay"
else
@main_fallback_highlighter
end
end
end
private
def strip_coderay_prefix(hash)
hash.each_with_object({}) do |(key, val), hsh|
cleaned_key = key.gsub(/\Acoderay_/, "")
if key != cleaned_key
Jekyll::Deprecator.deprecation_message(
"You are using '#{key}'. Normalizing to #{cleaned_key}."
)
end
hsh[cleaned_key] = val
end
end
# If our highlighter is CodeRay we go in to merge the CodeRay defaults
# with your "coderay" key if it's there, deprecating it in the
# process of you using it.
private
def modernize_coderay_config
if highlighter == "coderay"
Jekyll::Deprecator.deprecation_message "You are using 'kramdown.coderay' in your configuration, " \
"please use 'syntax_highlighter_opts' instead."
@config["syntax_highlighter_opts"] = begin
strip_coderay_prefix(
@config["syntax_highlighter_opts"] \
.merge(CODERAY_DEFAULTS) \
.merge(@config["coderay"])
)
end
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/converters/markdown/rdiscount_parser.rb 0000664 0000000 0000000 00000001720 12717414063 0025007 0 ustar 00root root 0000000 0000000 module Jekyll
module Converters
class Markdown
class RDiscountParser
def initialize(config)
Jekyll::External.require_with_graceful_fail "rdiscount"
@config = config
@rdiscount_extensions = @config['rdiscount']['extensions'].map(&:to_sym)
end
def convert(content)
rd = RDiscount.new(content, *@rdiscount_extensions)
html = rd.to_html
if @config['rdiscount']['toc_token']
html = replace_generated_toc(rd, html, @config['rdiscount']['toc_token'])
end
html
end
private
def replace_generated_toc(rd, html, toc_token)
if rd.generate_toc && html.include?(toc_token)
utf8_toc = rd.toc_content
utf8_toc.force_encoding('utf-8') if utf8_toc.respond_to?(:force_encoding)
html.gsub(toc_token, utf8_toc)
else
html
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/converters/markdown/redcarpet_parser.rb 0000664 0000000 0000000 00000006214 12717414063 0024751 0 ustar 00root root 0000000 0000000 module Jekyll
module Converters
class Markdown
class RedcarpetParser
module CommonMethods
def add_code_tags(code, lang)
code = code.to_s
code = code.sub(/
/, "
")
code = code.sub(/<\/pre>/, "
")
code
end
end
module WithPygments
include CommonMethods
def block_code(code, lang)
Jekyll::External.require_with_graceful_fail("pygments")
lang = lang && lang.split.first || "text"
add_code_tags(
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
lang
)
end
end
module WithoutHighlighting
require 'cgi'
include CommonMethods
def code_wrap(code)
"
#{CGI::escapeHTML(code)}
"
end
def block_code(code, lang)
lang = lang && lang.split.first || "text"
add_code_tags(code_wrap(code), lang)
end
end
module WithRouge
def block_code(code, lang)
code = "
#{super}
"
output = "
"
output << add_code_tags(code, lang)
output << "
"
end
protected
def rouge_formatter(_lexer)
Rouge::Formatters::HTML.new(:wrap => false)
end
end
def initialize(config)
External.require_with_graceful_fail("redcarpet")
@config = config
@redcarpet_extensions = {}
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
@renderer ||= class_with_proper_highlighter(@config['highlighter'])
end
def class_with_proper_highlighter(highlighter)
case highlighter
when "pygments"
Class.new(Redcarpet::Render::HTML) do
include WithPygments
end
when "rouge"
Class.new(Redcarpet::Render::HTML) do
Jekyll::External.require_with_graceful_fail(%w(
rouge
rouge/plugins/redcarpet
))
unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
end
include Rouge::Plugins::Redcarpet
include CommonMethods
include WithRouge
end
else
Class.new(Redcarpet::Render::HTML) do
include WithoutHighlighting
end
end
end
def convert(content)
@redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
@renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
markdown.render(content)
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/converters/smartypants.rb 0000664 0000000 0000000 00000001346 12717414063 0022170 0 ustar 00root root 0000000 0000000 class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
def initialize(source, options)
super
@block_parsers = [:block_html]
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
end
end
module Jekyll
module Converters
class SmartyPants < Converter
safe true
priority :low
def initialize(config)
Jekyll::External.require_with_graceful_fail "kramdown"
@config = config["kramdown"].dup || {}
@config[:input] = :SmartyPants
end
def matches(_)
false
end
def output_ext(_)
nil
end
def convert(content)
Kramdown::Document.new(content, @config).to_html.chomp
end
end
end
end
jekyll-3.1.6/lib/jekyll/convertible.rb 0000664 0000000 0000000 00000021640 12717414063 0017724 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
require 'set'
# Convertible provides methods for converting a pagelike item
# from a certain type of markup into actual content
#
# Requires
# self.site -> Jekyll::Site
# self.content
# self.content=
# self.data=
# self.ext=
# self.output=
# self.name
# self.path
# self.type -> :page, :post or :draft
module Jekyll
module Convertible
# Returns the contents as a String.
def to_s
content || ''
end
# Whether the file is published or not, as indicated in YAML front-matter
def published?
!(data.key?('published') && data['published'] == false)
end
# Read the YAML frontmatter.
#
# base - The String path to the dir containing the file.
# name - The String filename of the file.
# opts - optional parameter to File.read, default at site configs
#
# Returns nothing.
def read_yaml(base, name, opts = {})
filename = File.join(base, name)
begin
self.content = File.read(site.in_source_dir(base, name),
Utils.merged_file_read_opts(site, opts))
if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
self.content = $POSTMATCH
self.data = SafeYAML.load(Regexp.last_match(1))
end
rescue SyntaxError => e
Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}"
rescue Exception => e
Jekyll.logger.warn "Error reading file #{filename}: #{e.message}"
end
self.data ||= {}
validate_data! filename
validate_permalink! filename
self.data
end
def validate_data!(filename)
unless self.data.is_a?(Hash)
raise Errors::InvalidYAMLFrontMatterError, "Invalid YAML front matter in #{filename}"
end
end
def validate_permalink!(filename)
if self.data['permalink'] && self.data['permalink'].size == 0
raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}"
end
end
# Transform the contents based on the content type.
#
# Returns the transformed contents.
def transform
converters.reduce(content) do |output, converter|
begin
converter.convert output
rescue => e
Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error while converting '#{path}':"
Jekyll.logger.error("", e.to_s)
raise e
end
end
end
# Determine the extension depending on content_type.
#
# Returns the String extension for the output file.
# e.g. ".html" for an HTML output file.
def output_ext
Jekyll::Renderer.new(site, self).output_ext
end
# Determine which converter to use based on this convertible's
# extension.
#
# Returns the Converter instance.
def converters
@converters ||= site.converters.select { |c| c.matches(ext) }.sort
end
# Render Liquid in the content
#
# content - the raw Liquid content to render
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns the converted content
def render_liquid(content, payload, info, path)
site.liquid_renderer.file(path).parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || self.path}"
raise e
rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"
raise e
end
# Convert this Convertible's data to a Hash suitable for use by Liquid.
#
# Returns the Hash representation of this Convertible.
def to_liquid(attrs = nil)
further_data = Hash[(attrs || self.class::ATTRIBUTES_FOR_LIQUID).map do |attribute|
[attribute, send(attribute)]
end]
defaults = site.frontmatter_defaults.all(relative_path, type)
Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
end
# The type of a document,
# i.e., its classname downcase'd and to_sym'd.
#
# Returns the type of self.
def type
if is_a?(Page)
:pages
end
end
# returns the owner symbol for hook triggering
def hook_owner
if is_a?(Page)
:pages
end
end
# Determine whether the document is an asset file.
# Asset files include CoffeeScript files and Sass/SCSS files.
#
# Returns true if the extname belongs to the set of extensions
# that asset files use.
def asset_file?
sass_file? || coffeescript_file?
end
# Determine whether the document is a Sass file.
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w(.sass .scss).include?(ext)
end
# Determine whether the document is a CoffeeScript file.
#
# Returns true if extname == .coffee, false otherwise.
def coffeescript_file?
'.coffee'.eql?(ext)
end
# Determine whether the file should be rendered with Liquid.
#
# Always returns true.
def render_with_liquid?
true
end
# Determine whether the file should be placed into layouts.
#
# Returns false if the document is an asset file.
def place_in_layout?
!asset_file?
end
# Checks if the layout specified in the document actually exists
#
# layout - the layout to check
#
# Returns true if the layout is invalid, false if otherwise
def invalid_layout?(layout)
!data["layout"].nil? && layout.nil? && !(self.is_a? Jekyll::Excerpt)
end
# Recursively render layouts
#
# layouts - a list of the layouts
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns nothing
def render_all_layouts(layouts, payload, info)
# recursively render layouts
layout = layouts[data["layout"]]
Jekyll.logger.warn("Build Warning:", "Layout '#{data["layout"]}' requested in #{path} does not exist.") if invalid_layout? layout
used = Set.new([layout])
# Reset the payload layout data to ensure it starts fresh for each page.
payload["layout"] = nil
while layout
Jekyll.logger.debug "Rendering Layout:", path
payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
self.output = render_liquid(layout.content,
payload,
info,
File.join(site.config['layouts_dir'], layout.name))
# Add layout to dependency tree
site.regenerator.add_dependency(
site.in_source_dir(path),
site.in_source_dir(layout.path)
)
if layout = layouts[layout.data["layout"]]
if used.include?(layout)
layout = nil # avoid recursive chain
else
used << layout
end
end
end
end
# Add any necessary layouts to this convertible document.
#
# payload - The site payload Drop or Hash.
# layouts - A Hash of {"name" => "layout"}.
#
# Returns nothing.
def do_layout(payload, layouts)
Jekyll.logger.debug "Rendering:", self.relative_path
Jekyll.logger.debug "Pre-Render Hooks:", self.relative_path
Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
info = { :filters => [Jekyll::Filters], :registers => { :site => site, :page => payload["page"] } }
# render and transform content (this becomes the final content of the object)
payload["highlighter_prefix"] = converters.first.highlighter_prefix
payload["highlighter_suffix"] = converters.first.highlighter_suffix
if render_with_liquid?
Jekyll.logger.debug "Rendering Liquid:", self.relative_path
self.content = render_liquid(content, payload, info, path)
end
Jekyll.logger.debug "Rendering Markup:", self.relative_path
self.content = transform
# output keeps track of what will finally be written
self.output = content
render_all_layouts(layouts, payload, info) if place_in_layout?
Jekyll.logger.debug "Post-Render Hooks:", self.relative_path
Jekyll::Hooks.trigger hook_owner, :post_render, self
end
# Write the generated page file to the destination directory.
#
# dest - The String path to the destination dir.
#
# Returns nothing.
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'wb') do |f|
f.write(output)
end
Jekyll::Hooks.trigger hook_owner, :post_write, self
end
# Accessor for data properties by Liquid.
#
# property - The String name of the property to retrieve.
#
# Returns the String value or nil if the property isn't included.
def [](property)
if self.class::ATTRIBUTES_FOR_LIQUID.include?(property)
send(property)
else
data[property]
end
end
end
end
jekyll-3.1.6/lib/jekyll/deprecator.rb 0000664 0000000 0000000 00000003566 12717414063 0017547 0 ustar 00root root 0000000 0000000 module Jekyll
module Deprecator
extend self
def process(args)
arg_is_present? args, "--server", "The --server command has been replaced by the \
'serve' subcommand."
arg_is_present? args, "--serve", "The --server command has been replaced by the \
'serve' subcommand."
arg_is_present? args, "--no-server", "To build Jekyll without launching a server, \
use the 'build' subcommand."
arg_is_present? args, "--auto", "The switch '--auto' has been replaced with '--watch'."
arg_is_present? args, "--no-auto", "To disable auto-replication, simply leave off \
the '--watch' switch."
arg_is_present? args, "--pygments", "The 'pygments'settings has been removed in \
favour of 'highlighter'."
arg_is_present? args, "--paginate", "The 'paginate' setting can only be set in your \
config files."
arg_is_present? args, "--url", "The 'url' setting can only be set in your config files."
no_subcommand(args)
end
def no_subcommand(args)
if args.size > 0 && args.first =~ /^--/ && !%w(--help --version).include?(args.first)
deprecation_message "Jekyll now uses subcommands instead of just switches. Run `jekyll help` to find out more."
abort
end
end
def arg_is_present?(args, deprecated_argument, message)
if args.include?(deprecated_argument)
deprecation_message(message)
end
end
def deprecation_message(message)
Jekyll.logger.error "Deprecation:", message
end
def defaults_deprecate_type(old, current)
Jekyll.logger.warn "Defaults:", "The '#{old}' type has become '#{current}'."
Jekyll.logger.warn "Defaults:", "Please update your front-matter defaults to use 'type: #{current}'."
end
end
end
jekyll-3.1.6/lib/jekyll/document.rb 0000664 0000000 0000000 00000032535 12717414063 0017233 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
class Document
include Comparable
attr_reader :path, :site, :extname, :collection
attr_accessor :content, :output
YAML_FRONT_MATTER_REGEXP = /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
DATELESS_FILENAME_MATCHER = /^(.+\/)*(.*)(\.[^.]+)$/
DATE_FILENAME_MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
# Create a new Document.
#
# path - the path to the file
# relations - a hash with keys :site and :collection, the values of which
# are the Jekyll::Site and Jekyll::Collection to which this
# Document belong.
#
# Returns nothing.
def initialize(path, relations = {})
@site = relations[:site]
@path = path
@extname = File.extname(path)
@collection = relations[:collection]
@has_yaml_header = nil
if draft?
categories_from_path("_drafts")
else
categories_from_path(collection.relative_directory)
end
data.default_proc = proc do |_, key|
site.frontmatter_defaults.find(relative_path, collection.label, key)
end
trigger_hooks(:post_init)
end
# Fetch the Document's data.
#
# Returns a Hash containing the data. An empty hash is returned if
# no data was read.
def data
@data ||= {}
end
# Merge some data in with this document's data.
#
# Returns the merged data.
def merge_data!(other, source: "YAML front matter")
if other.key?('categories') && !other['categories'].nil?
if other['categories'].is_a?(String)
other['categories'] = other['categories'].split(" ").map(&:strip)
end
other['categories'] = (data['categories'] || []) | other['categories']
end
Utils.deep_merge_hashes!(data, other)
if data.key?('date') && !data['date'].is_a?(Time)
data['date'] = Utils.parse_date(
data['date'].to_s,
"Document '#{relative_path}' does not have a valid date in the #{source}."
)
end
data
end
def date
data['date'] ||= site.time
end
# Returns whether the document is a draft. This is only the case if
# the document is in the 'posts' collection but in a different
# directory than '_posts'.
#
# Returns whether the document is a draft.
def draft?
data['draft'] ||= relative_path.index(collection.relative_directory).nil? && collection.label == "posts"
end
# The path to the document, relative to the site source.
#
# Returns a String path which represents the relative path
# from the site source to this document
def relative_path
@relative_path ||= Pathname.new(path).relative_path_from(Pathname.new(site.source)).to_s
end
# The output extension of the document.
#
# Returns the output extension
def output_ext
Jekyll::Renderer.new(site, self).output_ext
end
# The base filename of the document, without the file extname.
#
# Returns the basename without the file extname.
def basename_without_ext
@basename_without_ext ||= File.basename(path, '.*')
end
# The base filename of the document.
#
# Returns the base filename of the document.
def basename
@basename ||= File.basename(path)
end
# Produces a "cleaned" relative path.
# The "cleaned" relative path is the relative path without the extname
# and with the collection's directory removed as well.
# This method is useful when building the URL of the document.
#
# Examples:
# When relative_path is "_methods/site/generate.md":
# cleaned_relative_path
# # => "/site/generate"
#
# Returns the cleaned relative path of the document.
def cleaned_relative_path
@cleaned_relative_path ||=
relative_path[0..-extname.length - 1].sub(collection.relative_directory, "")
end
# Determine whether the document is a YAML file.
#
# Returns true if the extname is either .yml or .yaml, false otherwise.
def yaml_file?
%w(.yaml .yml).include?(extname)
end
# Determine whether the document is an asset file.
# Asset files include CoffeeScript files and Sass/SCSS files.
#
# Returns true if the extname belongs to the set of extensions
# that asset files use.
def asset_file?
sass_file? || coffeescript_file?
end
# Determine whether the document is a Sass file.
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w(.sass .scss).include?(extname)
end
# Determine whether the document is a CoffeeScript file.
#
# Returns true if extname == .coffee, false otherwise.
def coffeescript_file?
'.coffee'.eql?(extname)
end
# Determine whether the file should be rendered with Liquid.
#
# Returns false if the document is either an asset file or a yaml file,
# true otherwise.
def render_with_liquid?
!(coffeescript_file? || yaml_file?)
end
# Determine whether the file should be placed into layouts.
#
# Returns false if the document is either an asset file or a yaml file,
# true otherwise.
def place_in_layout?
!(asset_file? || yaml_file?)
end
# The URL template where the document would be accessible.
#
# Returns the URL template for the document.
def url_template
collection.url_template
end
# Construct a Hash of key-value pairs which contain a mapping between
# a key in the URL template and the corresponding value for this document.
#
# Returns the Hash of key-value pairs for replacement in the URL.
def url_placeholders
@url_placeholders ||= Drops::UrlDrop.new(self)
end
# The permalink for this Document.
# Permalink is set via the data Hash.
#
# Returns the permalink or nil if no permalink was set in the data.
def permalink
data && data.is_a?(Hash) && data['permalink']
end
# The computed URL for the document. See `Jekyll::URL#to_s` for more details.
#
# Returns the computed URL for the document.
def url
@url = URL.new({
:template => url_template,
:placeholders => url_placeholders,
:permalink => permalink
}).to_s
end
def [](key)
data[key]
end
# The full path to the output file.
#
# base_directory - the base path of the output directory
#
# Returns the full path to the output file of this document.
def destination(base_directory)
dest = site.in_dest_dir(base_directory)
path = site.in_dest_dir(dest, URL.unescape_path(url))
if url.end_with? "/"
path = File.join(path, "index.html")
else
path << output_ext unless path.end_with? output_ext
end
path
end
# Write the generated Document file to the destination directory.
#
# dest - The String path to the destination dir.
#
# Returns nothing.
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'wb') do |f|
f.write(output)
end
trigger_hooks(:post_write)
end
# Whether the file is published or not, as indicated in YAML front-matter
#
# Returns true if the 'published' key is specified in the YAML front-matter and not `false`.
def published?
!(data.key?('published') && data['published'] == false)
end
# Read in the file and assign the content and data based on the file contents.
# Merge the frontmatter of the file with the frontmatter default
# values
#
# Returns nothing.
def read(opts = {})
Jekyll.logger.debug "Reading:", relative_path
if yaml_file?
@data = SafeYAML.load_file(path)
else
begin
defaults = @site.frontmatter_defaults.all(relative_path, collection.label.to_sym)
merge_data!(defaults, source: "front matter defaults") unless defaults.empty?
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load(Regexp.last_match(1))
merge_data!(data_file, source: "YAML front matter") if data_file
end
post_read
rescue SyntaxError => e
Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
rescue Exception => e
if e.is_a? Jekyll::Errors::FatalException
raise e
end
Jekyll.logger.error "Error:", "could not read file #{path}: #{e.message}"
end
end
end
def post_read
if relative_path =~ DATE_FILENAME_MATCHER
date, slug, ext = $2, $3, $4
if !data['date'] || data['date'].to_i == site.time.to_i
merge_data!({"date" => date}, source: "filename")
end
elsif relative_path =~ DATELESS_FILENAME_MATCHER
slug, ext = $2, $3
end
# Try to ensure the user gets a title.
data["title"] ||= Utils.titleize_slug(slug)
# Only overwrite slug & ext if they aren't specified.
data['slug'] ||= slug
data['ext'] ||= ext
populate_categories
populate_tags
generate_excerpt
end
# Add superdirectories of the special_dir to categories.
# In the case of es/_posts, 'es' is added as a category.
# In the case of _posts/es, 'es' is NOT added as a category.
#
# Returns nothing.
def categories_from_path(special_dir)
superdirs = relative_path.sub(/#{special_dir}(.*)/, '').split(File::SEPARATOR).reject do |c|
c.empty? || c.eql?(special_dir) || c.eql?(basename)
end
merge_data!({ 'categories' => superdirs }, source: "file path")
end
def populate_categories
merge_data!({
'categories' => (
Array(data['categories']) + Utils.pluralized_array_from_hash(data, 'category', 'categories')
).map(&:to_s).flatten.uniq
})
end
def populate_tags
merge_data!({
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
})
end
# Create a Liquid-understandable version of this Document.
#
# Returns a Hash representing this Document's data.
def to_liquid
@to_liquid ||= Drops::DocumentDrop.new(self)
end
# The inspect string for this document.
# Includes the relative path and the collection label.
#
# Returns the inspect string for this document.
def inspect
"#"
end
# The string representation for this document.
#
# Returns the content of the document
def to_s
output || content || 'NO CONTENT'
end
# Compare this document against another document.
# Comparison is a comparison between the 2 paths of the documents.
#
# Returns -1, 0, +1 or nil depending on whether this doc's path is less than,
# equal or greater than the other doc's path. See String#<=> for more details.
def <=>(other)
return nil unless other.respond_to?(:data)
cmp = data['date'] <=> other.data['date']
cmp = path <=> other.path if cmp.nil? || cmp == 0
cmp
end
# Determine whether this document should be written.
# Based on the Collection to which it belongs.
#
# True if the document has a collection and if that collection's #write?
# method returns true, otherwise false.
def write?
collection && collection.write?
end
# The Document excerpt_separator, from the YAML Front-Matter or site
# default excerpt_separator value
#
# Returns the document excerpt_separator
def excerpt_separator
(data['excerpt_separator'] || site.config['excerpt_separator']).to_s
end
# Whether to generate an excerpt
#
# Returns true if the excerpt separator is configured.
def generate_excerpt?
!excerpt_separator.empty?
end
def next_doc
pos = collection.docs.index { |post| post.equal?(self) }
if pos && pos < collection.docs.length - 1
collection.docs[pos + 1]
else
nil
end
end
def previous_doc
pos = collection.docs.index { |post| post.equal?(self) }
if pos && pos > 0
collection.docs[pos - 1]
else
nil
end
end
def trigger_hooks(hook_name, *args)
Jekyll::Hooks.trigger collection.label.to_sym, hook_name, self, *args if collection
Jekyll::Hooks.trigger :documents, hook_name, self, *args
end
def id
@id ||= File.join(File.dirname(url), (data['slug'] || basename_without_ext).to_s)
end
# Calculate related posts.
#
# Returns an Array of related Posts.
def related_posts
Jekyll::RelatedPosts.new(self).build
end
# Override of normal respond_to? to match method_missing's logic for
# looking in @data.
def respond_to?(method, include_private = false)
data.key?(method.to_s) || super
end
# Override of method_missing to check in @data for the key.
def method_missing(method, *args, &blck)
if data.key?(method.to_s)
Jekyll.logger.warn "Deprecation:", "Document##{method} is now a key in the #data hash."
Jekyll.logger.warn "", "Called by #{caller.first}."
data[method.to_s]
else
super
end
end
private # :nodoc:
def generate_excerpt
if generate_excerpt?
data["excerpt"] ||= Jekyll::Excerpt.new(self)
end
end
end
end
jekyll-3.1.6/lib/jekyll/drops/ 0000775 0000000 0000000 00000000000 12717414063 0016207 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/drops/collection_drop.rb 0000664 0000000 0000000 00000000634 12717414063 0021716 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class CollectionDrop < Drop
extend Forwardable
mutable false
def_delegator :@obj, :write?, :output
def_delegators :@obj, :label, :docs, :files, :directory,
:relative_directory
def to_s
docs.to_s
end
private
def_delegator :@obj, :metadata, :fallback_data
end
end
end
jekyll-3.1.6/lib/jekyll/drops/document_drop.rb 0000664 0000000 0000000 00000003060 12717414063 0021375 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class DocumentDrop < Drop
extend Forwardable
NESTED_OBJECT_FIELD_BLACKLIST = %w{
content output excerpt next previous
}.freeze
mutable false
def_delegator :@obj, :relative_path, :path
def_delegators :@obj, :id, :output, :content, :to_s, :relative_path, :url
def collection
@obj.collection.label
end
def excerpt
fallback_data['excerpt'].to_s
end
def previous
@obj.previous_doc.to_liquid
end
def next
@obj.next_doc.to_liquid
end
# Generate a Hash for use in generating JSON.
# This is useful if fields need to be cleared before the JSON can generate.
#
# Returns a Hash ready for JSON generation.
def hash_for_json(state = nil)
to_h.tap do |hash|
if state && state.depth >= 2
hash["previous"] = collapse_document(hash["previous"]) if hash["previous"]
hash["next"] = collapse_document(hash["next"]) if hash["next"]
end
end
end
# Generate a Hash which breaks the recursive chain.
# Certain fields which are normally available are omitted.
#
# Returns a Hash with only non-recursive fields present.
def collapse_document(doc)
doc.keys.each_with_object({}) do |(key, _), result|
result[key] = doc[key] unless NESTED_OBJECT_FIELD_BLACKLIST.include?(key)
end
end
private
def_delegator :@obj, :data, :fallback_data
end
end
end
jekyll-3.1.6/lib/jekyll/drops/drop.rb 0000664 0000000 0000000 00000013565 12717414063 0017512 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class Drop < Liquid::Drop
include Enumerable
NON_CONTENT_METHODS = [:fallback_data, :collapse_document].freeze
# Get or set whether the drop class is mutable.
# Mutability determines whether or not pre-defined fields may be
# overwritten.
#
# is_mutable - Boolean set mutability of the class (default: nil)
#
# Returns the mutability of the class
def self.mutable(is_mutable = nil)
if is_mutable
@is_mutable = is_mutable
else
@is_mutable = false
end
end
def self.mutable?
@is_mutable
end
# Create a new Drop
#
# obj - the Jekyll Site, Collection, or Document required by the
# drop.
#
# Returns nothing
def initialize(obj)
@obj = obj
@mutations = {} # only if mutable: true
end
# Access a method in the Drop or a field in the underlying hash data.
# If mutable, checks the mutations first. Then checks the methods,
# and finally check the underlying hash (e.g. document front matter)
# if all the previous places didn't match.
#
# key - the string key whose value to fetch
#
# Returns the value for the given key, or nil if none exists
def [](key)
if self.class.mutable? && @mutations.key?(key)
@mutations[key]
elsif self.class.invokable? key
public_send key
else
fallback_data[key]
end
end
# Set a field in the Drop. If mutable, sets in the mutations and
# returns. If not mutable, checks first if it's trying to override a
# Drop method and raises a DropMutationException if so. If not
# mutable and the key is not a method on the Drop, then it sets the
# key to the value in the underlying hash (e.g. document front
# matter)
#
# key - the String key whose value to set
# val - the Object to set the key's value to
#
# Returns the value the key was set to unless the Drop is not mutable
# and the key matches a method in which case it raises a
# DropMutationException.
def []=(key, val)
if respond_to?("#{key}=")
public_send("#{key}=", val)
elsif respond_to? key
if self.class.mutable?
@mutations[key] = val
else
raise Errors::DropMutationException, "Key #{key} cannot be set in the drop."
end
else
fallback_data[key] = val
end
end
# Generates a list of strings which correspond to content getter
# methods.
#
# Returns an Array of strings which represent method-specific keys.
def content_methods
@content_methods ||= (
self.class.instance_methods - Jekyll::Drops::Drop.instance_methods - NON_CONTENT_METHODS
).map(&:to_s).reject do |method|
method.end_with?("=")
end
end
# Check if key exists in Drop
#
# key - the string key whose value to fetch
#
# Returns true if the given key is present
def key?(key)
if self.class.mutable && @mutations.key?(key)
true
else
respond_to?(key) || fallback_data.key?(key)
end
end
# Generates a list of keys with user content as their values.
# This gathers up the Drop methods and keys of the mutations and
# underlying data hashes and performs a set union to ensure a list
# of unique keys for the Drop.
#
# Returns an Array of unique keys for content for the Drop.
def keys
(content_methods |
@mutations.keys |
fallback_data.keys).flatten
end
# Generate a Hash representation of the Drop by resolving each key's
# value. It includes Drop methods, mutations, and the underlying object's
# data. See the documentation for Drop#keys for more.
#
# Returns a Hash with all the keys and values resolved.
def to_h
keys.each_with_object({}) do |(key, _), result|
result[key] = self[key]
end
end
alias_method :to_hash, :to_h
# Inspect the drop's keys and values through a JSON representation
# of its keys and values.
#
# Returns a pretty generation of the hash representation of the Drop.
def inspect
require 'json'
JSON.pretty_generate to_h
end
# Generate a Hash for use in generating JSON.
# This is useful if fields need to be cleared before the JSON can generate.
#
# Returns a Hash ready for JSON generation.
def hash_for_json(state = nil)
to_h
end
# Generate a JSON representation of the Drop.
#
# Returns a JSON representation of the Drop in a String.
def to_json(state = nil)
require 'json'
JSON.generate(hash_for_json(state), state)
end
# Collects all the keys and passes each to the block in turn.
#
# block - a block which accepts one argument, the key
#
# Returns nothing.
def each_key(&block)
keys.each(&block)
end
def each(&block)
each_key.each do |key|
yield key, self[key]
end
end
def merge(other, &block)
self.dup.tap do |me|
if block.nil?
me.merge!(other)
else
me.merge!(other, block)
end
end
end
def merge!(other)
other.each_key do |key|
if block_given?
self[key] = yield key, self[key], other[key]
else
if Utils.mergable?(self[key]) && Utils.mergable?(other[key])
self[key] = Utils.deep_merge_hashes(self[key], other[key])
next
end
self[key] = other[key] unless other[key].nil?
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/drops/excerpt_drop.rb 0000664 0000000 0000000 00000000313 12717414063 0021227 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class ExcerptDrop < DocumentDrop
def layout
@obj.doc.data['layout']
end
def excerpt
nil
end
end
end
end
jekyll-3.1.6/lib/jekyll/drops/jekyll_drop.rb 0000664 0000000 0000000 00000001024 12717414063 0021047 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class JekyllDrop < Liquid::Drop
class << self
def global
@global ||= JekyllDrop.new
end
end
def version
Jekyll::VERSION
end
def environment
Jekyll.env
end
def to_h
@to_h ||= {
"version" => version,
"environment" => environment
}
end
def to_json(state = nil)
require 'json'
JSON.generate(to_h, state)
end
end
end
end
jekyll-3.1.6/lib/jekyll/drops/site_drop.rb 0000664 0000000 0000000 00000001554 12717414063 0020531 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class SiteDrop < Drop
extend Forwardable
mutable false
def_delegator :@obj, :site_data, :data
def_delegators :@obj, :time, :pages, :static_files, :documents,
:tags, :categories
def [](key)
if @obj.collections.key?(key) && key != "posts"
@obj.collections[key].docs
else
super(key)
end
end
def posts
@site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
end
def html_pages
@site_html_pages ||= @obj.pages.select { |page| page.html? || page.url.end_with?("/") }
end
def collections
@site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid)
end
private
def_delegator :@obj, :config, :fallback_data
end
end
end
jekyll-3.1.6/lib/jekyll/drops/unified_payload_drop.rb 0000664 0000000 0000000 00000000671 12717414063 0022720 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class UnifiedPayloadDrop < Drop
mutable true
attr_accessor :page, :layout, :content, :paginator
attr_accessor :highlighter_prefix, :highlighter_suffix
def jekyll
JekyllDrop.global
end
def site
@site_drop ||= SiteDrop.new(@obj)
end
private
def fallback_data
@fallback_data ||= {}
end
end
end
end
jekyll-3.1.6/lib/jekyll/drops/url_drop.rb 0000664 0000000 0000000 00000003052 12717414063 0020362 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Drops
class UrlDrop < Drop
extend Forwardable
mutable false
def_delegator :@obj, :cleaned_relative_path, :path
def_delegator :@obj, :output_ext, :output_ext
def collection
@obj.collection.label
end
def name
Utils.slugify(@obj.basename_without_ext)
end
def title
Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
end
def slug
Utils.slugify(@obj.data['slug']) || Utils.slugify(@obj.basename_without_ext)
end
def categories
category_set = Set.new
Array(@obj.data['categories']).each do |category|
category_set << category.to_s.downcase
end
category_set.to_a.join('/')
end
def year
@obj.date.strftime("%Y")
end
def month
@obj.date.strftime("%m")
end
def day
@obj.date.strftime("%d")
end
def hour
@obj.date.strftime("%H")
end
def minute
@obj.date.strftime("%M")
end
def second
@obj.date.strftime("%S")
end
def i_day
@obj.date.strftime("%-d")
end
def i_month
@obj.date.strftime("%-m")
end
def short_month
@obj.date.strftime("%b")
end
def short_year
@obj.date.strftime("%y")
end
def y_day
@obj.date.strftime("%j")
end
end
end
end
jekyll-3.1.6/lib/jekyll/entry_filter.rb 0000664 0000000 0000000 00000003356 12717414063 0020122 0 ustar 00root root 0000000 0000000 module Jekyll
class EntryFilter
SPECIAL_LEADING_CHARACTERS = ['.', '_', '#'].freeze
attr_reader :site
def initialize(site, base_directory = nil)
@site = site
@base_directory = derive_base_directory(@site, base_directory.to_s.dup)
end
def base_directory
@base_directory.to_s
end
def derive_base_directory(site, base_dir)
if base_dir.start_with?(site.source)
base_dir[site.source] = ""
end
base_dir
end
def relative_to_source(entry)
File.join(base_directory, entry)
end
def filter(entries)
entries.reject do |e|
unless included?(e)
special?(e) || backup?(e) || excluded?(e) || symlink?(e)
end
end
end
def included?(entry)
glob_include?(site.include, entry)
end
def special?(entry)
SPECIAL_LEADING_CHARACTERS.include?(entry[0..0]) ||
SPECIAL_LEADING_CHARACTERS.include?(File.basename(entry)[0..0])
end
def backup?(entry)
entry[-1..-1] == '~'
end
def excluded?(entry)
excluded = glob_include?(site.exclude, relative_to_source(entry))
Jekyll.logger.debug "EntryFilter:", "excluded #{relative_to_source(entry)}" if excluded
excluded
end
def symlink?(entry)
File.symlink?(entry) && site.safe
end
def ensure_leading_slash(path)
path[0..0] == "/" ? path : "/#{path}"
end
# Returns true if path matches against any glob pattern.
# Look for more detail about glob pattern in method File::fnmatch.
def glob_include?(enum, e)
entry = ensure_leading_slash(e)
enum.any? do |exp|
item = ensure_leading_slash(exp)
File.fnmatch?(item, entry) || entry.start_with?(item)
end
end
end
end
jekyll-3.1.6/lib/jekyll/errors.rb 0000664 0000000 0000000 00000000510 12717414063 0016715 0 ustar 00root root 0000000 0000000 module Jekyll
module Errors
FatalException = Class.new(::RuntimeError)
DropMutationException = Class.new(FatalException)
InvalidPermalinkError = Class.new(FatalException)
InvalidYAMLFrontMatterError = Class.new(FatalException)
MissingDependencyException = Class.new(FatalException)
end
end
jekyll-3.1.6/lib/jekyll/excerpt.rb 0000664 0000000 0000000 00000006016 12717414063 0017062 0 ustar 00root root 0000000 0000000 module Jekyll
class Excerpt
extend Forwardable
attr_accessor :doc
attr_accessor :content, :ext
attr_writer :output
def_delegators :@doc, :site, :name, :ext, :relative_path, :extname,
:render_with_liquid?, :collection, :related_posts, :url
# Initialize this Excerpt instance.
#
# doc - The Document.
#
# Returns the new Excerpt.
def initialize(doc)
self.doc = doc
self.content = extract_excerpt(doc.content)
end
# Fetch YAML front-matter data from related doc, without layout key
#
# Returns Hash of doc data
def data
@data ||= doc.data.dup
@data.delete("layout")
@data.delete("excerpt")
@data
end
def trigger_hooks(*)
end
# 'Path' of the excerpt.
#
# Returns the path for the doc this excerpt belongs to with #excerpt appended
def path
File.join(doc.path, "#excerpt")
end
# Check if excerpt includes a string
#
# Returns true if the string passed in
def include?(something)
(output && output.include?(something)) || content.include?(something)
end
# The UID for this doc (useful in feeds).
# e.g. /2008/11/05/my-awesome-doc
#
# Returns the String UID.
def id
"#{doc.id}#excerpt"
end
def to_s
output || content
end
def to_liquid
Jekyll::Drops::ExcerptDrop.new(self)
end
# Returns the shorthand String identifier of this doc.
def inspect
""
end
def output
@output ||= Renderer.new(doc.site, self, site.site_payload).run
end
def place_in_layout?
false
end
protected
# Internal: Extract excerpt from the content
#
# By default excerpt is your first paragraph of a doc: everything before
# the first two new lines:
#
# ---
# title: Example
# ---
#
# First paragraph with [link][1].
#
# Second paragraph.
#
# [1]: http://example.com/
#
# This is fairly good option for Markdown and Textile files. But might cause
# problems for HTML docs (which is quite unusual for Jekyll). If default
# excerpt delimiter is not good for you, you might want to set your own via
# configuration option `excerpt_separator`. For example, following is a good
# alternative for HTML docs:
#
# # file: _config.yml
# excerpt_separator: ""
#
# Notice that all markdown-style link references will be appended to the
# excerpt. So the example doc above will have this excerpt source:
#
# First paragraph with [link][1].
#
# [1]: http://example.com/
#
# Excerpts are rendered same time as content is rendered.
#
# Returns excerpt String
def extract_excerpt(doc_content)
head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
if tail.empty?
head
else
"" << head << "\n\n" << tail.scan(/^\[[^\]]+\]:.+$/).join("\n")
end
end
end
end
jekyll-3.1.6/lib/jekyll/external.rb 0000664 0000000 0000000 00000003225 12717414063 0017231 0 ustar 00root root 0000000 0000000 module Jekyll
module External
class << self
#
# Gems that, if installed, should be loaded.
# Usually contain subcommands.
#
def blessed_gems
%w(
jekyll-docs
jekyll-import
)
end
#
# Require a gem or file if it's present, otherwise silently fail.
#
# names - a string gem name or array of gem names
#
def require_if_present(names, &block)
Array(names).each do |name|
begin
require name
rescue LoadError
Jekyll.logger.debug "Couldn't load #{name}. Skipping."
block.call(name) if block
false
end
end
end
#
# Require a gem or gems. If it's not present, show a very nice error
# message that explains everything and is much more helpful than the
# normal LoadError.
#
# names - a string gem name or array of gem names
#
def require_with_graceful_fail(names)
Array(names).each do |name|
begin
Jekyll.logger.debug "Requiring:", "#{name}"
require name
rescue LoadError => e
Jekyll.logger.error "Dependency Error:", <<-MSG
Yikes! It looks like you don't have #{name} or one of its dependencies installed.
In order to use Jekyll as currently configured, you'll need to install this gem.
The full error message from Ruby is: '#{e.message}'
If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!
MSG
raise Jekyll::Errors::MissingDependencyException.new(name)
end
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/filters.rb 0000664 0000000 0000000 00000022006 12717414063 0017055 0 ustar 00root root 0000000 0000000 require 'uri'
require 'json'
require 'date'
module Jekyll
module Filters
# Convert a Markdown string into HTML output.
#
# input - The Markdown String to convert.
#
# Returns the HTML formatted String.
def markdownify(input)
site = @context.registers[:site]
converter = site.find_converter_instance(Jekyll::Converters::Markdown)
converter.convert(input)
end
# Convert a Markdown string into HTML output.
#
# input - The Markdown String to convert.
#
# Returns the HTML formatted String.
def smartify(input)
site = @context.registers[:site]
converter = site.find_converter_instance(Jekyll::Converters::SmartyPants)
converter.convert(input)
end
# Convert a Sass string into CSS output.
#
# input - The Sass String to convert.
#
# Returns the CSS formatted String.
def sassify(input)
site = @context.registers[:site]
converter = site.find_converter_instance(Jekyll::Converters::Sass)
converter.convert(input)
end
# Convert a Scss string into CSS output.
#
# input - The Scss String to convert.
#
# Returns the CSS formatted String.
def scssify(input)
site = @context.registers[:site]
converter = site.find_converter_instance(Jekyll::Converters::Scss)
converter.convert(input)
end
# Slugify a filename or title.
#
# input - The filename or title to slugify.
# mode - how string is slugified
#
# Returns the given filename or title as a lowercase URL String.
# See Utils.slugify for more detail.
def slugify(input, mode=nil)
Utils.slugify(input, :mode => mode)
end
# Format a date in short format e.g. "27 Jan 2011".
#
# date - the Time to format.
#
# Returns the formatting String.
def date_to_string(date)
time(date).strftime("%d %b %Y")
end
# Format a date in long format e.g. "27 January 2011".
#
# date - The Time to format.
#
# Returns the formatted String.
def date_to_long_string(date)
time(date).strftime("%d %B %Y")
end
# Format a date for use in XML.
#
# date - The Time to format.
#
# Examples
#
# date_to_xmlschema(Time.now)
# # => "2011-04-24T20:34:46+08:00"
#
# Returns the formatted String.
def date_to_xmlschema(date)
time(date).xmlschema
end
# Format a date according to RFC-822
#
# date - The Time to format.
#
# Examples
#
# date_to_rfc822(Time.now)
# # => "Sun, 24 Apr 2011 12:34:46 +0000"
#
# Returns the formatted String.
def date_to_rfc822(date)
time(date).rfc822
end
# XML escape a string for use. Replaces any special characters with
# appropriate HTML entity replacements.
#
# input - The String to escape.
#
# Examples
#
# xml_escape('foo "bar" ')
# # => "foo "bar" <baz>"
#
# Returns the escaped String.
def xml_escape(input)
CGI.escapeHTML(input.to_s)
end
# CGI escape a string for use in a URL. Replaces any special characters
# with appropriate %XX replacements.
#
# input - The String to escape.
#
# Examples
#
# cgi_escape('foo,bar;baz?')
# # => "foo%2Cbar%3Bbaz%3F"
#
# Returns the escaped String.
def cgi_escape(input)
CGI::escape(input)
end
# URI escape a string.
#
# input - The String to escape.
#
# Examples
#
# uri_escape('foo, bar \\baz?')
# # => "foo,%20bar%20%5Cbaz?"
#
# Returns the escaped String.
def uri_escape(input)
URI.escape(input)
end
# Count the number of words in the input string.
#
# input - The String on which to operate.
#
# Returns the Integer word count.
def number_of_words(input)
input.split.length
end
# Join an array of things into a string by separating with commas and the
# word "and" for the last one.
#
# array - The Array of Strings to join.
#
# Examples
#
# array_to_sentence_string(["apples", "oranges", "grapes"])
# # => "apples, oranges, and grapes"
#
# Returns the formatted String.
def array_to_sentence_string(array)
connector = "and"
case array.length
when 0
""
when 1
array[0].to_s
when 2
"#{array[0]} #{connector} #{array[1]}"
else
"#{array[0...-1].join(', ')}, #{connector} #{array[-1]}"
end
end
# Convert the input into json string
#
# input - The Array or Hash to be converted
#
# Returns the converted json string
def jsonify(input)
as_liquid(input).to_json
end
# Group an array of items by a property
#
# input - the inputted Enumerable
# property - the property
#
# Returns an array of Hashes, each looking something like this:
# {"name" => "larry"
# "items" => [...] } # all the items where `property` == "larry"
def group_by(input, property)
if groupable?(input)
input.group_by do |item|
item_property(item, property).to_s
end.inject([]) do |memo, i|
memo << { "name" => i.first, "items" => i.last }
end
else
input
end
end
# Filter an array of objects
#
# input - the object array
# property - property within each object to filter by
# value - desired value
#
# Returns the filtered array of objects
def where(input, property, value)
return input unless input.is_a?(Enumerable)
input = input.values if input.is_a?(Hash)
input.select { |object| item_property(object, property).to_s == value.to_s }
end
# Sort an array of objects
#
# input - the object array
# property - property within each object to filter by
# nils ('first' | 'last') - nils appear before or after non-nil values
#
# Returns the filtered array of objects
def sort(input, property = nil, nils = "first")
if input.nil?
raise ArgumentError.new("Cannot sort a null object.")
end
if property.nil?
input.sort
else
case
when nils == "first"
order = - 1
when nils == "last"
order = + 1
else
raise ArgumentError.new("Invalid nils order: " \
"'#{nils}' is not a valid nils order. It must be 'first' or 'last'.")
end
input.sort do |apple, orange|
apple_property = item_property(apple, property)
orange_property = item_property(orange, property)
if !apple_property.nil? && orange_property.nil?
- order
elsif apple_property.nil? && !orange_property.nil?
+ order
else
apple_property <=> orange_property
end
end
end
end
def pop(array, input = 1)
return array unless array.is_a?(Array)
new_ary = array.dup
new_ary.pop(input.to_i || 1)
new_ary
end
def push(array, input)
return array unless array.is_a?(Array)
new_ary = array.dup
new_ary.push(input)
new_ary
end
def shift(array, input = 1)
return array unless array.is_a?(Array)
new_ary = array.dup
new_ary.shift(input.to_i || 1)
new_ary
end
def unshift(array, input)
return array unless array.is_a?(Array)
new_ary = array.dup
new_ary.unshift(input)
new_ary
end
def sample(input, num = 1)
return input unless input.respond_to?(:sample)
n = num.to_i rescue 1
if n == 1
input.sample
else
input.sample(n)
end
end
# Convert an object into its String representation for debugging
#
# input - The Object to be converted
#
# Returns a String representation of the object.
def inspect(input)
CGI.escapeHTML(input.inspect)
end
private
def time(input)
case input
when Time
input
when Date
input.to_time
when String
Time.parse(input) rescue Time.at(input.to_i)
when Numeric
Time.at(input)
else
Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime."
exit(1)
end.localtime
end
def groupable?(element)
element.respond_to?(:group_by)
end
def item_property(item, property)
if item.respond_to?(:to_liquid)
item.to_liquid[property.to_s]
elsif item.respond_to?(:data)
item.data[property.to_s]
else
item[property.to_s]
end
end
def as_liquid(item)
case item
when Hash
pairs = item.map { |k, v| as_liquid([k, v]) }
Hash[pairs]
when Array
item.map { |i| as_liquid(i) }
else
if item.respond_to?(:to_liquid)
liquidated = item.to_liquid
# prevent infinite recursion for simple types (which return `self`)
if liquidated == item
item
else
as_liquid(liquidated)
end
else
item
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/frontmatter_defaults.rb 0000664 0000000 0000000 00000013375 12717414063 0021652 0 ustar 00root root 0000000 0000000 module Jekyll
# This class handles custom defaults for YAML frontmatter settings.
# These are set in _config.yml and apply both to internal use (e.g. layout)
# and the data available to liquid.
#
# It is exposed via the frontmatter_defaults method on the site class.
class FrontmatterDefaults
# Initializes a new instance.
def initialize(site)
@site = site
end
def update_deprecated_types(set)
return set unless set.key?('scope') && set['scope'].key?('type')
set['scope']['type'] =
case set['scope']['type']
when 'page'
Deprecator.defaults_deprecate_type('page', 'pages')
'pages'
when 'post'
Deprecator.defaults_deprecate_type('post', 'posts')
'posts'
when 'draft'
Deprecator.defaults_deprecate_type('draft', 'drafts')
'drafts'
else
set['scope']['type']
end
set
end
def ensure_time!(set)
return set unless set.key?('values') && set['values'].key?('date')
return set if set['values']['date'].is_a?(Time)
set['values']['date'] = Utils.parse_date(set['values']['date'], "An invalid date format was found in a front-matter default set: #{set}")
set
end
# Finds a default value for a given setting, filtered by path and type
#
# path - the path (relative to the source) of the page, post or :draft the default is used in
# type - a symbol indicating whether a :page, a :post or a :draft calls this method
#
# Returns the default value or nil if none was found
def find(path, type, setting)
value = nil
old_scope = nil
matching_sets(path, type).each do |set|
if set['values'].key?(setting) && has_precedence?(old_scope, set['scope'])
value = set['values'][setting]
old_scope = set['scope']
end
end
value
end
# Collects a hash with all default values for a page or post
#
# path - the relative path of the page or post
# type - a symbol indicating the type (:post, :page or :draft)
#
# Returns a hash with all default values (an empty hash if there are none)
def all(path, type)
defaults = {}
old_scope = nil
matching_sets(path, type).each do |set|
if has_precedence?(old_scope, set['scope'])
defaults = Utils.deep_merge_hashes(defaults, set['values'])
old_scope = set['scope']
else
defaults = Utils.deep_merge_hashes(set['values'], defaults)
end
end
defaults
end
private
# Checks if a given default setting scope matches the given path and type
#
# scope - the hash indicating the scope, as defined in _config.yml
# path - the path to check for
# type - the type (:post, :page or :draft) to check for
#
# Returns true if the scope applies to the given path and type
def applies?(scope, path, type)
applies_path?(scope, path) && applies_type?(scope, type)
end
def applies_path?(scope, path)
return true if !scope.key?('path') || scope['path'].empty?
scope_path = Pathname.new(scope['path'])
Pathname.new(sanitize_path(path)).ascend do |path|
if path.to_s == scope_path.to_s
return true
end
end
end
# Determines whether the scope applies to type.
# The scope applies to the type if:
# 1. no 'type' is specified
# 2. the 'type' in the scope is the same as the type asked about
#
# scope - the Hash defaults set being asked about application
# type - the type of the document being processed / asked about
# its defaults.
#
# Returns true if either of the above conditions are satisfied,
# otherwise returns false
def applies_type?(scope, type)
!scope.key?('type') || scope['type'].eql?(type.to_s)
end
# Checks if a given set of default values is valid
#
# set - the default value hash, as defined in _config.yml
#
# Returns true if the set is valid and can be used in this class
def valid?(set)
set.is_a?(Hash) && set['values'].is_a?(Hash)
end
# Determines if a new scope has precedence over an old one
#
# old_scope - the old scope hash, or nil if there's none
# new_scope - the new scope hash
#
# Returns true if the new scope has precedence over the older
def has_precedence?(old_scope, new_scope)
return true if old_scope.nil?
new_path = sanitize_path(new_scope['path'])
old_path = sanitize_path(old_scope['path'])
if new_path.length != old_path.length
new_path.length >= old_path.length
elsif new_scope.key? 'type'
true
else
!old_scope.key? 'type'
end
end
# Collects a list of sets that match the given path and type
#
# Returns an array of hashes
def matching_sets(path, type)
valid_sets.select do |set|
!set.key?('scope') || applies?(set['scope'], path, type)
end
end
# Returns a list of valid sets
#
# This is not cached to allow plugins to modify the configuration
# and have their changes take effect
#
# Returns an array of hashes
def valid_sets
sets = @site.config['defaults']
return [] unless sets.is_a?(Array)
sets.map do |set|
if valid?(set)
ensure_time!(update_deprecated_types(set))
else
Jekyll.logger.warn "Defaults:", "An invalid front-matter default set was found:"
Jekyll.logger.warn "#{set}"
nil
end
end.compact
end
# Sanitizes the given path by removing a leading and adding a trailing slash
def sanitize_path(path)
if path.nil? || path.empty?
""
else
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1')
end
end
end
end
jekyll-3.1.6/lib/jekyll/generator.rb 0000664 0000000 0000000 00000000062 12717414063 0017371 0 ustar 00root root 0000000 0000000 module Jekyll
Generator = Class.new(Plugin)
end
jekyll-3.1.6/lib/jekyll/hooks.rb 0000664 0000000 0000000 00000005177 12717414063 0016542 0 ustar 00root root 0000000 0000000 module Jekyll
module Hooks
DEFAULT_PRIORITY = 20
# compatibility layer for octopress-hooks users
PRIORITY_MAP = {
:low => 10,
:normal => 20,
:high => 30
}.freeze
# initial empty hooks
@registry = {
:site => {
:after_reset => [],
:post_read => [],
:pre_render => [],
:post_render => [],
:post_write => []
},
:pages => {
:post_init => [],
:pre_render => [],
:post_render => [],
:post_write => []
},
:posts => {
:post_init => [],
:pre_render => [],
:post_render => [],
:post_write => []
},
:documents => {
:post_init => [],
:pre_render => [],
:post_render => [],
:post_write => []
}
}
# map of all hooks and their priorities
@hook_priority = {}
NotAvailable = Class.new(RuntimeError)
Uncallable = Class.new(RuntimeError)
# register hook(s) to be called later, public API
def self.register(owners, event, priority: DEFAULT_PRIORITY, &block)
Array(owners).each do |owner|
register_one(owner, event, priority_value(priority), &block)
end
end
# Ensure the priority is a Fixnum
def self.priority_value(priority)
return priority if priority.is_a?(Fixnum)
PRIORITY_MAP[priority] || DEFAULT_PRIORITY
end
# register a single hook to be called later, internal API
def self.register_one(owner, event, priority, &block)
@registry[owner] ||={
:post_init => [],
:pre_render => [],
:post_render => [],
:post_write => []
}
unless @registry[owner][event]
raise NotAvailable, "Invalid hook. #{owner} supports only the " \
"following hooks #{@registry[owner].keys.inspect}"
end
unless block.respond_to? :call
raise Uncallable, "Hooks must respond to :call"
end
insert_hook owner, event, priority, &block
end
def self.insert_hook(owner, event, priority, &block)
@hook_priority[block] = "#{priority}.#{@hook_priority.size}".to_f
@registry[owner][event] << block
end
# interface for Jekyll core components to trigger hooks
def self.trigger(owner, event, *args)
# proceed only if there are hooks to call
return unless @registry[owner]
return unless @registry[owner][event]
# hooks to call for this owner and event
hooks = @registry[owner][event]
# sort and call hooks according to priority and load order
hooks.sort_by { |h| @hook_priority[h] }.each do |hook|
hook.call(*args)
end
end
end
end
jekyll-3.1.6/lib/jekyll/layout.rb 0000664 0000000 0000000 00000002026 12717414063 0016722 0 ustar 00root root 0000000 0000000 module Jekyll
class Layout
include Convertible
# Gets the Site object.
attr_reader :site
# Gets the name of this layout.
attr_reader :name
# Gets the path to this layout.
attr_reader :path
# Gets/Sets the extension of this layout.
attr_accessor :ext
# Gets/Sets the Hash that holds the metadata for this layout.
attr_accessor :data
# Gets/Sets the content of this layout.
attr_accessor :content
# Initialize a new Layout.
#
# site - The Site.
# base - The String path to the source.
# name - The String filename of the post file.
def initialize(site, base, name)
@site = site
@base = base
@name = name
@path = site.in_source_dir(base, name)
self.data = {}
process(name)
read_yaml(base, name)
end
# Extract information from the layout filename.
#
# name - The String filename of the layout file.
#
# Returns nothing.
def process(name)
self.ext = File.extname(name)
end
end
end
jekyll-3.1.6/lib/jekyll/liquid_extensions.rb 0000664 0000000 0000000 00000000761 12717414063 0021157 0 ustar 00root root 0000000 0000000 module Jekyll
module LiquidExtensions
# Lookup a Liquid variable in the given context.
#
# context - the Liquid context in question.
# variable - the variable name, as a string.
#
# Returns the value of the variable in the context
# or the variable name if not found.
def lookup_variable(context, variable)
lookup = context
variable.split(".").each do |value|
lookup = lookup[value]
end
lookup || variable
end
end
end
jekyll-3.1.6/lib/jekyll/liquid_renderer.rb 0000664 0000000 0000000 00000001541 12717414063 0020563 0 ustar 00root root 0000000 0000000 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
@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
jekyll-3.1.6/lib/jekyll/liquid_renderer/ 0000775 0000000 0000000 00000000000 12717414063 0020235 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/liquid_renderer/file.rb 0000664 0000000 0000000 00000001677 12717414063 0021514 0 ustar 00root root 0000000 0000000 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, line_numbers: true)
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
jekyll-3.1.6/lib/jekyll/liquid_renderer/table.rb 0000664 0000000 0000000 00000003664 12717414063 0021662 0 ustar 00root root 0000000 0000000 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 { |_, file_stats| -file_stats[:time] }
sorted = sorted.slice(0, n)
table = [%w(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
jekyll-3.1.6/lib/jekyll/log_adapter.rb 0000664 0000000 0000000 00000005736 12717414063 0017701 0 ustar 00root root 0000000 0000000 module Jekyll
class LogAdapter
attr_reader :writer, :messages
LOG_LEVELS = {
:debug => ::Logger::DEBUG,
:info => ::Logger::INFO,
:warn => ::Logger::WARN,
:error => ::Logger::ERROR
}
# Public: Create a new instance of a log writer
#
# writer - Logger compatible instance
# log_level - (optional, symbol) the log level
#
# Returns nothing
def initialize(writer, level = :info)
@messages = []
@writer = writer
self.log_level = level
end
# Public: Set the log level on the writer
#
# level - (symbol) the log level
#
# Returns nothing
def log_level=(level)
writer.level = LOG_LEVELS.fetch(level)
end
def adjust_verbosity(options = {})
# Quiet always wins.
if options[:quiet]
self.log_level = :error
elsif options[:verbose]
self.log_level = :debug
end
debug "Logging at level:", LOG_LEVELS.key(writer.level).to_s
end
# Public: Print a debug message
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def debug(topic, message = nil)
writer.debug(message(topic, message))
end
# Public: Print a message
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def info(topic, message = nil)
writer.info(message(topic, message))
end
# Public: Print a message
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def warn(topic, message = nil)
writer.warn(message(topic, message))
end
# Public: Print an error message
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns nothing
def error(topic, message = nil)
writer.error(message(topic, message))
end
# Public: Print an error message and immediately abort the process
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail (can be omitted)
#
# Returns nothing
def abort_with(topic, message = nil)
error(topic, message)
abort
end
# Internal: Build a topic method
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
# message - the message detail
#
# Returns the formatted message
def message(topic, message)
msg = formatted_topic(topic) + message.to_s.gsub(/\s+/, ' ')
messages << msg
msg
end
# Internal: Format the topic
#
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
#
# Returns the formatted topic statement
def formatted_topic(topic)
"#{topic} ".rjust(20)
end
end
end
jekyll-3.1.6/lib/jekyll/mime.types 0000664 0000000 0000000 00000174322 12717414063 0017106 0 ustar 00root root 0000000 0000000 # Woah there. Do not edit this file directly.
# This file is generated automatically by script/vendor-mimes.
application/andrew-inset ez
application/applixware aw
application/atom+xml atom
application/atomcat+xml atomcat
application/atomsvc+xml atomsvc
application/bdoc bdoc
application/ccxml+xml ccxml
application/cdmi-capability cdmia
application/cdmi-container cdmic
application/cdmi-domain cdmid
application/cdmi-object cdmio
application/cdmi-queue cdmiq
application/cu-seeme cu
application/dash+xml mdp
application/davmount+xml davmount
application/docbook+xml dbk
application/dssc+der dssc
application/dssc+xml xdssc
application/ecmascript ecma
application/emma+xml emma
application/epub+zip epub
application/exi exi
application/font-tdpfr pfr
application/font-woff woff
application/font-woff2 woff2
application/gml+xml gml
application/gpx+xml gpx
application/gxf gxf
application/hyperstudio stk
application/inkml+xml ink inkml
application/ipfix ipfix
application/java-archive jar war ear
application/java-serialized-object ser
application/java-vm class
application/javascript js
application/json json map
application/json5 json5
application/jsonml+json jsonml
application/ld+json jsonld
application/lost+xml lostxml
application/mac-binhex40 hqx
application/mac-compactpro cpt
application/mads+xml mads
application/manifest+json webmanifest
application/marc mrc
application/marcxml+xml mrcx
application/mathematica ma nb mb
application/mathml+xml mathml
application/mbox mbox
application/mediaservercontrol+xml mscml
application/metalink+xml metalink
application/metalink4+xml meta4
application/mets+xml mets
application/mods+xml mods
application/mp21 m21 mp21
application/mp4 mp4s m4p
application/msword doc dot
application/mxf mxf
application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy exe dll deb dmg iso img msi msp msm buffer
application/oda oda
application/oebps-package+xml opf
application/ogg ogx
application/omdoc+xml omdoc
application/onenote onetoc onetoc2 onetmp onepkg
application/oxps oxps
application/patch-ops-error+xml xer
application/pdf pdf
application/pgp-encrypted pgp
application/pgp-signature asc sig
application/pics-rules prf
application/pkcs10 p10
application/pkcs7-mime p7m p7c
application/pkcs7-signature p7s
application/pkcs8 p8
application/pkix-attr-cert ac
application/pkix-cert cer
application/pkix-crl crl
application/pkix-pkipath pkipath
application/pkixcmp pki
application/pls+xml pls
application/postscript ai eps ps
application/prs.cww cww
application/pskc+xml pskcxml
application/rdf+xml rdf
application/reginfo+xml rif
application/relax-ng-compact-syntax rnc
application/resource-lists+xml rl
application/resource-lists-diff+xml rld
application/rls-services+xml rs
application/rpki-ghostbusters gbr
application/rpki-manifest mft
application/rpki-roa roa
application/rsd+xml rsd
application/rss+xml rss
application/rtf rtf
application/sbml+xml sbml
application/scvp-cv-request scq
application/scvp-cv-response scs
application/scvp-vp-request spq
application/scvp-vp-response spp
application/sdp sdp
application/set-payment-initiation setpay
application/set-registration-initiation setreg
application/shf+xml shf
application/smil+xml smi smil
application/sparql-query rq
application/sparql-results+xml srx
application/srgs gram
application/srgs+xml grxml
application/sru+xml sru
application/ssdl+xml ssdl
application/ssml+xml ssml
application/tei+xml tei teicorpus
application/thraud+xml tfi
application/timestamped-data tsd
application/vnd.3gpp.pic-bw-large plb
application/vnd.3gpp.pic-bw-small psb
application/vnd.3gpp.pic-bw-var pvb
application/vnd.3gpp2.tcap tcap
application/vnd.3m.post-it-notes pwn
application/vnd.accpac.simply.aso aso
application/vnd.accpac.simply.imp imp
application/vnd.acucobol acu
application/vnd.acucorp atc acutc
application/vnd.adobe.air-application-installer-package+zip air
application/vnd.adobe.formscentral.fcdt fcdt
application/vnd.adobe.fxp fxp fxpl
application/vnd.adobe.xdp+xml xdp
application/vnd.adobe.xfdf xfdf
application/vnd.ahead.space ahead
application/vnd.airzip.filesecure.azf azf
application/vnd.airzip.filesecure.azs azs
application/vnd.amazon.ebook azw
application/vnd.americandynamics.acc acc
application/vnd.amiga.ami ami
application/vnd.android.package-archive apk
application/vnd.anser-web-certificate-issue-initiation cii
application/vnd.anser-web-funds-transfer-initiation fti
application/vnd.antix.game-component atx
application/vnd.apple.installer+xml mpkg
application/vnd.apple.mpegurl m3u8
application/vnd.aristanetworks.swi swi
application/vnd.astraea-software.iota iota
application/vnd.audiograph aep
application/vnd.blueice.multipass mpm
application/vnd.bmi bmi
application/vnd.businessobjects rep
application/vnd.chemdraw+xml cdxml
application/vnd.chipnuts.karaoke-mmd mmd
application/vnd.cinderella cdy
application/vnd.claymore cla
application/vnd.cloanto.rp9 rp9
application/vnd.clonk.c4group c4g c4d c4f c4p c4u
application/vnd.cluetrust.cartomobile-config c11amc
application/vnd.cluetrust.cartomobile-config-pkg c11amz
application/vnd.commonspace csp
application/vnd.contact.cmsg cdbcmsg
application/vnd.cosmocaller cmc
application/vnd.crick.clicker clkx
application/vnd.crick.clicker.keyboard clkk
application/vnd.crick.clicker.palette clkp
application/vnd.crick.clicker.template clkt
application/vnd.crick.clicker.wordbank clkw
application/vnd.criticaltools.wbs+xml wbs
application/vnd.ctc-posml pml
application/vnd.cups-ppd ppd
application/vnd.curl.car car
application/vnd.curl.pcurl pcurl
application/vnd.dart dart
application/vnd.data-vision.rdz rdz
application/vnd.dece.data uvf uvvf uvd uvvd
application/vnd.dece.ttml+xml uvt uvvt
application/vnd.dece.unspecified uvx uvvx
application/vnd.dece.zip uvz uvvz
application/vnd.denovo.fcselayout-link fe_launch
application/vnd.dna dna
application/vnd.dolby.mlp mlp
application/vnd.dpgraph dpg
application/vnd.dreamfactory dfac
application/vnd.ds-keypoint kpxx
application/vnd.dvb.ait ait
application/vnd.dvb.service svc
application/vnd.dynageo geo
application/vnd.ecowin.chart mag
application/vnd.enliven nml
application/vnd.epson.esf esf
application/vnd.epson.msf msf
application/vnd.epson.quickanime qam
application/vnd.epson.salt slt
application/vnd.epson.ssf ssf
application/vnd.eszigno3+xml es3 et3
application/vnd.ezpix-album ez2
application/vnd.ezpix-package ez3
application/vnd.fdf fdf
application/vnd.fdsn.mseed mseed
application/vnd.fdsn.seed seed dataless
application/vnd.flographit gph
application/vnd.fluxtime.clip ftc
application/vnd.framemaker fm frame maker book
application/vnd.frogans.fnc fnc
application/vnd.frogans.ltf ltf
application/vnd.fsc.weblaunch fsc
application/vnd.fujitsu.oasys oas
application/vnd.fujitsu.oasys2 oa2
application/vnd.fujitsu.oasys3 oa3
application/vnd.fujitsu.oasysgp fg5
application/vnd.fujitsu.oasysprs bh2
application/vnd.fujixerox.ddd ddd
application/vnd.fujixerox.docuworks xdw
application/vnd.fujixerox.docuworks.binder xbd
application/vnd.fuzzysheet fzs
application/vnd.genomatix.tuxedo txd
application/vnd.geogebra.file ggb
application/vnd.geogebra.tool ggt
application/vnd.geometry-explorer gex gre
application/vnd.geonext gxt
application/vnd.geoplan g2w
application/vnd.geospace g3w
application/vnd.gmx gmx
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
application/vnd.grafeq gqf gqs
application/vnd.groove-account gac
application/vnd.groove-help ghf
application/vnd.groove-identity-message gim
application/vnd.groove-injector grv
application/vnd.groove-tool-message gtm
application/vnd.groove-tool-template tpl
application/vnd.groove-vcard vcg
application/vnd.hal+xml hal
application/vnd.handheld-entertainment+xml zmm
application/vnd.hbci hbci
application/vnd.hhe.lesson-player les
application/vnd.hp-hpgl hpgl
application/vnd.hp-hpid hpid
application/vnd.hp-hps hps
application/vnd.hp-jlyt jlt
application/vnd.hp-pcl pcl
application/vnd.hp-pclxl pclxl
application/vnd.hydrostatix.sof-data sfd-hdstx
application/vnd.ibm.minipay mpy
application/vnd.ibm.modcap afp listafp list3820
application/vnd.ibm.rights-management irm
application/vnd.ibm.secure-container sc
application/vnd.iccprofile icc icm
application/vnd.igloader igl
application/vnd.immervision-ivp ivp
application/vnd.immervision-ivu ivu
application/vnd.insors.igm igm
application/vnd.intercon.formnet xpw xpx
application/vnd.intergeo i2g
application/vnd.intu.qbo qbo
application/vnd.intu.qfx qfx
application/vnd.ipunplugged.rcprofile rcprofile
application/vnd.irepository.package+xml irp
application/vnd.is-xpr xpr
application/vnd.isac.fcs fcs
application/vnd.jam jam
application/vnd.jcp.javame.midlet-rms rms
application/vnd.jisp jisp
application/vnd.joost.joda-archive joda
application/vnd.kahootz ktz ktr
application/vnd.kde.karbon karbon
application/vnd.kde.kchart chrt
application/vnd.kde.kformula kfo
application/vnd.kde.kivio flw
application/vnd.kde.kontour kon
application/vnd.kde.kpresenter kpr kpt
application/vnd.kde.kspread ksp
application/vnd.kde.kword kwd kwt
application/vnd.kenameaapp htke
application/vnd.kidspiration kia
application/vnd.kinar kne knp
application/vnd.koan skp skd skt skm
application/vnd.kodak-descriptor sse
application/vnd.las.las+xml lasxml
application/vnd.llamagraphics.life-balance.desktop lbd
application/vnd.llamagraphics.life-balance.exchange+xml lbe
application/vnd.lotus-1-2-3 123
application/vnd.lotus-approach apr
application/vnd.lotus-freelance pre
application/vnd.lotus-notes nsf
application/vnd.lotus-organizer org
application/vnd.lotus-screencam scm
application/vnd.lotus-wordpro lwp
application/vnd.macports.portpkg portpkg
application/vnd.mcd mcd
application/vnd.medcalcdata mc1
application/vnd.mediastation.cdkey cdkey
application/vnd.mfer mwf
application/vnd.mfmp mfm
application/vnd.micrografx.flo flo
application/vnd.micrografx.igx igx
application/vnd.mif mif
application/vnd.mobius.daf daf
application/vnd.mobius.dis dis
application/vnd.mobius.mbk mbk
application/vnd.mobius.mqy mqy
application/vnd.mobius.msl msl
application/vnd.mobius.plc plc
application/vnd.mobius.txf txf
application/vnd.mophun.application mpn
application/vnd.mophun.certificate mpc
application/vnd.mozilla.xul+xml xul
application/vnd.ms-artgalry cil
application/vnd.ms-cab-compressed cab
application/vnd.ms-excel xls xlm xla xlc xlt xlw
application/vnd.ms-excel.addin.macroenabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb
application/vnd.ms-excel.sheet.macroenabled.12 xlsm
application/vnd.ms-excel.template.macroenabled.12 xltm
application/vnd.ms-fontobject eot
application/vnd.ms-htmlhelp chm
application/vnd.ms-ims ims
application/vnd.ms-lrm lrm
application/vnd.ms-officetheme thmx
application/vnd.ms-pki.seccat cat
application/vnd.ms-pki.stl stl
application/vnd.ms-powerpoint ppt pps pot
application/vnd.ms-powerpoint.addin.macroenabled.12 ppam
application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm
application/vnd.ms-powerpoint.slide.macroenabled.12 sldm
application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm
application/vnd.ms-powerpoint.template.macroenabled.12 potm
application/vnd.ms-project mpp mpt
application/vnd.ms-word.document.macroenabled.12 docm
application/vnd.ms-word.template.macroenabled.12 dotm
application/vnd.ms-works wps wks wcm wdb
application/vnd.ms-wpl wpl
application/vnd.ms-xpsdocument xps
application/vnd.mseq mseq
application/vnd.musician mus
application/vnd.muvee.style msty
application/vnd.mynfc taglet
application/vnd.neurolanguage.nlu nlu
application/vnd.nitf ntf nitf
application/vnd.noblenet-directory nnd
application/vnd.noblenet-sealer nns
application/vnd.noblenet-web nnw
application/vnd.nokia.n-gage.data ngdat
application/vnd.nokia.n-gage.symbian.install n-gage
application/vnd.nokia.radio-preset rpst
application/vnd.nokia.radio-presets rpss
application/vnd.novadigm.edm edm
application/vnd.novadigm.edx edx
application/vnd.novadigm.ext ext
application/vnd.oasis.opendocument.chart odc
application/vnd.oasis.opendocument.chart-template otc
application/vnd.oasis.opendocument.database odb
application/vnd.oasis.opendocument.formula odf
application/vnd.oasis.opendocument.formula-template odft
application/vnd.oasis.opendocument.graphics odg
application/vnd.oasis.opendocument.graphics-template otg
application/vnd.oasis.opendocument.image odi
application/vnd.oasis.opendocument.image-template oti
application/vnd.oasis.opendocument.presentation odp
application/vnd.oasis.opendocument.presentation-template otp
application/vnd.oasis.opendocument.spreadsheet ods
application/vnd.oasis.opendocument.spreadsheet-template ots
application/vnd.oasis.opendocument.text odt
application/vnd.oasis.opendocument.text-master odm
application/vnd.oasis.opendocument.text-template ott
application/vnd.oasis.opendocument.text-web oth
application/vnd.olpc-sugar xo
application/vnd.oma.dd2+xml dd2
application/vnd.openofficeorg.extension oxt
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.openxmlformats-officedocument.presentationml.slide sldx
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
application/vnd.openxmlformats-officedocument.presentationml.template potx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.osgeo.mapguide.package mgp
application/vnd.osgi.dp dp
application/vnd.osgi.subsystem esa
application/vnd.palm pdb pqa oprc
application/vnd.pawaafile paw
application/vnd.pg.format str
application/vnd.pg.osasli ei6
application/vnd.picsel efif
application/vnd.pmi.widget wg
application/vnd.pocketlearn plf
application/vnd.powerbuilder6 pbd
application/vnd.previewsystems.box box
application/vnd.proteus.magazine mgz
application/vnd.publishare-delta-tree qps
application/vnd.pvi.ptid1 ptid
application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb
application/vnd.realvnc.bed bed
application/vnd.recordare.musicxml mxl
application/vnd.recordare.musicxml+xml musicxml
application/vnd.rig.cryptonote cryptonote
application/vnd.rim.cod cod
application/vnd.rn-realmedia rm
application/vnd.rn-realmedia-vbr rmvb
application/vnd.route66.link66+xml link66
application/vnd.sailingtracker.track st
application/vnd.seemail see
application/vnd.sema sema
application/vnd.semd semd
application/vnd.semf semf
application/vnd.shana.informed.formdata ifm
application/vnd.shana.informed.formtemplate itp
application/vnd.shana.informed.interchange iif
application/vnd.shana.informed.package ipk
application/vnd.simtech-mindmapper twd twds
application/vnd.smaf mmf
application/vnd.smart.teacher teacher
application/vnd.solent.sdkm+xml sdkm sdkd
application/vnd.spotfire.dxp dxp
application/vnd.spotfire.sfs sfs
application/vnd.stardivision.calc sdc
application/vnd.stardivision.draw sda
application/vnd.stardivision.impress sdd
application/vnd.stardivision.math smf
application/vnd.stardivision.writer sdw vor
application/vnd.stardivision.writer-global sgl
application/vnd.stepmania.package smzip
application/vnd.stepmania.stepchart sm
application/vnd.sun.xml.calc sxc
application/vnd.sun.xml.calc.template stc
application/vnd.sun.xml.draw sxd
application/vnd.sun.xml.draw.template std
application/vnd.sun.xml.impress sxi
application/vnd.sun.xml.impress.template sti
application/vnd.sun.xml.math sxm
application/vnd.sun.xml.writer sxw
application/vnd.sun.xml.writer.global sxg
application/vnd.sun.xml.writer.template stw
application/vnd.sus-calendar sus susp
application/vnd.svd svd
application/vnd.symbian.install sis sisx
application/vnd.syncml+xml xsm
application/vnd.syncml.dm+wbxml bdm
application/vnd.syncml.dm+xml xdm
application/vnd.tao.intent-module-archive tao
application/vnd.tcpdump.pcap pcap cap dmp
application/vnd.tmobile-livetv tmo
application/vnd.trid.tpt tpt
application/vnd.triscape.mxs mxs
application/vnd.trueapp tra
application/vnd.ufdl ufd ufdl
application/vnd.uiq.theme utz
application/vnd.umajin umj
application/vnd.unity unityweb
application/vnd.uoml+xml uoml
application/vnd.vcx vcx
application/vnd.visio vsd vst vss vsw
application/vnd.visionary vis
application/vnd.vsf vsf
application/vnd.wap.wbxml wbxml
application/vnd.wap.wmlc wmlc
application/vnd.wap.wmlscriptc wmlsc
application/vnd.webturbo wtb
application/vnd.wolfram.player nbp
application/vnd.wordperfect wpd
application/vnd.wqd wqd
application/vnd.wt.stf stf
application/vnd.xara xar
application/vnd.xfdl xfdl
application/vnd.yamaha.hv-dic hvd
application/vnd.yamaha.hv-script hvs
application/vnd.yamaha.hv-voice hvp
application/vnd.yamaha.openscoreformat osf
application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg
application/vnd.yamaha.smaf-audio saf
application/vnd.yamaha.smaf-phrase spf
application/vnd.yellowriver-custom-menu cmp
application/vnd.zul zir zirz
application/vnd.zzazz.deck+xml zaz
application/voicexml+xml vxml
application/widget wgt
application/winhlp hlp
application/wsdl+xml wsdl
application/wspolicy+xml wspolicy
application/x-7z-compressed 7z
application/x-abiword abw
application/x-ace-compressed ace
application/x-authorware-bin aab x32 u32 vox
application/x-authorware-map aam
application/x-authorware-seg aas
application/x-bcpio bcpio
application/x-bittorrent torrent
application/x-blorb blb blorb
application/x-bzip bz
application/x-bzip2 bz2 boz
application/x-cbr cbr cba cbt cbz cb7
application/x-cdlink vcd
application/x-cfs-compressed cfs
application/x-chat chat
application/x-chess-pgn pgn
application/x-chrome-extension crx
application/x-cocoa cco
application/x-conference nsc
application/x-cpio cpio
application/x-csh csh
application/x-debian-package udeb
application/x-dgc-compressed dgc
application/x-director dir dcr dxr cst cct cxt w3d fgd swa
application/x-doom wad
application/x-dtbncx+xml ncx
application/x-dtbook+xml dtb
application/x-dtbresource+xml res
application/x-dvi dvi
application/x-envoy evy
application/x-eva eva
application/x-font-bdf bdf
application/x-font-ghostscript gsf
application/x-font-linux-psf psf
application/x-font-otf otf
application/x-font-pcf pcf
application/x-font-snf snf
application/x-font-ttf ttf ttc
application/x-font-type1 pfa pfb pfm afm
application/x-freearc arc
application/x-futuresplash spl
application/x-gca-compressed gca
application/x-glulx ulx
application/x-gnumeric gnumeric
application/x-gramps-xml gramps
application/x-gtar gtar
application/x-hdf hdf
application/x-httpd-php php
application/x-install-instructions install
application/x-java-archive-diff jardiff
application/x-java-jnlp-file jnlp
application/x-latex latex
application/x-lua-bytecode luac
application/x-lzh-compressed lzh lha
application/x-makeself run
application/x-mie mie
application/x-mobipocket-ebook prc mobi
application/x-ms-application application
application/x-ms-shortcut lnk
application/x-ms-wmd wmd
application/x-ms-wmz wmz
application/x-ms-xbap xbap
application/x-msaccess mdb
application/x-msbinder obd
application/x-mscardfile crd
application/x-msclip clp
application/x-msdownload com bat
application/x-msmediaview mvb m13 m14
application/x-msmetafile wmf emf emz
application/x-msmoney mny
application/x-mspublisher pub
application/x-msschedule scd
application/x-msterminal trm
application/x-mswrite wri
application/x-netcdf nc cdf
application/x-ns-proxy-autoconfig pac
application/x-nzb nzb
application/x-perl pl pm
application/x-pkcs12 p12 pfx
application/x-pkcs7-certificates p7b spc
application/x-pkcs7-certreqresp p7r
application/x-rar-compressed rar
application/x-redhat-package-manager rpm
application/x-research-info-systems ris
application/x-sea sea
application/x-sh sh
application/x-shar shar
application/x-shockwave-flash swf
application/x-silverlight-app xap
application/x-sql sql
application/x-stuffit sit
application/x-stuffitx sitx
application/x-subrip srt
application/x-sv4cpio sv4cpio
application/x-sv4crc sv4crc
application/x-t3vm-image t3
application/x-tads gam
application/x-tar tar
application/x-tcl tcl tk
application/x-tex tex
application/x-tex-tfm tfm
application/x-texinfo texinfo texi
application/x-tgif obj
application/x-ustar ustar
application/x-wais-source src
application/x-web-app-manifest+json webapp
application/x-x509-ca-cert der crt pem
application/x-xfig fig
application/x-xliff+xml xlf
application/x-xpinstall xpi
application/x-xz xz
application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8
application/xaml+xml xaml
application/xcap-diff+xml xdf
application/xenc+xml xenc
application/xhtml+xml xhtml xht
application/xml xml xsl xsd
application/xml-dtd dtd
application/xop+xml xop
application/xproc+xml xpl
application/xslt+xml xslt
application/xspf+xml xspf
application/xv+xml mxml xhvml xvml xvm
application/yang yang
application/yin+xml yin
application/zip zip
audio/adpcm adp
audio/basic au snd
audio/midi mid midi kar rmi
audio/mp4 mp4a m4a
audio/mpeg mpga mp2 mp2a mp3 m2a m3a
audio/ogg oga ogg spx
audio/s3m s3m
audio/silk sil
audio/vnd.dece.audio uva uvva
audio/vnd.digital-winds eol
audio/vnd.dra dra
audio/vnd.dts dts
audio/vnd.dts.hd dtshd
audio/vnd.lucent.voice lvp
audio/vnd.ms-playready.media.pya pya
audio/vnd.nuera.ecelp4800 ecelp4800
audio/vnd.nuera.ecelp7470 ecelp7470
audio/vnd.nuera.ecelp9600 ecelp9600
audio/vnd.rip rip
audio/wav wav
audio/webm weba
audio/x-aac aac
audio/x-aiff aif aiff aifc
audio/x-caf caf
audio/x-flac flac
audio/x-matroska mka
audio/x-mpegurl m3u
audio/x-ms-wax wax
audio/x-ms-wma wma
audio/x-pn-realaudio ram ra
audio/x-pn-realaudio-plugin rmp
audio/xm xm
chemical/x-cdx cdx
chemical/x-cif cif
chemical/x-cmdf cmdf
chemical/x-cml cml
chemical/x-csml csml
chemical/x-xyz xyz
image/bmp bmp
image/cgm cgm
image/g3fax g3
image/gif gif
image/ief ief
image/jpeg jpeg jpg jpe
image/ktx ktx
image/png png
image/prs.btif btif
image/sgi sgi
image/svg+xml svg svgz
image/tiff tiff tif
image/vnd.adobe.photoshop psd
image/vnd.dece.graphic uvi uvvi uvg uvvg
image/vnd.djvu djvu djv
image/vnd.dvb.subtitle sub
image/vnd.dwg dwg
image/vnd.dxf dxf
image/vnd.fastbidsheet fbs
image/vnd.fpx fpx
image/vnd.fst fst
image/vnd.fujixerox.edmics-mmr mmr
image/vnd.fujixerox.edmics-rlc rlc
image/vnd.ms-modi mdi
image/vnd.ms-photo wdp
image/vnd.net-fpx npx
image/vnd.wap.wbmp wbmp
image/vnd.xiff xif
image/webp webp
image/x-3ds 3ds
image/x-cmu-raster ras
image/x-cmx cmx
image/x-freehand fh fhc fh4 fh5 fh7
image/x-icon ico
image/x-jng jng
image/x-mrsid-image sid
image/x-pcx pcx
image/x-pict pic pct
image/x-portable-anymap pnm
image/x-portable-bitmap pbm
image/x-portable-graymap pgm
image/x-portable-pixmap ppm
image/x-rgb rgb
image/x-tga tga
image/x-xbitmap xbm
image/x-xpixmap xpm
image/x-xwindowdump xwd
message/rfc822 eml mime
model/iges igs iges
model/mesh msh mesh silo
model/vnd.collada+xml dae
model/vnd.dwf dwf
model/vnd.gdl gdl
model/vnd.gtw gtw
model/vnd.mts mts
model/vnd.vtu vtu
model/vrml wrl vrml
model/x3d+binary x3db x3dbz
model/x3d+vrml x3dv x3dvz
model/x3d+xml x3d x3dz
text/cache-manifest appcache manifest
text/calendar ics ifb
text/coffeescript coffee litcoffee
text/css css
text/csv csv
text/hjson hjson
text/html html htm shtml
text/jade jade
text/jsx jsx
text/less less
text/mathml mml
text/n3 n3
text/plain txt text conf def list log in ini
text/prs.lines.tag dsc
text/richtext rtx
text/sgml sgml sgm
text/stylus stylus styl
text/tab-separated-values tsv
text/troff t tr roff man me ms
text/turtle ttl
text/uri-list uri uris urls
text/vcard vcard
text/vnd.curl curl
text/vnd.curl.dcurl dcurl
text/vnd.curl.mcurl mcurl
text/vnd.curl.scurl scurl
text/vnd.fly fly
text/vnd.fmi.flexstor flx
text/vnd.graphviz gv
text/vnd.in3d.3dml 3dml
text/vnd.in3d.spot spot
text/vnd.sun.j2me.app-descriptor jad
text/vnd.wap.wml wml
text/vnd.wap.wmlscript wmls
text/vtt vtt
text/x-asm s asm
text/x-c c cc cxx cpp h hh dic
text/x-component htc
text/x-fortran f for f77 f90
text/x-handlebars-template hbs
text/x-java-source java
text/x-lua lua
text/x-markdown markdown md mkd
text/x-nfo nfo
text/x-opml opml
text/x-pascal p pas
text/x-processing pde
text/x-sass sass
text/x-scss scss
text/x-setext etx
text/x-sfv sfv
text/x-uuencode uu
text/x-vcalendar vcs
text/x-vcard vcf
text/yaml yaml yml
video/3gpp 3gp 3gpp
video/3gpp2 3g2
video/h261 h261
video/h263 h263
video/h264 h264
video/jpeg jpgv
video/jpm jpm jpgm
video/mj2 mj2 mjp2
video/mp2t ts
video/mp4 mp4 mp4v mpg4
video/mpeg mpeg mpg mpe m1v m2v
video/ogg ogv
video/quicktime qt mov
video/vnd.dece.hd uvh uvvh
video/vnd.dece.mobile uvm uvvm
video/vnd.dece.pd uvp uvvp
video/vnd.dece.sd uvs uvvs
video/vnd.dece.video uvv uvvv
video/vnd.dvb.file dvb
video/vnd.fvt fvt
video/vnd.mpegurl mxu m4u
video/vnd.ms-playready.media.pyv pyv
video/vnd.uvvu.mp4 uvu uvvu
video/vnd.vivo viv
video/webm webm
video/x-f4v f4v
video/x-fli fli
video/x-flv flv
video/x-m4v m4v
video/x-matroska mkv mk3d mks
video/x-mng mng
video/x-ms-asf asf asx
video/x-ms-vob vob
video/x-ms-wm wm
video/x-ms-wmv wmv
video/x-ms-wmx wmx
video/x-ms-wvx wvx
video/x-msvideo avi
video/x-sgi-movie movie
video/x-smv smv
x-conference/x-cooltalk ice jekyll-3.1.6/lib/jekyll/page.rb 0000664 0000000 0000000 00000010605 12717414063 0016323 0 ustar 00root root 0000000 0000000 module Jekyll
class Page
include Convertible
attr_writer :dir
attr_accessor :site, :pager
attr_accessor :name, :ext, :basename
attr_accessor :data, :content, :output
alias_method :extname, :ext
FORWARD_SLASH = '/'.freeze
# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w(
content
dir
name
path
url
)
# A set of extensions that are considered HTML or HTML-like so we
# should not alter them, this includes .xhtml through XHTM5.
HTML_EXTENSIONS = %W(
.html
.xhtml
.htm
)
# Initialize a new Page.
#
# site - The Site object.
# base - The String path to the source.
# dir - The String path between the source and the file.
# name - The String filename of the file.
def initialize(site, base, dir, name)
@site = site
@base = base
@dir = dir
@name = name
process(name)
read_yaml(File.join(base, dir), name)
data.default_proc = proc do |_, key|
site.frontmatter_defaults.find(File.join(dir, name), type, key)
end
Jekyll::Hooks.trigger :pages, :post_init, self
end
# The generated directory into which the page will be placed
# upon generation. This is derived from the permalink or, if
# permalink is absent, we be '/'
#
# Returns the String destination directory.
def dir
if url.end_with?(FORWARD_SLASH)
url
else
url_dir = File.dirname(url)
url_dir.end_with?(FORWARD_SLASH) ? url_dir : "#{url_dir}/"
end
end
# The full path and filename of the post. Defined in the YAML of the post
# body.
#
# Returns the String permalink or nil if none has been set.
def permalink
data.nil? ? nil : data['permalink']
end
# The template of the permalink.
#
# Returns the template String.
def template
if !html?
"/:path/:basename:output_ext"
elsif index?
"/:path/"
else
Utils.add_permalink_suffix("/:path/:basename", site.permalink_style)
end
end
# The generated relative url of this page. e.g. /about.html.
#
# Returns the String url.
def url
@url ||= URL.new({
:template => template,
:placeholders => url_placeholders,
:permalink => permalink
}).to_s
end
# Returns a hash of URL placeholder names (as symbols) mapping to the
# desired placeholder replacements. For details see "url.rb"
def url_placeholders
{
:path => @dir,
:basename => basename,
:output_ext => output_ext
}
end
# Extract information from the page filename.
#
# name - The String filename of the page file.
#
# Returns nothing.
def process(name)
self.ext = File.extname(name)
self.basename = name[0..-ext.length - 1]
end
# Add any necessary layouts to this post
#
# layouts - The Hash of {"name" => "layout"}.
# site_payload - The site payload Hash.
#
# Returns nothing.
def render(layouts, site_payload)
site_payload["page"] = to_liquid
site_payload["paginator"] = pager.to_liquid
do_layout(site_payload, layouts)
end
# The path to the source file
#
# Returns the path to the source file
def path
data.fetch('path') { relative_path.sub(/\A\//, '') }
end
# The path to the page source file, relative to the site source
def relative_path
File.join(*[@dir, @name].map(&:to_s).reject(&:empty?))
end
# Obtain destination path.
#
# dest - The String path to the destination dir.
#
# Returns the destination file path String.
def destination(dest)
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index") if url.end_with?("/")
path << output_ext unless path.end_with? output_ext
path
end
# Returns the object as a debug String.
def inspect
"#"
end
# Returns the Boolean of whether this Page is HTML or not.
def html?
HTML_EXTENSIONS.include?(output_ext)
end
# Returns the Boolean of whether this Page is an index file or not.
def index?
basename == 'index'
end
def trigger_hooks(hook_name, *args)
Jekyll::Hooks.trigger :pages, hook_name, self, *args
end
def write?
true
end
end
end
jekyll-3.1.6/lib/jekyll/plugin.rb 0000664 0000000 0000000 00000004276 12717414063 0016714 0 ustar 00root root 0000000 0000000 module Jekyll
class Plugin
PRIORITIES = {
:low => -10,
:highest => 100,
:lowest => -100,
:normal => 0,
:high => 10
}
#
def self.inherited(const)
return catch_inheritance(const) do |const_|
catch_inheritance(const_)
end
end
#
def self.catch_inheritance(const)
const.define_singleton_method :inherited do |const_|
(@children ||= Set.new).add const_
if block_given?
yield const_
end
end
end
#
def self.descendants
@children ||= Set.new
out = @children.map(&:descendants)
out << self unless superclass == Plugin
Set.new(out).flatten
end
# Get or set the priority of this plugin. When called without an
# argument it returns the priority. When an argument is given, it will
# set the priority.
#
# priority - The Symbol priority (default: nil). Valid options are:
# :lowest, :low, :normal, :high, :highest
#
# Returns the Symbol priority.
def self.priority(priority = nil)
@priority ||= nil
if priority && PRIORITIES.key?(priority)
@priority = priority
end
@priority || :normal
end
# Get or set the safety of this plugin. When called without an argument
# it returns the safety. When an argument is given, it will set the
# safety.
#
# safe - The Boolean safety (default: nil).
#
# Returns the safety Boolean.
def self.safe(safe = nil)
if safe
@safe = safe
end
@safe || false
end
# Spaceship is priority [higher -> lower]
#
# other - The class to be compared.
#
# Returns -1, 0, 1.
def self.<=>(other)
PRIORITIES[other.priority] <=> PRIORITIES[self.priority]
end
# Spaceship is priority [higher -> lower]
#
# other - The class to be compared.
#
# Returns -1, 0, 1.
def <=>(other)
self.class <=> other.class
end
# Initialize a new plugin. This should be overridden by the subclass.
#
# config - The Hash of configuration options.
#
# Returns a new instance.
def initialize(config = {})
# no-op for default
end
end
end
jekyll-3.1.6/lib/jekyll/plugin_manager.rb 0000664 0000000 0000000 00000005613 12717414063 0020402 0 ustar 00root root 0000000 0000000 module Jekyll
class PluginManager
attr_reader :site
# Create an instance of this class.
#
# site - the instance of Jekyll::Site we're concerned with
#
# Returns nothing
def initialize(site)
@site = site
end
# Require all the plugins which are allowed.
#
# Returns nothing
def conscientious_require
require_plugin_files
require_gems
deprecation_checks
end
# Require each of the gem plugins specified.
#
# Returns nothing.
def require_gems
Jekyll::External.require_with_graceful_fail(site.gems.select { |gem| plugin_allowed?(gem) })
end
def self.require_from_bundler
if !ENV["JEKYLL_NO_BUNDLER_REQUIRE"] && File.file?("Gemfile")
require "bundler"
Bundler.setup # puts all groups on the load path
required_gems = Bundler.require(:jekyll_plugins) # requires the gems in this group only
Jekyll.logger.debug("PluginManager:", "Required #{required_gems.map(&:name).join(', ')}")
ENV["JEKYLL_NO_BUNDLER_REQUIRE"] = "true"
true
else
false
end
rescue LoadError, Bundler::GemfileNotFound
false
end
# Check whether a gem plugin is allowed to be used during this build.
#
# gem_name - the name of the gem
#
# Returns true if the gem name is in the whitelist or if the site is not
# in safe mode.
def plugin_allowed?(gem_name)
!site.safe || whitelist.include?(gem_name)
end
# Build an array of allowed plugin gem names.
#
# Returns an array of strings, each string being the name of a gem name
# that is allowed to be used.
def whitelist
@whitelist ||= Array[site.config['whitelist']].flatten
end
# Require all .rb files if safe mode is off
#
# Returns nothing.
def require_plugin_files
unless site.safe
plugins_path.each do |plugin_search_path|
plugin_files = Utils.safe_glob(plugin_search_path, File.join("**", "*.rb"))
Jekyll::External.require_with_graceful_fail(plugin_files)
end
end
end
# Public: Setup the plugin search path
#
# Returns an Array of plugin search paths
def plugins_path
if site.config['plugins_dir'].eql? Jekyll::Configuration::DEFAULTS['plugins_dir']
[site.in_source_dir(site.config['plugins_dir'])]
else
Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
end
end
def deprecation_checks
pagination_included = (site.config['gems'] || []).include?('jekyll-paginate') || defined?(Jekyll::Paginate)
if site.config['paginate'] && !pagination_included
Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
"turned on, but you haven't included the `jekyll-paginate` gem. " \
"Ensure you have `gems: [jekyll-paginate]` in your configuration file."
end
end
end
end
jekyll-3.1.6/lib/jekyll/publisher.rb 0000664 0000000 0000000 00000000670 12717414063 0017405 0 ustar 00root root 0000000 0000000 module Jekyll
class Publisher
def initialize(site)
@site = site
end
def publish?(thing)
can_be_published?(thing) && !hidden_in_the_future?(thing)
end
private
def can_be_published?(thing)
thing.data.fetch('published', true) || @site.unpublished
end
def hidden_in_the_future?(thing)
thing.respond_to?(:date) && !@site.future && thing.date.to_i > @site.time.to_i
end
end
end
jekyll-3.1.6/lib/jekyll/reader.rb 0000664 0000000 0000000 00000010536 12717414063 0016654 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
require 'csv'
module Jekyll
class Reader
attr_reader :site
def initialize(site)
@site = site
end
# Read Site data from disk and load it into internal data structures.
#
# Returns nothing.
def read
@site.layouts = LayoutReader.new(site).read
read_directories
sort_files!
@site.data = DataReader.new(site).read(site.config['data_dir'])
CollectionReader.new(site).read
end
# Sorts posts, pages, and static files.
def sort_files!
site.collections.values.each { |c| c.docs.sort! }
site.pages.sort_by!(&:name)
site.static_files.sort_by!(&:relative_path)
end
# Recursively traverse directories to find pages and static files
# that will become part of the site according to the rules in
# filter_entries.
#
# dir - The String relative path of the directory to read. Default: ''.
#
# Returns nothing.
def read_directories(dir = '')
base = site.in_source_dir(dir)
dot = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
dot_dirs = dot.select { |file| File.directory?(@site.in_source_dir(base, file)) }
dot_files = (dot - dot_dirs)
dot_pages = dot_files.select { |file| Utils.has_yaml_header?(@site.in_source_dir(base, file)) }
dot_static_files = dot_files - dot_pages
retrieve_posts(dir)
retrieve_dirs(base, dir, dot_dirs)
retrieve_pages(dir, dot_pages)
retrieve_static_files(dir, dot_static_files)
end
# Retrieves all the posts(posts/drafts) from the given directory
# and add them to the site and sort them.
#
# dir - The String representing the directory to retrieve the posts from.
#
# Returns nothing.
def retrieve_posts(dir)
site.posts.docs.concat(PostReader.new(site).read_posts(dir))
site.posts.docs.concat(PostReader.new(site).read_drafts(dir)) if site.show_drafts
end
# Recursively traverse directories with the read_directories function.
#
# base - The String representing the site's base directory.
# dir - The String representing the directory to traverse down.
# dot_dirs - The Array of subdirectories in the dir.
#
# Returns nothing.
def retrieve_dirs(_base, dir, dot_dirs)
dot_dirs.map do |file|
dir_path = site.in_source_dir(dir, file)
rel_path = File.join(dir, file)
@site.reader.read_directories(rel_path) unless @site.dest.sub(/\/$/, '') == dir_path
end
end
# Retrieve all the pages from the current directory,
# add them to the site and sort them.
#
# dir - The String representing the directory retrieve the pages from.
# dot_pages - The Array of pages in the dir.
#
# Returns nothing.
def retrieve_pages(dir, dot_pages)
site.pages.concat(PageReader.new(site, dir).read(dot_pages))
end
# Retrieve all the static files from the current directory,
# add them to the site and sort them.
#
# dir - The directory retrieve the static files from.
# dot_static_files - The static files in the dir.
#
# Returns nothing.
def retrieve_static_files(dir, dot_static_files)
site.static_files.concat(StaticFileReader.new(site, dir).read(dot_static_files))
end
# Filter out any files/directories that are hidden or backup files (start
# with "." or "#" or end with "~"), or contain site content (start with "_"),
# or are excluded in the site configuration, unless they are web server
# files such as '.htaccess'.
#
# entries - The Array of String file/directory entries to filter.
# base_directory - The string representing the optional base directory.
#
# Returns the Array of filtered entries.
def filter_entries(entries, base_directory = nil)
EntryFilter.new(site, base_directory).filter(entries)
end
# Read the entries from a particular directory for processing
#
# dir - The String representing the relative path of the directory to read.
# subfolder - The String representing the directory to read.
#
# Returns the list of entries to process
def get_entries(dir, subfolder)
base = site.in_source_dir(dir, subfolder)
return [] unless File.exist?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }
end
end
end
jekyll-3.1.6/lib/jekyll/readers/ 0000775 0000000 0000000 00000000000 12717414063 0016505 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/readers/collection_reader.rb 0000664 0000000 0000000 00000000701 12717414063 0022505 0 ustar 00root root 0000000 0000000 module Jekyll
class CollectionReader
SPECIAL_COLLECTIONS = %w(posts data).freeze
attr_reader :site, :content
def initialize(site)
@site = site
@content = {}
end
# Read in all collections specified in the configuration
#
# Returns nothing.
def read
site.collections.each do |_, collection|
collection.read unless SPECIAL_COLLECTIONS.include?(collection.label)
end
end
end
end
jekyll-3.1.6/lib/jekyll/readers/data_reader.rb 0000664 0000000 0000000 00000003507 12717414063 0021272 0 ustar 00root root 0000000 0000000 module Jekyll
class DataReader
attr_reader :site, :content
def initialize(site)
@site = site
@content = {}
end
# Read all the files in //_drafts and create a new Draft
# object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read(dir)
base = site.in_source_dir(dir)
read_data_to(base, @content)
@content
end
# Read and parse all yaml files under and add them to the
# variable.
#
# dir - The string absolute path of the directory to read.
# data - The variable to which data will be added.
#
# Returns nothing
def read_data_to(dir, data)
return unless File.directory?(dir) && (!site.safe || !File.symlink?(dir))
entries = Dir.chdir(dir) do
Dir['*.{yaml,yml,json,csv}'] + Dir['*'].select { |fn| File.directory?(fn) }
end
entries.each do |entry|
path = @site.in_source_dir(dir, entry)
next if File.symlink?(path) && site.safe
key = sanitize_filename(File.basename(entry, '.*'))
if File.directory?(path)
read_data_to(path, data[key] = {})
else
data[key] = read_data_file(path)
end
end
end
# Determines how to read a data file.
#
# Returns the contents of the data file.
def read_data_file(path)
case File.extname(path).downcase
when '.csv'
CSV.read(path, {
:headers => true,
:encoding => site.config['encoding']
}).map(&:to_hash)
else
SafeYAML.load_file(path)
end
end
def sanitize_filename(name)
name.gsub!(/[^\w\s-]+/, '')
name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
name.gsub(/\s+/, '_')
end
end
end
jekyll-3.1.6/lib/jekyll/readers/layout_reader.rb 0000664 0000000 0000000 00000002102 12717414063 0021664 0 ustar 00root root 0000000 0000000 module Jekyll
class LayoutReader
attr_reader :site
def initialize(site)
@site = site
@layouts = {}
end
def read
layout_entries.each do |f|
@layouts[layout_name(f)] = Layout.new(site, layout_directory, f)
end
@layouts
end
def layout_directory
@layout_directory ||= (layout_directory_in_cwd || layout_directory_inside_source)
end
private
def layout_entries
entries = []
within(layout_directory) do
entries = EntryFilter.new(site).filter(Dir['**/*.*'])
end
entries
end
def layout_name(file)
file.split(".")[0..-2].join(".")
end
def within(directory)
return unless File.exist?(directory)
Dir.chdir(directory) { yield }
end
def layout_directory_inside_source
site.in_source_dir(site.config['layouts_dir'])
end
def layout_directory_in_cwd
dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts_dir'])
if File.directory?(dir) && !site.safe
dir
else
nil
end
end
end
end
jekyll-3.1.6/lib/jekyll/readers/page_reader.rb 0000664 0000000 0000000 00000001151 12717414063 0021266 0 ustar 00root root 0000000 0000000 module Jekyll
class PageReader
attr_reader :site, :dir, :unfiltered_content
def initialize(site, dir)
@site = site
@dir = dir
@unfiltered_content = []
end
# Read all the files in // for Yaml header and create a new Page
# object for each file.
#
# dir - The String relative path of the directory to read.
#
# Returns an array of static pages.
def read(files)
files.map { |page| @unfiltered_content << Page.new(@site, @site.source, @dir, page) }
@unfiltered_content.select { |page| site.publisher.publish?(page) }
end
end
end
jekyll-3.1.6/lib/jekyll/readers/post_reader.rb 0000664 0000000 0000000 00000003615 12717414063 0021346 0 ustar 00root root 0000000 0000000 module Jekyll
class PostReader
attr_reader :site, :unfiltered_content
def initialize(site)
@site = site
end
# Read all the files in //_drafts and create a new
# Document object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read_drafts(dir)
read_publishable(dir, '_drafts', Document::DATELESS_FILENAME_MATCHER)
end
# Read all the files in //_posts and create a new Document
# object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read_posts(dir)
read_publishable(dir, '_posts', Document::DATE_FILENAME_MATCHER)
end
# Read all the files in // and create a new
# Document object with each one insofar as it matches the regexp matcher.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read_publishable(dir, magic_dir, matcher)
read_content(dir, magic_dir, matcher).tap do |docs|
docs.each(&:read)
end.select do |doc|
site.publisher.publish?(doc)
end
end
# Read all the content files from //magic_dir
# and return them with the type klass.
#
# dir - The String relative path of the directory to read.
# magic_dir - The String relative directory to ,
# looks for content here.
# klass - The return type of the content.
#
# Returns klass type of content files
def read_content(dir, magic_dir, matcher)
@site.reader.get_entries(dir, magic_dir).map do |entry|
next unless entry =~ matcher
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
Document.new(path, {
:site => @site,
:collection => @site.posts
})
end.reject(&:nil?)
end
end
end
jekyll-3.1.6/lib/jekyll/readers/static_file_reader.rb 0000664 0000000 0000000 00000001105 12717414063 0022637 0 ustar 00root root 0000000 0000000 module Jekyll
class StaticFileReader
attr_reader :site, :dir, :unfiltered_content
def initialize(site, dir)
@site = site
@dir = dir
@unfiltered_content = []
end
# Read all the files in // for Yaml header and create a new Page
# object for each file.
#
# dir - The String relative path of the directory to read.
#
# Returns an array of static files.
def read(files)
files.map { |file| @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file) }
@unfiltered_content
end
end
end
jekyll-3.1.6/lib/jekyll/regenerator.rb 0000664 0000000 0000000 00000010363 12717414063 0017725 0 ustar 00root root 0000000 0000000 module Jekyll
class Regenerator
attr_reader :site, :metadata, :cache
def initialize(site)
@site = site
# Read metadata from file
read_metadata
# Initialize cache to an empty hash
clear_cache
end
# Checks if a renderable object needs to be regenerated
#
# Returns a boolean.
def regenerate?(document)
case document
when Page
document.asset_file? || document.data['regenerate'] ||
source_modified_or_dest_missing?(
site.in_source_dir(document.relative_path), document.destination(@site.dest)
)
when Document
!document.write? || document.data['regenerate'] ||
source_modified_or_dest_missing?(
document.path, document.destination(@site.dest)
)
else
source_path = document.respond_to?(:path) ? document.path : nil
dest_path = document.respond_to?(:destination) ? document.destination(@site.dest) : nil
source_modified_or_dest_missing?(source_path, dest_path)
end
end
# Add a path to the metadata
#
# Returns true, also on failure.
def add(path)
return true unless File.exist?(path)
metadata[path] = {
"mtime" => File.mtime(path),
"deps" => []
}
cache[path] = true
end
# Force a path to regenerate
#
# Returns true.
def force(path)
cache[path] = true
end
# Clear the metadata and cache
#
# Returns nothing
def clear
@metadata = {}
clear_cache
end
# Clear just the cache
#
# Returns nothing
def clear_cache
@cache = {}
end
# Checks if the source has been modified or the
# destination is missing
#
# returns a boolean
def source_modified_or_dest_missing?(source_path, dest_path)
modified?(source_path) || (dest_path && !File.exist?(dest_path))
end
# Checks if a path's (or one of its dependencies)
# mtime has changed
#
# Returns a boolean.
def modified?(path)
return true if disabled?
# objects that don't have a path are always regenerated
return true if path.nil?
# Check for path in cache
if cache.key? path
return cache[path]
end
# Check path that exists in metadata
data = metadata[path]
if data
data["deps"].each do |dependency|
if modified?(dependency)
return cache[dependency] = cache[path] = true
end
end
if File.exist?(path) && data["mtime"].eql?(File.mtime(path))
return cache[path] = false
else
return add(path)
end
end
# Path does not exist in metadata, add it
return add(path)
end
# Add a dependency of a path
#
# Returns nothing.
def add_dependency(path, dependency)
return if metadata[path].nil? || @disabled
unless metadata[path]["deps"].include? dependency
metadata[path]["deps"] << dependency
add(dependency) unless metadata.include?(dependency)
end
regenerate? dependency
end
# Write the metadata to disk
#
# Returns nothing.
def write_metadata
unless disabled?
File.binwrite(metadata_file, Marshal.dump(metadata))
end
end
# Produce the absolute path of the metadata file
#
# Returns the String path of the file.
def metadata_file
site.in_source_dir('.jekyll-metadata')
end
# Check if metadata has been disabled
#
# Returns a Boolean (true for disabled, false for enabled).
def disabled?
@disabled = !site.incremental? if @disabled.nil?
@disabled
end
private
# Read metadata from the metadata file, if no file is found,
# initialize with an empty hash
#
# Returns the read metadata.
def read_metadata
@metadata =
if !disabled? && File.file?(metadata_file)
content = File.binread(metadata_file)
begin
Marshal.load(content)
rescue TypeError
SafeYAML.load(content)
rescue ArgumentError => e
Jekyll.logger.warn("Failed to load #{metadata_file}: #{e}")
{}
end
else
{}
end
end
end
end
jekyll-3.1.6/lib/jekyll/related_posts.rb 0000664 0000000 0000000 00000002161 12717414063 0020255 0 ustar 00root root 0000000 0000000 module Jekyll
class RelatedPosts
class << self
attr_accessor :lsi
end
attr_reader :post, :site
def initialize(post)
@post = post
@site = post.site
Jekyll::External.require_with_graceful_fail('classifier-reborn') if site.lsi
end
def build
return [] unless site.posts.docs.size > 1
if site.lsi
build_index
lsi_related_posts
else
most_recent_posts
end
end
def build_index
self.class.lsi ||= begin
lsi = ClassifierReborn::LSI.new(:auto_rebuild => false)
display("Populating LSI...")
site.posts.docs.each do |x|
lsi.add_item(x)
end
display("Rebuilding index...")
lsi.build_index
display("")
lsi
end
end
def lsi_related_posts
self.class.lsi.find_related(post, 11)
end
def most_recent_posts
@most_recent_posts ||= (site.posts.docs.reverse - [post]).first(10)
end
def display(output)
$stdout.print("\n")
$stdout.print(Jekyll.logger.formatted_topic(output))
$stdout.flush
end
end
end
jekyll-3.1.6/lib/jekyll/renderer.rb 0000664 0000000 0000000 00000013116 12717414063 0017215 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
class Renderer
attr_reader :document, :site, :payload
def initialize(site, document, site_payload = nil)
@site = site
@document = document
@payload = site_payload || site.site_payload
end
# Determine which converters to use based on this document's
# extension.
#
# Returns an array of Converter instances.
def converters
@converters ||= site.converters.select { |c| c.matches(document.extname) }
end
# Determine the extname the outputted file should have
#
# Returns the output extname including the leading period.
def output_ext
@output_ext ||= (permalink_ext || converter_output_ext)
end
######################
## DAT RENDER THO
######################
def run
Jekyll.logger.debug "Rendering:", document.relative_path
payload["page"] = document.to_liquid
if document.respond_to? :pager
payload["paginator"] = document.pager.to_liquid
end
if document.is_a?(Document) && document.collection.label == 'posts'
payload['site']['related_posts'] = document.related_posts
end
# render and transform content (this becomes the final content of the object)
payload['highlighter_prefix'] = converters.first.highlighter_prefix
payload['highlighter_suffix'] = converters.first.highlighter_suffix
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
document.trigger_hooks(:pre_render, payload)
info = {
:filters => [Jekyll::Filters],
:registers => { :site => site, :page => payload['page'] }
}
output = document.content
if document.render_with_liquid?
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
output = render_liquid(output, payload, info, document.path)
end
Jekyll.logger.debug "Rendering Markup:", document.relative_path
output = convert(output)
document.content = output
if document.place_in_layout?
Jekyll.logger.debug "Rendering Layout:", document.relative_path
place_in_layouts(
output,
payload,
info
)
else
output
end
end
# Convert the given content using the converters which match this renderer's document.
#
# content - the raw, unconverted content
#
# Returns the converted content.
def convert(content)
converters.reduce(content) do |output, converter|
begin
converter.convert output
rescue => e
Jekyll.logger.error "Conversion error:", "#{converter.class} encountered an error while converting '#{document.relative_path}':"
Jekyll.logger.error("", e.to_s)
raise e
end
end
end
# Render the given content with the payload and info
#
# content -
# payload -
# info -
# path - (optional) the path to the file, for use in ex
#
# Returns the content, rendered by Liquid.
def render_liquid(content, payload, info, path = nil)
site.liquid_renderer.file(path).parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || document.relative_path}"
raise e
rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || document.relative_path}"
raise e
end
# Checks if the layout specified in the document actually exists
#
# layout - the layout to check
#
# Returns true if the layout is invalid, false if otherwise
def invalid_layout?(layout)
!document.data["layout"].nil? && layout.nil?
end
# Render layouts and place given content inside.
#
# content - the content to be placed in the layout
#
#
# Returns the content placed in the Liquid-rendered layouts
def place_in_layouts(content, payload, info)
output = content.dup
layout = site.layouts[document.data["layout"]]
Jekyll.logger.warn("Build Warning:", "Layout '#{document.data["layout"]}' requested in #{document.relative_path} does not exist.") if invalid_layout? layout
used = Set.new([layout])
# Reset the payload layout data to ensure it starts fresh for each page.
payload["layout"] = nil
while layout
payload['content'] = output
payload['page'] = document.to_liquid
payload['layout'] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
output = render_liquid(
layout.content,
payload,
info,
File.join(site.config['layouts_dir'], layout.name)
)
# Add layout to dependency tree
site.regenerator.add_dependency(
site.in_source_dir(document.path),
site.in_source_dir(layout.path)
) if document.write?
if layout = site.layouts[layout.data["layout"]]
if used.include?(layout)
layout = nil # avoid recursive chain
else
used << layout
end
end
end
output
end
private
def permalink_ext
if document.permalink && !document.permalink.end_with?("/")
permalink_ext = File.extname(document.permalink)
permalink_ext unless permalink_ext.empty?
end
end
def converter_output_ext
if output_exts.size == 1
output_exts.last
else
output_exts[-2]
end
end
def output_exts
@output_exts ||= converters.map do |c|
c.output_ext(document.extname)
end.compact
end
end
end
jekyll-3.1.6/lib/jekyll/site.rb 0000664 0000000 0000000 00000027065 12717414063 0016363 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
require 'csv'
module Jekyll
class Site
attr_reader :source, :dest, :config
attr_accessor :layouts, :pages, :static_files, :drafts,
:exclude, :include, :lsi, :highlighter, :permalink_style,
:time, :future, :unpublished, :safe, :plugins, :limit_posts,
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts,
:gems, :plugin_manager
attr_accessor :converters, :generators, :reader
attr_reader :regenerator, :liquid_renderer
# Public: Initialize a new Site.
#
# config - A Hash containing site configuration details.
def initialize(config)
@config = config.clone
%w(safe lsi highlighter baseurl exclude include future unpublished
show_drafts limit_posts keep_files gems).each do |opt|
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
self.file_read_opts = {}
self.file_read_opts[:encoding] = config['encoding'] if config['encoding']
self.permalink_style = config['permalink'].to_sym
Jekyll.sites << self
reset
setup
end
# Public: Read, process, and write this Site to output.
#
# Returns nothing.
def process
reset
read
generate
render
cleanup
write
print_stats
end
def print_stats
if @config['profile']
puts @liquid_renderer.stats_table
end
end
# Reset Site details.
#
# Returns nothing
def reset
self.time = (config['time'] ? Utils.parse_date(config['time'].to_s, "Invalid time in _config.yml.") : Time.now)
self.layouts = {}
self.pages = []
self.static_files = []
self.data = {}
@collections = nil
@regenerator.clear_cache
@liquid_renderer.reset
if limit_posts < 0
raise ArgumentError, "limit_posts must be a non-negative number"
end
Jekyll::Hooks.trigger :site, :after_reset, self
end
# Load necessary libraries, plugins, converters, and generators.
#
# Returns nothing.
def setup
ensure_not_in_dest
plugin_manager.conscientious_require
self.converters = instantiate_subclasses(Jekyll::Converter)
self.generators = instantiate_subclasses(Jekyll::Generator)
end
# Check that the destination dir isn't the source dir or a directory
# parent to the source dir.
def ensure_not_in_dest
dest_pathname = Pathname.new(dest)
Pathname.new(source).ascend do |path|
if path == dest_pathname
raise Errors::FatalException.new "Destination directory cannot be or contain the Source directory."
end
end
end
# The list of collections and their corresponding Jekyll::Collection instances.
# If config['collections'] is set, a new instance is created for each item in the collection.
# If config['collections'] is not set, a new hash is returned.
#
# Returns a Hash containing collection name-to-instance pairs.
def collections
@collections ||= Hash[collection_names.map { |coll| [coll, Jekyll::Collection.new(self, coll)] } ]
end
# The list of collection names.
#
# Returns an array of collection names from the configuration,
# or an empty array if the `collections` key is not set.
def collection_names
case config['collections']
when Hash
config['collections'].keys
when Array
config['collections']
when nil
[]
else
raise ArgumentError, "Your `collections` key must be a hash or an array."
end
end
# Read Site data from disk and load it into internal data structures.
#
# Returns nothing.
def read
reader.read
limit_posts!
Jekyll::Hooks.trigger :site, :post_read, self
end
# Run each of the Generators.
#
# Returns nothing.
def generate
generators.each do |generator|
generator.generate(self)
end
end
# Render the site to the destination.
#
# Returns nothing.
def render
relative_permalinks_are_deprecated
payload = site_payload
Jekyll::Hooks.trigger :site, :pre_render, self, payload
collections.each do |_, collection|
collection.docs.each do |document|
if regenerator.regenerate?(document)
document.output = Jekyll::Renderer.new(self, document, payload).run
document.trigger_hooks(:post_render)
end
end
end
pages.flatten.each do |page|
if regenerator.regenerate?(page)
page.output = Jekyll::Renderer.new(self, page, payload).run
page.trigger_hooks(:post_render)
end
end
Jekyll::Hooks.trigger :site, :post_render, self, payload
rescue Errno::ENOENT
# ignore missing layout dir
end
# Remove orphaned files and empty directories in destination.
#
# Returns nothing.
def cleanup
site_cleaner.cleanup!
end
# Write static files, pages, and posts.
#
# Returns nothing.
def write
each_site_file do |item|
item.write(dest) if regenerator.regenerate?(item)
end
regenerator.write_metadata
Jekyll::Hooks.trigger :site, :post_write, self
end
def posts
collections['posts'] ||= Collection.new(self, 'posts')
end
# Construct a Hash of Posts indexed by the specified Post attribute.
#
# post_attr - The String name of the Post attribute.
#
# Examples
#
# post_attr_hash('categories')
# # => { 'tech' => [, ],
# # 'ruby' => [] }
#
# Returns the Hash: { attr => posts } where
# attr - One of the values for the requested attribute.
# posts - The Array of Posts with the given attr value.
def post_attr_hash(post_attr)
# Build a hash map based on the specified post attribute ( post attr =>
# array of posts ) then sort each array in reverse order.
hash = Hash.new { |h, key| h[key] = [] }
posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr] }
hash.values.each { |posts| posts.sort!.reverse! }
hash
end
def tags
post_attr_hash('tags')
end
def categories
post_attr_hash('categories')
end
# Prepare site data for site payload. The method maintains backward compatibility
# if the key 'data' is already used in _config.yml.
#
# Returns the Hash to be hooked to site.data.
def site_data
config['data'] || data
end
# The Hash payload containing site-wide data.
#
# Returns the Hash: { "site" => data } where data is a Hash with keys:
# "time" - The Time as specified in the configuration or the
# current time if none was specified.
# "posts" - The Array of Posts, sorted chronologically by post date
# and then title.
# "pages" - The Array of all Pages.
# "html_pages" - The Array of HTML Pages.
# "categories" - The Hash of category values and Posts.
# See Site#post_attr_hash for type info.
# "tags" - The Hash of tag values and Posts.
# See Site#post_attr_hash for type info.
def site_payload
Drops::UnifiedPayloadDrop.new self
end
alias_method :to_liquid, :site_payload
# Get the implementation class for the given Converter.
# Returns the Converter instance implementing the given Converter.
# klass - The Class of the Converter to fetch.
def find_converter_instance(klass)
converters.find { |klass_| klass_.instance_of?(klass) } || \
raise("No Converters found for #{klass}")
end
# klass - class or module containing the subclasses.
# Returns array of instances of subclasses of parameter.
# Create array of instances of the subclasses of the class or module
# passed in as argument.
def instantiate_subclasses(klass)
klass.descendants.select { |c| !safe || c.safe }.sort.map do |c|
c.new(config)
end
end
# Warns the user if permanent links are relative to the parent
# directory. As this is a deprecated function of Jekyll.
#
# Returns
def relative_permalinks_are_deprecated
if config['relative_permalinks']
Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
" in subfolders must be relative to the" \
" site source directory, not the parent" \
" directory. Check http://jekyllrb.com/docs/upgrading/"\
" for more info."
end
end
# Get the to be written documents
#
# Returns an Array of Documents which should be written
def docs_to_write
documents.select(&:write?)
end
# Get all the documents
#
# Returns an Array of all Documents
def documents
collections.reduce(Set.new) do |docs, (_, collection)|
docs + collection.docs + collection.files
end.to_a
end
def each_site_file
%w(pages static_files docs_to_write).each do |type|
send(type).each do |item|
yield item
end
end
end
# Returns the FrontmatterDefaults or creates a new FrontmatterDefaults
# if it doesn't already exist.
#
# Returns The FrontmatterDefaults
def frontmatter_defaults
@frontmatter_defaults ||= FrontmatterDefaults.new(self)
end
# Whether to perform a full rebuild without incremental regeneration
#
# Returns a Boolean: true for a full rebuild, false for normal build
def incremental?(override = {})
override['incremental'] || config['incremental']
end
# Returns the publisher or creates a new publisher if it doesn't
# already exist.
#
# Returns The Publisher
def publisher
@publisher ||= Publisher.new(self)
end
# Public: Prefix a given path with the source directory.
#
# paths - (optional) path elements to a file or directory within the
# source directory
#
# Returns a path which is prefixed with the source directory.
def in_source_dir(*paths)
paths.reduce(source) do |base, path|
Jekyll.sanitized_path(base, path)
end
end
# Public: Prefix a given path with the destination directory.
#
# paths - (optional) path elements to a file or directory within the
# destination directory
#
# Returns a path which is prefixed with the destination directory.
def in_dest_dir(*paths)
paths.reduce(dest) do |base, path|
Jekyll.sanitized_path(base, path)
end
end
private
# Limits the current posts; removes the posts which exceed the limit_posts
#
# Returns nothing
def limit_posts!
if limit_posts > 0
limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts
self.posts.docs = posts.docs[-limit, limit]
end
end
# Returns the Cleaner or creates a new Cleaner if it doesn't
# already exist.
#
# Returns The Cleaner
def site_cleaner
@site_cleaner ||= Cleaner.new(self)
end
end
end
jekyll-3.1.6/lib/jekyll/static_file.rb 0000664 0000000 0000000 00000007177 12717414063 0017707 0 ustar 00root root 0000000 0000000 module Jekyll
class StaticFile
# The cache of last modification times [path] -> mtime.
@@mtimes = {}
attr_reader :relative_path, :extname
# Initialize a new StaticFile.
#
# site - The Site.
# base - The String path to the .
# dir - The String path between and the file.
# name - The String filename of the file.
def initialize(site, base, dir, name, collection = nil)
@site = site
@base = base
@dir = dir
@name = name
@collection = collection
@relative_path = File.join(*[@dir, @name].compact)
@extname = File.extname(@name)
end
# Returns source file path.
def path
File.join(*[@base, @dir, @name].compact)
end
# Obtain destination path.
#
# dest - The String path to the destination dir.
#
# Returns destination file path.
def destination(dest)
@site.in_dest_dir(*[dest, destination_rel_dir, @name].compact)
end
def destination_rel_dir
if @collection
File.dirname(url)
else
@dir
end
end
def modified_time
@modified_time ||= File.stat(path).mtime
end
# Returns last modification time for this file.
def mtime
modified_time.to_i
end
# Is source path modified?
#
# Returns true if modified since last write.
def modified?
@@mtimes[path] != mtime
end
# Whether to write the file to the filesystem
#
# Returns true unless the defaults for the destination path from
# _config.yml contain `published: false`.
def write?
defaults.fetch('published', true)
end
# Write the static file to the destination directory (if modified).
#
# dest - The String path to the destination dir.
#
# Returns false if the file was not modified since last time (no-op).
def write(dest)
dest_path = destination(dest)
return false if File.exist?(dest_path) && !modified?
@@mtimes[path] = mtime
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.rm(dest_path) if File.exist?(dest_path)
FileUtils.cp(path, dest_path)
File.utime(@@mtimes[path], @@mtimes[path], dest_path)
true
end
# Reset the mtimes cache (for testing purposes).
#
# Returns nothing.
def self.reset_cache
@@mtimes = {}
nil
end
def to_liquid
{
"extname" => extname,
"modified_time" => modified_time,
"path" => File.join("", relative_path)
}
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
jekyll-3.1.6/lib/jekyll/stevenson.rb 0000664 0000000 0000000 00000002255 12717414063 0017435 0 ustar 00root root 0000000 0000000 module Jekyll
class Stevenson < ::Logger
def initialize
@progname = nil
@level = DEBUG
@default_formatter = Formatter.new
@logdev = $stdout
@formatter = proc do |_, _, _, msg|
"#{msg}"
end
end
def add(severity, message = nil, progname = nil, &block)
severity ||= UNKNOWN
@logdev = set_logdevice(severity)
if @logdev.nil? || severity < @level
return true
end
progname ||= @progname
if message.nil?
if block_given?
message = yield
else
message = progname
progname = @progname
end
end
@logdev.puts(
format_message(format_severity(severity), Time.now, progname, message))
true
end
# Log a +WARN+ message
def warn(progname = nil, &block)
add(WARN, nil, progname.yellow, &block)
end
# Log an +ERROR+ message
def error(progname = nil, &block)
add(ERROR, nil, progname.red, &block)
end
def close
# No LogDevice in use
end
private
def set_logdevice(severity)
if severity > INFO
$stderr
else
$stdout
end
end
end
end
jekyll-3.1.6/lib/jekyll/tags/ 0000775 0000000 0000000 00000000000 12717414063 0016016 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/tags/highlight.rb 0000664 0000000 0000000 00000010321 12717414063 0020307 0 ustar 00root root 0000000 0000000 module Jekyll
module Tags
class HighlightBlock < Liquid::Block
include Liquid::StandardFilters
# The regular expression syntax checker. Start with the language specifier.
# Follow that by zero or more space separated options that take one of three
# forms: name, name=value, or name=""
#
# is a space-separated list of numbers
SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$/
def initialize(tag_name, markup, tokens)
super
if markup.strip =~ SYNTAX
@lang = Regexp.last_match(1).downcase
@highlight_options = {}
if defined?(Regexp.last_match(2)) && Regexp.last_match(2) != ''
# Split along 3 possible forms -- key="", key=value, or key
Regexp.last_match(2).scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt|
key, value = opt.split('=')
# If a quoted list, convert to array
if value && value.include?("\"")
value.delete!('"')
value = value.split
end
@highlight_options[key.to_sym] = value || true
end
end
@highlight_options[:linenos] = "inline" if @highlight_options.key?(:linenos) && @highlight_options[:linenos] == true
else
raise SyntaxError.new <<-eos
Syntax Error in tag 'highlight' while parsing the following markup:
#{markup}
Valid syntax: highlight [linenos]
eos
end
end
def render(context)
prefix = context["highlighter_prefix"] || ""
suffix = context["highlighter_suffix"] || ""
code = super.to_s.gsub(/\A(\n|\r)+|(\n|\r)+\z/, '')
is_safe = !!context.registers[:site].safe
output =
case context.registers[:site].highlighter
when 'pygments'
render_pygments(code, is_safe)
when 'rouge'
render_rouge(code)
else
render_codehighlighter(code)
end
rendered_output = add_code_tag(output)
prefix + rendered_output + suffix
end
def sanitized_opts(opts, is_safe)
if is_safe
Hash[[
[:startinline, opts.fetch(:startinline, nil)],
[:hl_lines, opts.fetch(:hl_lines, nil)],
[:linenos, opts.fetch(:linenos, nil)],
[:encoding, opts.fetch(:encoding, 'utf-8')],
[:cssclass, opts.fetch(:cssclass, nil)]
].reject { |f| f.last.nil? }]
else
opts
end
end
def render_pygments(code, is_safe)
Jekyll::External.require_with_graceful_fail('pygments')
highlighted_code = Pygments.highlight(
code,
:lexer => @lang,
:options => sanitized_opts(@highlight_options, is_safe)
)
if highlighted_code.nil?
Jekyll.logger.error "There was an error highlighting your code:"
puts
Jekyll.logger.error code
puts
Jekyll.logger.error "While attempting to convert the above code, Pygments.rb" \
" returned an unacceptable value."
Jekyll.logger.error "This is usually a timeout problem solved by running `jekyll build` again."
raise ArgumentError.new("Pygments.rb returned an unacceptable value when attempting to highlight some code.")
end
highlighted_code.sub('
"
end
end
end
end
Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)
jekyll-3.1.6/lib/jekyll/tags/include.rb 0000664 0000000 0000000 00000012331 12717414063 0017766 0 ustar 00root root 0000000 0000000 # encoding: UTF-8
module Jekyll
module Tags
class IncludeTagError < StandardError
attr_accessor :path
def initialize(msg, path)
super(msg)
@path = path
end
end
class IncludeTag < Liquid::Tag
attr_reader :includes_dir
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
VARIABLE_SYNTAX = /(?[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)(?.*)/
def initialize(tag_name, markup, tokens)
super
matched = markup.strip.match(VARIABLE_SYNTAX)
if matched
@file = matched['variable'].strip
@params = matched['params'].strip
else
@file, @params = markup.strip.split(' ', 2)
end
validate_params if @params
@tag_name = tag_name
end
def syntax_example
"{% #{@tag_name} file.ext param='value' param2='value' %}"
end
def parse_params(context)
params = {}
markup = @params
while match = VALID_SYNTAX.match(markup) do
markup = markup[match.end(0)..-1]
value = if match[2]
match[2].gsub(/\\"/, '"')
elsif match[3]
match[3].gsub(/\\'/, "'")
elsif match[4]
context[match[4]]
end
params[match[1]] = value
end
params
end
def validate_file_name(file)
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
raise ArgumentError.new <<-eos
Invalid syntax for include tag. File contains invalid characters or sequences:
#{file}
Valid syntax:
#{syntax_example}
eos
end
end
def validate_params
full_valid_syntax = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
unless @params =~ full_valid_syntax
raise ArgumentError.new <<-eos
Invalid syntax for include tag:
#{@params}
Valid syntax:
#{syntax_example}
eos
end
end
# Grab file read opts in the context
def file_read_opts(context)
context.registers[:site].file_read_opts
end
# Render the variable if required
def render_variable(context)
if @file.match(VARIABLE_SYNTAX)
partial = context.registers[:site].liquid_renderer.file("(variable)").parse(@file)
partial.render!(context)
end
end
def tag_includes_dir(context)
context.registers[:site].config['includes_dir'].freeze
end
def render(context)
site = context.registers[:site]
@includes_dir = tag_includes_dir(context)
dir = resolved_includes_dir(context)
file = render_variable(context) || @file
validate_file_name(file)
path = File.join(dir, file)
validate_path(path, dir, site.safe)
# Add include to dependency tree
if context.registers[:page] && context.registers[:page].key?("path")
site.regenerator.add_dependency(
site.in_source_dir(context.registers[:page]["path"]),
path
)
end
begin
partial = load_cached_partial(path, context)
context.stack do
context['include'] = parse_params(context) if @params
partial.render!(context)
end
rescue => e
raise IncludeTagError.new e.message, File.join(@includes_dir, @file)
end
end
def load_cached_partial(path, context)
context.registers[:cached_partials] ||= {}
cached_partial = context.registers[:cached_partials]
if cached_partial.key?(path)
cached_partial[path]
else
cached_partial[path] = context.registers[:site].liquid_renderer.file(path).parse(read_file(path, context))
end
end
def resolved_includes_dir(context)
context.registers[:site].in_source_dir(@includes_dir)
end
def validate_path(path, dir, safe)
if safe && !realpath_prefixed_with?(path, dir)
raise IOError.new "The included file '#{path}' should exist and should not be a symlink"
elsif !File.exist?(path)
raise IOError.new "Included file '#{path_relative_to_source(dir, path)}' not found"
end
end
def path_relative_to_source(dir, path)
File.join(@includes_dir, path.sub(Regexp.new("^#{dir}"), ""))
end
def realpath_prefixed_with?(path, dir)
File.exist?(path) && File.realpath(path).start_with?(dir)
end
# This method allows to modify the file content by inheriting from the class.
def read_file(file, context)
File.read(file, file_read_opts(context))
end
end
class IncludeRelativeTag < IncludeTag
def tag_includes_dir(context)
'.'.freeze
end
def page_path(context)
context.registers[:page].nil? ? includes_dir : File.dirname(context.registers[:page]["path"])
end
def resolved_includes_dir(context)
context.registers[:site].in_source_dir(page_path(context))
end
end
end
end
Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)
Liquid::Template.register_tag('include_relative', Jekyll::Tags::IncludeRelativeTag)
jekyll-3.1.6/lib/jekyll/tags/post_url.rb 0000664 0000000 0000000 00000005024 12717414063 0020213 0 ustar 00root root 0000000 0000000 module Jekyll
module Tags
class PostComparer
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
attr_reader :path, :date, :slug, :name
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
@name_regex = /^#{path}#{date}-#{slug}\.[^.]+/
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
end
private
# Construct the directory-aware post slug for a Jekyll::Post
#
# other - the Jekyll::Post
#
# Returns the post slug with the subdirectory (relative to _posts)
def post_slug(other)
path = other.basename.split("/")[0...-1].join("/")
if path.nil? || path == ""
other.data['slug']
else
path + '/' + other.data['slug']
end
end
end
class PostUrl < Liquid::Tag
def initialize(tag_name, post, tokens)
super
@orig_post = post.strip
begin
@post = PostComparer.new(@orig_post)
rescue
raise ArgumentError.new <<-eos
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
Make sure the post exists and the name is correct.
eos
end
end
def render(context)
site = context.registers[:site]
site.posts.docs.each do |p|
return p.url if @post == p
end
# New matching method did not match, fall back to old method
# with deprecation warning if this matches
site.posts.docs.each do |p|
next unless @post.deprecated_equality p
Jekyll::Deprecator.deprecation_message "A call to '{{ post_url #{@post.name} }}' did not match " \
"a post using the new matching method of checking name " \
"(path-date-slug) equality. Please make sure that you " \
"change this tag to match the post's name exactly."
return p.url
end
raise ArgumentError.new <<-eos
Could not find post "#{@orig_post}" in tag 'post_url'.
Make sure the post exists and the name is correct.
eos
end
end
end
end
Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)
jekyll-3.1.6/lib/jekyll/url.rb 0000664 0000000 0000000 00000010546 12717414063 0016215 0 ustar 00root root 0000000 0000000 require 'uri'
# Public: Methods that generate a URL for a resource such as a Post or a Page.
#
# Examples
#
# URL.new({
# :template => /:categories/:title.html",
# :placeholders => {:categories => "ruby", :title => "something"}
# }).to_s
#
module Jekyll
class URL
# options - One of :permalink or :template must be supplied.
# :template - The String used as template for URL generation,
# for example "/:path/:basename:output_ext", where
# a placeholder is prefixed with a colon.
# :placeholders - A hash containing the placeholders which will be
# replaced when used inside the template. E.g.
# { "year" => Time.now.strftime("%Y") } would replace
# the placeholder ":year" with the current year.
# :permalink - If supplied, no URL will be generated from the
# template. Instead, the given permalink will be
# used as URL.
def initialize(options)
@template = options[:template]
@placeholders = options[:placeholders] || {}
@permalink = options[:permalink]
if (@template || @permalink).nil?
raise ArgumentError, "One of :template or :permalink must be supplied."
end
end
# The generated relative URL of the resource
#
# Returns the String URL
def to_s
sanitize_url(generated_permalink || generated_url)
end
# Generates a URL from the permalink
#
# Returns the _unsanitized String URL
def generated_permalink
(@generated_permalink ||= generate_url(@permalink)) if @permalink
end
# Generates a URL from the template
#
# Returns the unsanitized String URL
def generated_url
@generated_url ||= generate_url(@template)
end
# Internal: Generate the URL by replacing all placeholders with their
# respective values in the given template
#
# Returns the unsanitized String URL
def generate_url(template)
if @placeholders.is_a? Drops::UrlDrop
generate_url_from_drop(template)
else
generate_url_from_hash(template)
end
end
def generate_url_from_hash(template)
@placeholders.inject(template) do |result, token|
break result if result.index(':').nil?
if token.last.nil?
# Remove leading '/' to avoid generating urls with `//`
result.gsub(/\/:#{token.first}/, '')
else
result.gsub(/:#{token.first}/, self.class.escape_path(token.last))
end
end
end
def generate_url_from_drop(template)
template.gsub(/:([a-z_]+)/.freeze) do |match|
replacement = @placeholders.public_send(match.sub(':'.freeze, ''.freeze))
if replacement.nil?
''.freeze
else
self.class.escape_path(replacement)
end
end.gsub(/\/\//.freeze, '/'.freeze)
end
# Returns a sanitized String URL, stripping "../../" and multiples of "/",
# as well as the beginning "/" so we can enforce and ensure it.
def sanitize_url(str)
"/" + str.gsub(/\/{2,}/, "/").gsub(/\.+\/|\A\/+/, "")
end
# Escapes a path to be a valid URL path segment
#
# path - The path to be escaped.
#
# Examples:
#
# URL.escape_path("/a b")
# # => "/a%20b"
#
# Returns the escaped path.
def self.escape_path(path)
# Because URI.escape doesn't escape '?', '[' and ']' by default,
# specify unsafe string (except unreserved, sub-delims, ":", "@" and "/").
#
# URI path segment is defined in RFC 3986 as follows:
# segment = *pchar
# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
# pct-encoded = "%" HEXDIG HEXDIG
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
# / "*" / "+" / "," / ";" / "="
URI.escape(path, /[^a-zA-Z\d\-._~!$&'()*+,;=:@\/]/).encode('utf-8')
end
# Unescapes a URL path segment
#
# path - The path to be unescaped.
#
# Examples:
#
# URL.unescape_path("/a%20b")
# # => "/a b"
#
# Returns the unescaped path.
def self.unescape_path(path)
URI.unescape(path.encode('utf-8'))
end
end
end
jekyll-3.1.6/lib/jekyll/utils.rb 0000664 0000000 0000000 00000022301 12717414063 0016543 0 ustar 00root root 0000000 0000000 module Jekyll
module Utils
extend self
autoload :Platforms, 'jekyll/utils/platforms'
autoload :Ansi, "jekyll/utils/ansi"
# Constants for use in #slugify
SLUGIFY_MODES = %w(raw default pretty)
SLUGIFY_RAW_REGEXP = Regexp.new('\\s+').freeze
SLUGIFY_DEFAULT_REGEXP = Regexp.new('[^[:alnum:]]+').freeze
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
# Takes an indented string and removes the preceding spaces on each line
def strip_heredoc(str)
str.gsub(/^[ \t]{#{(str.scan(/^[ \t]*(?=\S)/).min || "").size}}/, "")
end
# Takes a slug and turns it into a simple title.
def titleize_slug(slug)
slug.split("-").map! do |val|
val.capitalize
end.join(" ")
end
# Non-destructive version of deep_merge_hashes! See that method.
#
# Returns the merged hashes.
def deep_merge_hashes(master_hash, other_hash)
deep_merge_hashes!(master_hash.dup, other_hash)
end
# Merges a master hash with another hash, recursively.
#
# master_hash - the "parent" hash whose values will be overridden
# other_hash - the other hash whose values will be persisted after the merge
#
# This code was lovingly stolen from some random gem:
# http://gemjack.com/gems/tartan-0.1.1/classes/Hash.html
#
# Thanks to whoever made it.
def deep_merge_hashes!(target, overwrite)
target.merge!(overwrite) do |key, old_val, new_val|
if new_val.nil?
old_val
else
mergable?(old_val) && mergable?(new_val) ? deep_merge_hashes(old_val, new_val) : new_val
end
end
if target.respond_to?(:default_proc) && overwrite.respond_to?(:default_proc) && target.default_proc.nil?
target.default_proc = overwrite.default_proc
end
target.each do |key, val|
target[key] = val.dup if val.frozen? && duplicable?(val)
end
target
end
def mergable?(value)
value.is_a?(Hash) || value.is_a?(Drops::Drop)
end
def duplicable?(obj)
case obj
when nil, false, true, Symbol, Numeric
false
else
true
end
end
# Read array from the supplied hash favouring the singular key
# and then the plural key, and handling any nil entries.
#
# hash - the hash to read from
# singular_key - the singular key
# plural_key - the plural key
#
# Returns an array
def pluralized_array_from_hash(hash, singular_key, plural_key)
[].tap do |array|
array << (value_from_singular_key(hash, singular_key) || value_from_plural_key(hash, plural_key))
end.flatten.compact
end
def value_from_singular_key(hash, key)
hash[key] if hash.key?(key) || (hash.default_proc && hash[key])
end
def value_from_plural_key(hash, key)
if hash.key?(key) || (hash.default_proc && hash[key])
val = hash[key]
case val
when String
val.split
when Array
val.compact
end
end
end
def transform_keys(hash)
result = {}
hash.each_key do |key|
result[yield(key)] = hash[key]
end
result
end
# Apply #to_sym to all keys in the hash
#
# hash - the hash to which to apply this transformation
#
# Returns a new hash with symbolized keys
def symbolize_hash_keys(hash)
transform_keys(hash) { |key| key.to_sym rescue key }
end
# Apply #to_s to all keys in the Hash
#
# hash - the hash to which to apply this transformation
#
# Returns a new hash with stringified keys
def stringify_hash_keys(hash)
transform_keys(hash) { |key| key.to_s rescue key }
end
# Parse a date/time and throw an error if invalid
#
# input - the date/time to parse
# msg - (optional) the error message to show the user
#
# Returns the parsed date if successful, throws a FatalException
# if not
def parse_date(input, msg = "Input could not be parsed.")
Time.parse(input).localtime
rescue ArgumentError
raise Errors::FatalException.new("Invalid date '#{input}': " + msg)
end
# Determines whether a given file has
#
# Returns true if the YAML front matter is present.
def has_yaml_header?(file)
!!(File.open(file, 'rb') { |f| f.readline } =~ /\A---\s*\r?\n/)
rescue EOFError
false
end
# Slugify a filename or title.
#
# string - the filename or title to slugify
# mode - how string is slugified
# cased - whether to replace all uppercase letters with their
# lowercase counterparts
#
# When mode is "none", return the given string.
#
# When mode is "raw", return the given string,
# with every sequence of spaces characters replaced with a hyphen.
#
# When mode is "default" or nil, non-alphabetic characters are
# replaced with a hyphen too.
#
# When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@)
# are not replaced with hyphen.
#
# If cased is true, all uppercase letters in the result string are
# replaced with their lowercase counterparts.
#
# Examples:
# slugify("The _config.yml file")
# # => "the-config-yml-file"
#
# slugify("The _config.yml file", "pretty")
# # => "the-_config.yml-file"
#
# slugify("The _config.yml file", "pretty", true)
# # => "The-_config.yml file"
#
# Returns the slugified string.
def slugify(string, mode: nil, cased: false)
mode ||= 'default'
return nil if string.nil?
unless SLUGIFY_MODES.include?(mode)
return cased ? string : string.downcase
end
# Replace each character sequence with a hyphen
re =
case mode
when 'raw'
SLUGIFY_RAW_REGEXP
when 'default'
SLUGIFY_DEFAULT_REGEXP
when 'pretty'
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
end
# Strip according to the mode
slug = string.gsub(re, '-')
# Remove leading/trailing hyphen
slug.gsub!(/^\-|\-$/i, '')
slug.downcase! unless cased
slug
end
# Add an appropriate suffix to template so that it matches the specified
# permalink style.
#
# template - permalink template without trailing slash or file extension
# permalink_style - permalink style, either built-in or custom
#
# The returned permalink template will use the same ending style as
# specified in permalink_style. For example, if permalink_style contains a
# trailing slash (or is :pretty, which indirectly has a trailing slash),
# then so will the returned template. If permalink_style has a trailing
# ":output_ext" (or is :none, :date, or :ordinal) then so will the returned
# template. Otherwise, template will be returned without modification.
#
# Examples:
# add_permalink_suffix("/:basename", :pretty)
# # => "/:basename/"
#
# add_permalink_suffix("/:basename", :date)
# # => "/:basename:output_ext"
#
# add_permalink_suffix("/:basename", "/:year/:month/:title/")
# # => "/:basename/"
#
# add_permalink_suffix("/:basename", "/:year/:month/:title")
# # => "/:basename"
#
# Returns the updated permalink template
def add_permalink_suffix(template, permalink_style)
case permalink_style
when :pretty
template << "/"
when :date, :ordinal, :none
template << ":output_ext"
else
template << "/" if permalink_style.to_s.end_with?("/")
template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
end
template
end
# Work the same way as Dir.glob but seperating the input into two parts
# ('dir' + '/' + 'pattern') to make sure the first part('dir') does not act
# as a pattern.
#
# For example, Dir.glob("path[/*") always returns an empty array,
# because the method fails to find the closing pattern to '[' which is ']'
#
# Examples:
# safe_glob("path[", "*")
# # => ["path[/file1", "path[/file2"]
#
# safe_glob("path", "*", File::FNM_DOTMATCH)
# # => ["path/.", "path/..", "path/file1"]
#
# safe_glob("path", ["**", "*"])
# # => ["path[/file1", "path[/folder/file2"]
#
# dir - the dir where glob will be executed under
# (the dir will be included to each result)
# patterns - the patterns (or the pattern) which will be applied under the dir
# flags - the flags which will be applied to the pattern
#
# Returns matched pathes
def safe_glob(dir, patterns, flags = 0)
return [] unless Dir.exist?(dir)
pattern = File.join(Array patterns)
return [dir] if pattern.empty?
Dir.chdir(dir) do
Dir.glob(pattern, flags).map { |f| File.join(dir, f) }
end
end
# Returns merged option hash for File.read of self.site (if exists)
# and a given param
def merged_file_read_opts(site, opts)
merged = (site ? site.file_read_opts : {}).merge(opts)
if merged["encoding"] && !merged["encoding"].start_with?("bom|")
merged["encoding"].insert(0, "bom|")
end
merged
end
end
end
jekyll-3.1.6/lib/jekyll/utils/ 0000775 0000000 0000000 00000000000 12717414063 0016220 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/jekyll/utils/ansi.rb 0000664 0000000 0000000 00000003050 12717414063 0017475 0 ustar 00root root 0000000 0000000 # Frozen-string-literal: true
# Copyright: 2015 Jekyll - MIT License
# Encoding: utf-8
module Jekyll
module Utils
module Ansi
extend self
ESCAPE = format("%c", 27)
MATCH = /#{ESCAPE}\[(?:\d+)(?:;\d+)*(j|k|m|s|u|A|B|G)|\e\(B\e\[m/ix.freeze
COLORS = {
:red => 31,
:green => 32,
:black => 30,
:magenta => 35,
:yellow => 33,
:white => 37,
:blue => 34,
:cyan => 36
}
# Strip ANSI from the current string. It also strips cursor stuff,
# well some of it, and it also strips some other stuff that a lot of
# the other ANSI strippers don't.
def strip(str)
str.gsub MATCH, ""
end
#
def has?(str)
!!(str =~ MATCH)
end
# Reset the color back to the default color so that you do not leak any
# colors when you move onto the next line. This is probably normally
# used as part of a wrapper so that we don't leak colors.
def reset(str = "")
@ansi_reset ||= format("%c[0m", 27)
"#{@ansi_reset}#{str}"
end
# SEE: `self::COLORS` for a list of methods. They are mostly
# standard base colors supported by pretty much any xterm-color, we do
# not need more than the base colors so we do not include them.
# Actually... if I'm honest we don't even need most of the
# base colors.
COLORS.each do |color, num|
define_method color do |str|
"#{format("%c", 27)}[#{num}m#{str}#{reset}"
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/utils/platforms.rb 0000664 0000000 0000000 00000001615 12717414063 0020557 0 ustar 00root root 0000000 0000000 module Jekyll
module Utils
module Platforms
extend self
# Provides jruby? and mri? which respectively detect these two types of
# tested Engines we support, in the future we might probably support the
# other one that everyone used to talk about.
{ :jruby? => "jruby", :mri? => "ruby" }.each do |k, v|
define_method k do
::RUBY_ENGINE == v
end
end
# Provides windows?, linux?, osx?, unix? so that we can detect
# platforms. This is mostly useful for `jekyll doctor` and for testing
# where we kick off certain tests based on the platform.
{ :windows? => /mswin|mingw|cygwin/, :linux? => /linux/, \
:osx? => /darwin|mac os/, :unix? => /solaris|bsd/ }.each do |k, v|
define_method k do
!!(
RbConfig::CONFIG["host_os"] =~ v
)
end
end
end
end
end
jekyll-3.1.6/lib/jekyll/version.rb 0000664 0000000 0000000 00000000046 12717414063 0017072 0 ustar 00root root 0000000 0000000 module Jekyll
VERSION = '3.1.6'
end
jekyll-3.1.6/lib/site_template/ 0000775 0000000 0000000 00000000000 12717414063 0016425 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/site_template/.gitignore 0000664 0000000 0000000 00000000043 12717414063 0020412 0 ustar 00root root 0000000 0000000 _site
.sass-cache
.jekyll-metadata
jekyll-3.1.6/lib/site_template/_config.yml 0000664 0000000 0000000 00000001573 12717414063 0020562 0 ustar 00root root 0000000 0000000 # 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.
# 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
title: Your awesome title
email: your-email@domain.com
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll
# Build settings
markdown: kramdown
jekyll-3.1.6/lib/site_template/_includes/ 0000775 0000000 0000000 00000000000 12717414063 0020372 5 ustar 00root root 0000000 0000000 jekyll-3.1.6/lib/site_template/_includes/footer.html 0000664 0000000 0000000 00000001650 12717414063 0022560 0 ustar 00root root 0000000 0000000
jekyll-3.1.6/lib/site_template/_includes/head.html 0000664 0000000 0000000 00000001422 12717414063 0022160 0 ustar 00root root 0000000 0000000
{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}
jekyll-3.1.6/lib/site_template/_includes/header.html 0000664 0000000 0000000 00000002140 12717414063 0022505 0 ustar 00root root 0000000 0000000