diff --git a/.travis.yml b/.travis.yml index 17ded23a..e193e371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,28 @@ language: ruby cache: bundler -before_install: - - gem install bundler +install: +- script/rebund download +- bundle install --path vendor/bundle rvm: - - 2.1.0 - - 2.0.0 - - 1.9.3 - - 1.9.2 -script: bundle exec rake +- 2.1.0 +- 2.0.0 +- 1.9.3 +- 1.9.2 +script: script/cibuild +after_script: +- script/rebund upload notifications: irc: on_success: change on_failure: change channels: - - "irc.freenode.org#jekyll" - #on_success: change - #on_failure: change + - irc.freenode.org#jekyll template: - - "%{repository}#%{build_number} (%{branch}) %{message} %{build_url}" + - '%{repository}#%{build_number} (%{branch}) %{message} %{build_url}' email: on_success: never on_failure: never +env: + global: + - secure: YFgVNymO2MvA7ieB3hJKQ9cF8zhi5uc3NnBx+ngs6+XF7lV7zYZGMYJ9ufEuPRkXFEI1sSNQJjOQwjmqC71xABrWw6B69XDdYgoTX+53GryVfsrDIPksQo89WAAMKqoPznWtj5fA3OTxUWjHVye2JsduPNuihpniI5j79IzDFQY= + - secure: YrDB4baCV00FPyRafR9UTAUsSgK/07Re+7T+blgX2gK/j54DJdof+EYbQPjc3HeWdfQgIzal2+KkwBItEu2lA8/j6qPwUngd9oRWJPLm19xFizECRY9SD1BxU53T3qmnoYqG0jFvKgYfnn9ggHRDEL31YDOA1monhFhq/8S3SdA= diff --git a/History.markdown b/History.markdown index 9145f044..a6ffeeaf 100644 --- a/History.markdown +++ b/History.markdown @@ -8,6 +8,10 @@ * 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) ### Minor Enhancements * Move the EntryFilter class into the Jekyll module to avoid polluting the @@ -28,6 +32,8 @@ (#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) ### Bug Fixes * Don't allow nil entries when loading posts (#1796) @@ -38,6 +44,10 @@ * 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) ### Development Fixes * Add a link to the site in the README.md file (#1795) @@ -51,6 +61,11 @@ (#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) ### Site Enhancements * Document Kramdown's GFM parser option (#1791) @@ -74,6 +89,22 @@ * 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) + +## 1.4.3 / 2014-01-13 + +### Bug Fixes + * Patch show-stopping security vulnerabilities (#1944) ## 1.4.2 / 2013-12-16 diff --git a/README.markdown b/README.markdown index f56cb4ca..228881db 100644 --- a/README.markdown +++ b/README.markdown @@ -9,7 +9,11 @@ By Tom Preston-Werner, Nick Quaranto, and many [awesome contributors](https://github.com/jekyll/jekyll/graphs/contributors)! -Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind [GitHub Pages](http://pages.github.com), which you can use to host your project's page or blog right here from GitHub. +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. ## Getting Started diff --git a/jekyll.gemspec b/jekyll.gemspec index 1608ce76..b78a6e13 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -5,9 +5,9 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.9.2' s.name = 'jekyll' - s.version = '1.4.0' + s.version = '1.4.3' s.license = 'MIT' - s.date = '2013-12-09' + s.date = '2014-01-13' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -24,16 +24,18 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.extra_rdoc_files = %w[README.markdown LICENSE] - s.add_runtime_dependency('liquid', "~> 2.5.2") + s.add_runtime_dependency('liquid', "~> 2.5.5") s.add_runtime_dependency('classifier', "~> 1.3") s.add_runtime_dependency('listen', "~> 1.3") - s.add_runtime_dependency('maruku', "~> 0.7.0") + s.add_runtime_dependency('maruku', "0.7.0") s.add_runtime_dependency('pygments.rb', "~> 0.5.0") s.add_runtime_dependency('mercenary', "~> 0.2.0") s.add_runtime_dependency('safe_yaml', "~> 1.0") s.add_runtime_dependency('colorator', "~> 0.1") s.add_runtime_dependency('redcarpet', "~> 3.0") s.add_runtime_dependency('toml', '~> 0.1.0') + s.add_runtime_dependency('sass', '~> 3.2') + s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0') s.add_development_dependency('rake', "~> 10.1") s.add_development_dependency('rdoc', "~> 3.11") @@ -94,6 +96,7 @@ Gem::Specification.new do |s| lib/jekyll/converters/markdown/maruku_parser.rb lib/jekyll/converters/markdown/rdiscount_parser.rb lib/jekyll/converters/markdown/redcarpet_parser.rb + lib/jekyll/converters/sass.rb lib/jekyll/converters/textile.rb lib/jekyll/convertible.rb lib/jekyll/core_ext.rb @@ -128,10 +131,14 @@ Gem::Specification.new do |s| lib/site_template/css/syntax.css lib/site_template/index.html script/bootstrap + script/branding + script/cibuild + script/rebund site/.gitignore site/CNAME site/README site/_config.yml + site/_data/docs.yml site/_includes/analytics.html site/_includes/css/gridism.css site/_includes/css/normalize.css @@ -167,7 +174,11 @@ Gem::Specification.new do |s| site/_posts/2013-11-04-jekyll-1-3-0-released.markdown site/_posts/2013-11-26-jekyll-1-3-1-released.markdown site/_posts/2013-12-07-jekyll-1-4-0-released.markdown + site/_posts/2013-12-09-jekyll-1-4-1-released.markdown + site/_posts/2013-12-16-jekyll-1-4-2-released.markdown + site/_posts/2014-01-13-jekyll-1-4-3-released.markdown site/css/screen.css + site/docs/assets.md site/docs/configuration.md site/docs/contributing.md site/docs/datafiles.md @@ -195,6 +206,7 @@ Gem::Specification.new do |s| site/docs/upgrading.md site/docs/usage.md site/docs/variables.md + site/docs/windows.md site/favicon.png site/feed.xml site/freenode.txt @@ -220,7 +232,7 @@ Gem::Specification.new do |s| test/source/_config.dev.toml test/source/_data/languages.yml test/source/_data/members.yaml - test/source/_data/products.yml + test/source/_includes/include.html test/source/_includes/params.html test/source/_includes/sig.markdown test/source/_layouts/default.html @@ -260,6 +272,8 @@ Gem::Specification.new do |s| test/source/_posts/2013-05-10-number-category.textile test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown test/source/_posts/2013-08-01-mkdn-extension.mkdn + test/source/_posts/2013-12-17-include-variable-filters.markdown + test/source/_posts/2013-12-20-properties.text test/source/_posts/es/2008-11-21-nested.textile test/source/about.html test/source/category/_posts/2008-9-23-categories.textile @@ -270,14 +284,15 @@ Gem::Specification.new do |s| test/source/deal.with.dots.html test/source/foo/_posts/bar/2008-12-12-topical-post.textile test/source/index.html + test/source/js/coffeescript.coffee test/source/products.yml + test/source/properties.html test/source/sitemap.xml - test/source/symlink-test/_data - test/source/symlink-test/symlinked-dir - test/source/symlink-test/symlinked-file + test/source/unpublished.html test/source/win/_posts/2009-05-24-yaml-linebreak.markdown test/source/z_category/_posts/2008-9-23-categories.textile test/suite.rb + test/test_coffeescript.rb test/test_command.rb test/test_configuration.rb test/test_convertible.rb @@ -295,6 +310,7 @@ Gem::Specification.new do |s| test/test_redcarpet.rb test/test_redcloth.rb test/test_related_posts.rb + test/test_sass.rb test/test_site.rb test/test_tags.rb test/test_url.rb diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 4b45e2ba..caa45e50 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -18,7 +18,7 @@ require 'rubygems' # stdlib require 'fileutils' require 'time' -require 'safe_yaml' +require 'safe_yaml/load' require 'English' require 'pathname' @@ -27,6 +27,7 @@ require 'liquid' require 'maruku' require 'colorator' require 'toml' +require 'sass' # internal requires require 'jekyll/core_ext' @@ -60,6 +61,9 @@ require_all 'jekyll/converters/markdown' require_all 'jekyll/generators' require_all 'jekyll/tags' +# plugins +require 'jekyll-coffeescript' + SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index f5e10fe0..afa43d30 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -105,7 +105,7 @@ module Jekyll when '.toml' TOML.load_file(filename) when /\.y(a)?ml/ - YAML.safe_load_file(filename) + SafeYAML.load_file(filename) else raise ArgumentError, "No parser for '#{filename}' is available. Use a .toml or .y(a)ml file instead." end diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb new file mode 100644 index 00000000..0c36eb65 --- /dev/null +++ b/lib/jekyll/converters/sass.rb @@ -0,0 +1,58 @@ +module Jekyll + class Sass < Converter + safe true + priority :low + + def matches(ext) + ext =~ /^\.s(a|c)ss$/i + end + + def output_ext(ext) + ".css" + end + + def jekyll_sass_configuration + @config["sass"] || {} + end + + def sass_build_configuration_options(overrides) + jekyll_sass_configuration.deep_merge(overrides).symbolize_keys + end + + def syntax_type_of_content(content) + if content.include?(";") || content.include?("{") + :scss + else + :sass + end + end + + def sass_dir + return "_sass" if jekyll_sass_configuration["sass_dir"].to_s.empty? + jekyll_sass_configuration["sass_dir"] + end + + def sass_dir_relative_to_site_source + File.join( + @config["source"], + File.expand_path(sass_dir, "/") # FIXME: Not windows-compatible + ) + end + + def allow_caching? + !@config["safe"] + end + + def sass_configs(content = "") + sass_build_configuration_options({ + "syntax" => syntax_type_of_content(content), + "cache" => allow_caching?, + "load_paths" => [sass_dir_relative_to_site_source] + }) + end + + def convert(content) + ::Sass.compile(content, sass_configs(content)) + end + end +end diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index f838d29b..941312f3 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -21,6 +21,11 @@ module Jekyll self.content || '' end + # Whether the file is published or not, as indicated in YAML front-matter + def published? + !(self.data.has_key?('published') && self.data['published'] == false) + end + # Returns merged option hash for File.read of self.site (if exists) # and a given param def merged_file_read_opts(opts) @@ -40,7 +45,7 @@ module Jekyll merged_file_read_opts(opts)) if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m self.content = $POSTMATCH - self.data = YAML.safe_load($1) + self.data = SafeYAML.load($1) end rescue SyntaxError => e puts "YAML Exception reading #{File.join(base, name)}: #{e.message}" diff --git a/lib/jekyll/mime.types b/lib/jekyll/mime.types index b926a009..ee7aa44c 100644 --- a/lib/jekyll/mime.types +++ b/lib/jekyll/mime.types @@ -1,12 +1,13 @@ -# These are the same MIME types that GitHub Pages uses as of 17 Mar 2013. +-# These are the same MIME types that GitHub Pages uses as of 26 January 2014 text/html html htm shtml text/css css -text/xml xml rss xsl +text/xml xml rss xsl xsd image/gif gif image/jpeg jpeg jpg application/x-javascript js application/atom+xml atom +application/json json geojson topojson text/mathml mml text/plain txt @@ -17,16 +18,22 @@ text/cache-manifest manifest appcache text/coffeescript coffee text/plain pde text/plain md markdown +text/vcard vcf vcard image/png png image/svg+xml svg +image/svg+xml svgz image/tiff tif tiff image/vnd.wap.wbmp wbmp image/x-icon ico image/x-jng jng image/x-ms-bmp bmp -application/json json +application/vnd.ms-fontobject eot +application/x-font-ttf ttf +application/x-font-woff woff +font/opentype otf + application/java-archive jar ear application/mac-binhex40 hqx application/msword doc @@ -34,18 +41,19 @@ application/pdf pdf application/postscript ps eps ai application/rdf+xml rdf application/rtf rtf -text/vcard vcf vcard application/vnd.apple.pkpass pkpass application/vnd.ms-excel xls application/vnd.ms-powerpoint ppt application/vnd.wap.wmlc wmlc application/xhtml+xml xhtml -application/x-chrome-extension crx application/x-cocoa cco -application/x-font-ttf ttf +application/x-chrome-extension crx application/x-java-archive-diff jardiff application/x-java-jnlp-file jnlp application/x-makeself run +application/x-ms-application application +application/x-ms-manifest manifest +application/x-ms-vsto vsto application/x-ns-proxy-autoconfig pac application/x-perl pl pm application/x-pilot prc pdb @@ -63,8 +71,8 @@ application/zip zip application/octet-stream bin exe dll application/octet-stream deb +application/octet-stream deploy application/octet-stream dmg -application/octet-stream eot application/octet-stream iso img application/octet-stream msi msp msm @@ -74,12 +82,14 @@ audio/x-realaudio ra audio/ogg ogg video/3gpp 3gpp 3gp +video/m4v m4v +video/mp4 mp4 video/mpeg mpeg mpg +video/ogg ogg ogv video/quicktime mov +video/webm webm video/x-flv flv video/x-mng mng video/x-ms-asf asx asf video/x-ms-wmv wmv video/x-msvideo avi -video/ogg ogv -video/webm webm diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index f9e678c6..31ed2032 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -35,7 +35,7 @@ module Jekyll attr_accessor :site attr_accessor :data, :extracted_excerpt, :content, :output, :ext - attr_accessor :date, :slug, :published, :tags, :categories + attr_accessor :date, :slug, :tags, :categories attr_reader :name @@ -60,20 +60,10 @@ module Jekyll self.date = Time.parse(self.data["date"].to_s) end - self.published = self.published? - self.populate_categories self.populate_tags end - def published? - if self.data.has_key?('published') && self.data['published'] == false - false - else - true - end - end - def populate_categories if self.categories.empty? self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase} @@ -281,8 +271,7 @@ module Jekyll end def next - pos = self.site.posts.index(self) - + pos = self.site.posts.index {|post| post.equal?(self) } if pos && pos < self.site.posts.length-1 self.site.posts[pos+1] else @@ -291,7 +280,7 @@ module Jekyll end def previous - pos = self.site.posts.index(self) + pos = self.site.posts.index {|post| post.equal?(self) } if pos && pos > 0 self.site.posts[pos-1] else diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index c3d68507..7457ca6d 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -170,7 +170,8 @@ module Jekyll f_rel = File.join(dir, f) read_directories(f_rel) unless self.dest.sub(/\/$/, '') == f_abs elsif has_yaml_header?(f_abs) - pages << Page.new(self, self.source, dir, f) + page = Page.new(self, self.source, dir, f) + pages << page if page.published? else static_files << StaticFile.new(self, self.source, dir, f) end @@ -189,7 +190,7 @@ module Jekyll posts = read_content(dir, '_posts', Post) posts.each do |post| - if post.published && (self.future || post.date <= self.time) + if post.published? && (self.future || post.date <= self.time) aggregate_post_info(post) end end @@ -232,7 +233,7 @@ module Jekyll next if File.symlink?(path) && self.safe key = sanitize_filename(File.basename(entry, '.*')) - self.data[key] = YAML.safe_load_file(path) + self.data[key] = SafeYAML.load_file(path) end end diff --git a/script/rebund b/script/rebund new file mode 100755 index 00000000..7aa2db2c --- /dev/null +++ b/script/rebund @@ -0,0 +1,140 @@ +#!/bin/bash +# +# rebund(1) +# +# Author: Julien Letessier +# Homepage: https://github.com/mezis/rebund +# License: +# +# Copyright (c) 2014 HouseTrip Ltd +# +# MIT License +# +# 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. + + +# Configuration +: ${REBUND_CREDENTIALS:=user:secret} +: ${REBUND_ENDPOINT=http://keyfile-production.herokuapp.com} +: ${REBUND_TARBALL:=bundle.tbz} +: ${REBUND_BUNDLE_DIR:=vendor/bundle} + + + +log() { + echo "rebund: $*" > /dev/stderr +} + +die() { + echo "fatal: $*" > /dev/stderr + exit 1 +} + +success() { + log "$*" + exit 0 +} + +on_error() { + die 'unknown error.' +} + +get_ruby_version() { + bundle exec ruby --version +} + +get_gemfile() { + bundle exec sh -c 'echo $BUNDLE_GEMFILE' +} + +calculate_hash() { + (get_ruby_version ; cat $(get_gemfile)) | openssl sha256 | sed -e 's/.* //' +} + +build_tarball() { + test -e $REBUND_BUNDLE_DIR || die "cannot find bundle directory in ${REBUND_BUNDLE_DIR}" + test -e $REBUND_TARBALL && success 'bundle already uploaded' + tar jcf $REBUND_TARBALL $REBUND_BUNDLE_DIR +} + +upload_tarball() { + curl --fail \ + -F filedata=@${REBUND_TARBALL} \ + --digest --user $REBUND_CREDENTIALS \ + ${REBUND_ENDPOINT}/$(calculate_hash) \ + || success "could not upload bundle" +} + +expand_tarball() { + test -e $REBUND_TARBALL || success "no tarball" + tar jxf $REBUND_TARBALL +} + +download_tarball() { + curl --fail \ + --location \ + -o ${REBUND_TARBALL} \ + --digest --user $REBUND_CREDENTIALS \ + ${REBUND_ENDPOINT}/$(calculate_hash) \ + || success "could not download bundle" +} + +rebund_upload() { + build_tarball + upload_tarball +} + +rebund_download() { + download_tarball + expand_tarball +} + +rebund_usage() { + success "usage: $0 [-v] [upload|download]" +} + +# cath errors +trap on_error ERR + +# inherit the ERR trap in subprocesses +set -E + +while test $# -gt 0 ; do + case $1 in + -v) + set -x + ;; + upload) + rebund_upload + exit 0 + ;; + download) + rebund_download + exit 0 + ;; + *) + rebund_usage + exit 1 + ;; + esac + shift +done + +rebund_usage diff --git a/site/_data/docs.yml b/site/_data/docs.yml new file mode 100644 index 00000000..1c790636 --- /dev/null +++ b/site/_data/docs.yml @@ -0,0 +1,44 @@ +- title: Getting Started + docs: + - home + - quickstart + - installation + - usage + - structure + - configuration + +- title: Your Content + docs: + - frontmatter + - posts + - drafts + - pages + - variables + - datafiles + - assets + - migrations + +- title: Customization + docs: + - templates + - permalinks + - pagination + - plugins + - extras + +- title: Deployment + docs: + - github-pages + - deployment-methods + +- title: Miscellaneous + docs: + - troubleshooting + - sites + - resources + - upgrading + +- title: Meta + docs: + - contributing + - history diff --git a/site/_includes/docs_contents.html b/site/_includes/docs_contents.html index 523b5227..2ac64bb4 100644 --- a/site/_includes/docs_contents.html +++ b/site/_includes/docs_contents.html @@ -1,16 +1,8 @@
diff --git a/site/_includes/docs_contents_mobile.html b/site/_includes/docs_contents_mobile.html index bbc367d4..b3e0110c 100644 --- a/site/_includes/docs_contents_mobile.html +++ b/site/_includes/docs_contents_mobile.html @@ -1,23 +1,10 @@
diff --git a/site/_includes/docs_option.html b/site/_includes/docs_option.html index 8284ed96..a1e29cac 100644 --- a/site/_includes/docs_option.html +++ b/site/_includes/docs_option.html @@ -1,4 +1,4 @@ -{% assign items = include.items | split: ' ' %} +{% assign items = include.items %} {% for item in items %} {% assign item_url = item | prepend:'/docs/' | append:'/' %} diff --git a/site/_includes/docs_ul.html b/site/_includes/docs_ul.html index 4ba82479..99ac26ef 100644 --- a/site/_includes/docs_ul.html +++ b/site/_includes/docs_ul.html @@ -1,4 +1,4 @@ -{% assign items = include.items | split: ' ' %} +{% assign items = include.items %} diff --git a/site/_layouts/news_item.html b/site/_layouts/news_item.html index d3955020..72927b9e 100644 --- a/site/_layouts/news_item.html +++ b/site/_layouts/news_item.html @@ -21,7 +21,7 @@ layout: news {{ page.author }} -

+

{{ content }} -

+
diff --git a/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown b/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown new file mode 100644 index 00000000..a97bcec4 --- /dev/null +++ b/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown @@ -0,0 +1,26 @@ +--- +layout: news_item +title: 'Jekyll 1.4.3 Released' +date: 2014-01-13 17:43:32 -0800 +author: benbalter +version: 1.4.3 +categories: [release] +--- + +Jekyll 1.4.3 contains two **critical** security fixes. If you run Jekyll locally +and do not run Jekyll in "safe" mode (e.g. you do not build Jekyll sites on behalf +of others), you are not affected and are not required to update at this time. +([See pull request.]({{ site.repository }}/pull/1944)) + +Versions of Jekyll prior to 1.4.3 and greater than 1.2.0 may allow malicious +users to expose the content of files outside the source directory in the +generated output via improper symlink sanitization, potentially resulting in an +inadvertent information disclosure. + +Versions of Jekyll prior to 1.4.3 may also allow malicious users to write +arbitrary `.html` files outside of the destination folder via relative path +traversal, potentially overwriting otherwise-trusted content with arbitrary HTML +or Javascript depending on your server's configuration. + +*Maintainer's note: Many thanks to @gregose and @charliesome for discovering +these vulnerabilities, and to @BenBalter and @alindeman for writing the patch.* diff --git a/site/docs/assets.md b/site/docs/assets.md new file mode 100644 index 00000000..5191dc15 --- /dev/null +++ b/site/docs/assets.md @@ -0,0 +1,46 @@ +--- +layout: docs +title: Assets +prev_section: datafiles +next_section: migrations +permalink: /docs/assets/ +--- + +Jekyll provides built-in support for Sass and CoffeeScript. In order to use +them, create a file with the proper extension name (one of `.sass`, `.scss`, +or `.coffee`) and start the file with two lines of triple dashes, like this: + +{% highlight sass %} +--- +--- + +// start content +.my-definition + font-size: 1.2em +{% endhighlight %} + +## Sass/SCSS + +Jekyll allows you to customize your Sass conversion in certain ways. + +If you are using Sass `@import` statements, you'll need to ensure that your +`sass_dir` is set to the base directory that contains your Sass files. You +can do that thusly: + +{% highlight yaml %} +sass: + sass_dir: _sass +{% endhighlight %} + +The Sass converter will default to `_sass`. + +You may also specify the output style with the `style` option in your +`_config.yml` file: + +{% highlight yaml %} +sass: + style: :compressed +{% endhighlight %} + +These are passed to Sass, so any output style options Sass supports are valid +here, too. diff --git a/site/docs/datafiles.md b/site/docs/datafiles.md index b3421c38..55af6ec4 100644 --- a/site/docs/datafiles.md +++ b/site/docs/datafiles.md @@ -2,25 +2,25 @@ layout: docs title: Data Files prev_section: variables -next_section: migrations +next_section: assets permalink: /docs/datafiles/ --- In addition to the [built-in variables](../variables/) available from Jekyll, -you can specify your own custom data that can be accessed via the [Liquid +you can specify your own custom data that can be accessed via the [Liquid templating system](http://wiki.github.com/shopify/liquid/liquid-for-designers). -Jekyll supports loading data from [YAML](http://yaml.org/) files located in the +Jekyll supports loading data from [YAML](http://yaml.org/) files located in the `_data` directory. This powerful feature allows you to avoid repetition in your templates and to -set site specific options without changing `_config.yml`. +set site specific options without changing `_config.yml`. Plugins/themes can also leverage Data Files to set configuration variables. ## The Data Folder -As explained on the [directory structure](../structure/) page, the `_data` +As explained on the [directory structure](../structure/) page, the `_data` folder is where you can store additional data for Jekyll to use when generating your site. These files must be YAML files (using either the `.yml` or `.yaml` extension) and they will be accessible via `site.data`. diff --git a/site/docs/migrations.md b/site/docs/migrations.md index 27ecf71d..f9ecc1f5 100644 --- a/site/docs/migrations.md +++ b/site/docs/migrations.md @@ -1,7 +1,7 @@ --- layout: docs title: Blog migrations -prev_section: datafiles +prev_section: assets next_section: templates permalink: /docs/migrations/ --- diff --git a/site/docs/plugins.md b/site/docs/plugins.md index 2126ea7f..7370cd88 100644 --- a/site/docs/plugins.md +++ b/site/docs/plugins.md @@ -457,6 +457,7 @@ You can find a few useful plugins at the following locations: - [pluralize](https://github.com/bdesham/pluralize): Easily combine a number and a word into a gramatically-correct amount like “1 minute” or “2 minute**s**”. - [reading_time](https://github.com/bdesham/reading_time): Count words and estimate reading time for a piece of text, ignoring HTML elements that are unlikely to contain running text. - [Table of Content Generator](https://github.com/dafi/jekyll-toc-generator): Generate the HTML code containing a table of content (TOC), the TOC can be customized in many way, for example you can decide which pages can be without TOC. +- [jekyll-humanize](https://github.com/23maverick23/jekyll-humanize): This is a port of the Django app humanize which adds a "human touch" to data. Each method represents a Fluid type filter that can be used in your Jekyll site templates. Given that Jekyll produces static sites, some of the original methods do not make logical sense to port (e.g. naturaltime). #### Tags @@ -496,6 +497,7 @@ You can find a few useful plugins at the following locations: - [Jekyll Date Chart](https://github.com/GSI/jekyll_date_chart) by [GSI](https://github.com/GSI): Block that renders date line charts based on textile-formatted tables. - [Jekyll Image Encode](https://github.com/GSI/jekyll_image_encode) by [GSI](https://github.com/GSI): Tag that renders base64 codes of images fetched from the web. - [Jekyll Quick Man](https://github.com/GSI/jekyll_quick_man) by [GSI](https://github.com/GSI): Tag that renders pretty links to man page sources on the internet. +- [jekyll-font-awesome](https://gist.github.com/23maverick23/8532525): Quickly and easily add Font Awesome icons to your posts. #### Collections @@ -525,6 +527,12 @@ You can find a few useful plugins at the following locations: - [grunt-jekyll](https://github.com/dannygarcia/grunt-jekyll): A straightforward [Grunt](http://gruntjs.com/) plugin for Jekyll. - [jekyll-postfiles](https://github.com/indirect/jekyll-postfiles): Add `_postfiles` directory and {% raw %}`{{ postfile }}`{% endraw %} tag so the files a post refers to will always be right there inside your repo. +#### Editors + +- [sublime-jekyll](https://github.com/23maverick23/sublime-jekyll): A Sublime Text package for Jekyll static sites. This package should help creating Jekyll sites and posts easier by providing access to key template tags and filters, as well as common completions and a current date/datetime command (for dating posts). You can install this package manually via GitHub, or via [Package Control](https://sublime.wbond.net/packages/Jekyll). +- [vim-jekyll](https://github.com/parkr/vim-jekyll): A vim plugin to generate + new posts and run `jekyll build` all without leaving vim. +
Jekyll Plugins Wanted

diff --git a/site/docs/posts.md b/site/docs/posts.md index f93eb6b5..a8f918f8 100644 --- a/site/docs/posts.md +++ b/site/docs/posts.md @@ -155,6 +155,8 @@ If you don't like the automatically-generated post excerpt, it can be overridden `excerpt` to your post's YAML front-matter. Completely disable it by setting your `excerpt_separator` to `""`. +Also, as with any output generated by Liquid tags, you can pass the `| strip_html` flag to remove any html tags in the output. This is particularly helpful if you wish to output a post excerpt as a `meta="description"` tag within the post `head`, or anywhere else having html tags along with the content is not desirable. + ## Highlighting code snippets Jekyll also has built-in support for syntax highlighting of code snippets using diff --git a/site/docs/structure.md b/site/docs/structure.md index d03baee0..c178a65f 100644 --- a/site/docs/structure.md +++ b/site/docs/structure.md @@ -113,7 +113,7 @@ An overview of what each of these does:

- Your dynamic content, so to speak. The format of these files is + Your dynamic content, so to speak. The naming convention of these files is important, and must follow the format: YEAR-MONTH-DAY-title.MARKUP. The permalinks can be customized for each diff --git a/site/docs/variables.md b/site/docs/variables.md index 89e11a52..96578311 100644 --- a/site/docs/variables.md +++ b/site/docs/variables.md @@ -244,6 +244,24 @@ following is a reference of the available data.

+ +

page.next

+

+ + The next post relative to the position of the current post in + site.posts. Returns nil for the last entry. + +

+ + +

page.previous

+

+ + The previous post relative to the position of the current post in + site.posts. Returns nil for the first entry. + +

+
diff --git a/test/source/js/coffeescript.coffee b/test/source/js/coffeescript.coffee new file mode 100644 index 00000000..e0e066b1 --- /dev/null +++ b/test/source/js/coffeescript.coffee @@ -0,0 +1,10 @@ +--- +--- + +$ -> + list = [1, 2, 3, 4, 5] + square = (x) -> x * x + cube = (x) -> square(x) * x + cubes = (math.cube num for num in list) + + alert "I knew it!" if elvis? diff --git a/test/source/unpublished.html b/test/source/unpublished.html new file mode 100644 index 00000000..265b6062 --- /dev/null +++ b/test/source/unpublished.html @@ -0,0 +1,7 @@ +--- +layout: default +title: Not published! +published: false +--- + +This should *not* be published! diff --git a/test/test_coffeescript.rb b/test/test_coffeescript.rb new file mode 100644 index 00000000..cd052c05 --- /dev/null +++ b/test/test_coffeescript.rb @@ -0,0 +1,49 @@ +require 'helper' + +class TestCoffeeScript < Test::Unit::TestCase + context "converting CoffeeScript" do + setup do + @site = Jekyll::Site.new(Jekyll.configuration({ + "source" => source_dir, + "destination" => dest_dir + })) + @site.process + @test_coffeescript_file = dest_dir("js/coffeescript.js") + @js_output = <<-JS +(function() { + $(function() { + var cube, cubes, list, num, square; + list = [1, 2, 3, 4, 5]; + square = function(x) { + return x * x; + }; + cube = function(x) { + return square(x) * x; + }; + cubes = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = list.length; _i < _len; _i++) { + num = list[_i]; + _results.push(math.cube(num)); + } + return _results; + })(); + if (typeof elvis !== \"undefined\" && elvis !== null) { + return alert(\"I knew it!\"); + } + }); + +}).call(this); +JS + end + + should "write a JS file in place" do + assert File.exists?(@test_coffeescript_file), "Can't find the converted CoffeeScript file in the dest_dir." + end + + should "produce JS" do + assert_equal @js_output, File.read(@test_coffeescript_file) + end + end +end diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 36e6cb1d..a96141fa 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -106,31 +106,36 @@ class TestConfiguration < Test::Unit::TestCase end should "fire warning with no _config.yml" do - mock(YAML).safe_load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } + mock(SafeYAML).load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } mock($stderr).puts("Configuration file: none".yellow) assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "load configuration as hash" do - mock(YAML).safe_load_file(@path) { Hash.new } + mock(SafeYAML).load_file(@path) { Hash.new } mock($stdout).puts("Configuration file: #{@path}") assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "fire warning with bad config" do - mock(YAML).safe_load_file(@path) { Array.new } + mock(SafeYAML).load_file(@path) { Array.new } mock($stderr).puts(("WARNING: ".rjust(20) + "Error reading configuration. Using defaults (and options).").yellow) mock($stderr).puts("Configuration file: (INVALID) #{@path}".yellow) assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "fire warning when user-specified config file isn't there" do - mock(YAML).safe_load_file(@user_config) { raise SystemCallError, "No such file or directory - #{@user_config}" } + mock(SafeYAML).load_file(@user_config) { raise SystemCallError, "No such file or directory - #{@user_config}" } mock($stderr).puts(("Fatal: ".rjust(20) + "The configuration file '#{@user_config}' could not be found.").red) assert_raises LoadError do Jekyll.configuration({'config' => [@user_config]}) end end + + should "not clobber YAML.load to the dismay of other libraries" do + assert_equal :foo, YAML.load(':foo') + # as opposed to: assert_equal ':foo', SafeYAML.load(':foo') + end end context "loading config from external file" do setup do @@ -143,19 +148,19 @@ class TestConfiguration < Test::Unit::TestCase end should "load default config if no config_file is set" do - mock(YAML).safe_load_file(@paths[:default]) { Hash.new } + mock(SafeYAML).load_file(@paths[:default]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "load different config if specified" do - mock(YAML).safe_load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} } + mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} } mock($stdout).puts("Configuration file: #{@paths[:other]}") assert_equal Jekyll::Configuration::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] }) end should "load default config if path passed is empty" do - mock(YAML).safe_load_file(@paths[:default]) { Hash.new } + mock(SafeYAML).load_file(@paths[:default]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) end @@ -167,8 +172,8 @@ class TestConfiguration < Test::Unit::TestCase end should "load multiple config files" do - mock(YAML).safe_load_file(@paths[:default]) { Hash.new } - mock(YAML).safe_load_file(@paths[:other]) { Hash.new } + mock(SafeYAML).load_file(@paths[:default]) { Hash.new } + mock(SafeYAML).load_file(@paths[:other]) { Hash.new } mock(TOML).load_file(@paths[:toml]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") mock($stdout).puts("Configuration file: #{@paths[:other]}") @@ -177,8 +182,8 @@ class TestConfiguration < Test::Unit::TestCase end should "load multiple config files and last config should win" do - mock(YAML).safe_load_file(@paths[:default]) { {"baseurl" => "http://example.dev"} } - mock(YAML).safe_load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} } + mock(SafeYAML).load_file(@paths[:default]) { {"baseurl" => "http://example.dev"} } + mock(SafeYAML).load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} } mock($stdout).puts("Configuration file: #{@paths[:default]}") mock($stdout).puts("Configuration file: #{@paths[:other]}") assert_equal Jekyll::Configuration::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index c7398cd5..ea20a15f 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -32,6 +32,10 @@ class TestGeneratedSite < Test::Unit::TestCase assert_equal "published.html", published.first end + should "hide unpublished page" do + assert !File.exists?(dest_dir('/unpublished.html')) + end + should "not copy _posts directory" do assert !File.exist?(dest_dir('_posts')) end diff --git a/test/test_page.rb b/test/test_page.rb index 8924aeec..8e60922f 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -25,6 +25,11 @@ class TestPage < Test::Unit::TestCase assert_equal "/contacts.html", @page.url end + should "not published when published yaml is false" do + @page = setup_page("unpublished.html") + assert_equal false, @page.published? + end + context "in a directory hierarchy" do should "create url based on filename" do @page = setup_page('/contacts', 'bar.html') diff --git a/test/test_post.rb b/test/test_post.rb index 8145d755..66ca7e45 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -398,12 +398,12 @@ class TestPost < Test::Unit::TestCase context "initializing posts" do should "publish when published yaml is no specified" do post = setup_post("2008-02-02-published.textile") - assert_equal true, post.published + assert_equal true, post.published? end should "not published when published yaml is false" do post = setup_post("2008-02-02-not-published.textile") - assert_equal false, post.published + assert_equal false, post.published? end should "recognize date in yaml" do diff --git a/test/test_sass.rb b/test/test_sass.rb new file mode 100644 index 00000000..d13fbcfe --- /dev/null +++ b/test/test_sass.rb @@ -0,0 +1,107 @@ +require 'helper' + +class TestSass < Test::Unit::TestCase + def site_configuration(overrides = {}) + Jekyll::Configuration::DEFAULTS.deep_merge(overrides).deep_merge({ + "source" => source_dir, + "destination" => dest_dir + }) + end + + def converter(overrides = {}) + Jekyll::Sass.new(site_configuration({"sass" => overrides})) + end + + def sass_content + <<-SASS +$font-stack: Helvetica, sans-serif +body + font-family: $font-stack + font-color: fuschia +SASS + end + + def scss_content + <<-SCSS +$font-stack: Helvetica, sans-serif; +body { + font-family: $font-stack; + font-color: fuschia; +} +SCSS + end + + def css_output + <<-CSS +body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } +CSS + end + + context "matching file extensions" do + should "match .scss files" do + assert converter.matches(".scss") + end + + should "match .sass files" do + assert converter.matches(".sass") + end + end + + context "determining the output file extension" do + should "always outputs the .css file extension" do + assert_equal ".css", converter.output_ext(".always-css") + end + end + + context "when building configurations" do + should "not allow caching in safe mode" do + verter = converter + verter.instance_variable_get(:@config)["safe"] = true + assert_equal false, verter.sass_configs[:cache] + end + + should "allow caching in unsafe mode" do + assert_equal true, converter.sass_configs[:cache] + end + + should "set the load paths to the _sass dir relative to site source" do + assert_equal [source_dir("_sass")], converter.sass_configs[:load_paths] + end + + should "allow the user to specify a different sass dir" do + assert_equal [source_dir("_scss")], converter({"sass_dir" => "_scss"}).sass_configs[:load_paths] + end + + should "set syntax :scss when SCSS content" do + assert_equal :scss, converter.sass_configs(scss_content)[:syntax] + end + + should "set syntax :sass when Sass content" do + assert_equal :sass, converter.sass_configs(sass_content)[:syntax] + end + + should "default to :sass syntax when content is empty" do + assert_equal :sass, converter.sass_configs[:syntax] + end + + should "not allow sass_dirs outside of site source" do + assert_equal source_dir("etc/passwd"), converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source + end + + should "override user-set syntax based on content" do + assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax] + end + end + + context "converting sass" do + should "produce CSS" do + assert_equal css_output, converter.convert(sass_content) + end + end + + context "converting SCSS" do + should "produce CSS" do + assert_equal css_output, converter.convert(scss_content) + end + end +end diff --git a/test/test_site.rb b/test/test_site.rb index aeaeba6c..5e639f50 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -157,7 +157,7 @@ class TestSite < Test::Unit::TestCase should "sort pages alphabetically" do stub.proxy(Dir).entries { |entries| entries.reverse } @site.process - sorted_pages = %w(.htaccess about.html bar.html contacts.html deal.with.dots.html exploit.md foo.md index.html index.html properties.html sitemap.xml symlinked-file) + sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html foo.md index.html index.html properties.html sitemap.xml symlinked-file) assert_equal sorted_pages, @site.pages.map(&:name) end @@ -330,7 +330,7 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll.configuration) site.process - file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'members.yaml')) + file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'members.yaml')) assert_equal site.data['members'], file_content assert_equal site.site_payload['site']['data']['members'], file_content @@ -340,7 +340,7 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll.configuration) site.process - file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'languages.yml')) + file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'languages.yml')) assert_equal site.data['languages'], file_content assert_equal site.site_payload['site']['data']['languages'], file_content @@ -350,7 +350,7 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll.configuration.merge({'safe' => false})) site.process - file_content = YAML.safe_load_file(File.join(source_dir, '_data', 'products.yml')) + file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'products.yml')) assert_equal site.data['products'], file_content assert_equal site.site_payload['site']['data']['products'], file_content diff --git a/test/test_tags.rb b/test/test_tags.rb index 37e1d583..e6887ef6 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -522,6 +522,25 @@ CONTENT end end + context "include missing file" do + setup do + @content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true}) + end + assert_equal 'Included file \'_includes/missing.html\' not found', exception.message + end + end + context "include tag with variable and liquid filters" do setup do stub(Jekyll).configuration do