Merge master into security-vuln-patches

This commit is contained in:
Parker Moore 2014-02-16 22:02:03 -05:00
commit ab0ebadee3
32 changed files with 257 additions and 68 deletions

View File

@ -7,7 +7,6 @@ rvm:
- 2.1.0 - 2.1.0
- 2.0.0 - 2.0.0
- 1.9.3 - 1.9.3
- 1.9.2
script: script/cibuild script: script/cibuild
after_script: after_script:
- script/rebund upload - script/rebund upload
@ -24,5 +23,5 @@ notifications:
on_failure: never on_failure: never
env: env:
global: global:
- secure: YFgVNymO2MvA7ieB3hJKQ9cF8zhi5uc3NnBx+ngs6+XF7lV7zYZGMYJ9ufEuPRkXFEI1sSNQJjOQwjmqC71xABrWw6B69XDdYgoTX+53GryVfsrDIPksQo89WAAMKqoPznWtj5fA3OTxUWjHVye2JsduPNuihpniI5j79IzDFQY= - secure: bt5nglPTdsc0N5fB1dOJz2WbM81dGpDuVD8PnhEsxgUfoo6xavhU4+pNrUADlSUqQ1aJrdU+MKW4x+JZ2ZnJS8vOpNzRymuMZSbFaljK4pgFGiKFgBdMKxVikvoYcxKCjLAl7NJZ11W6hUw+JtJScClDZwrJJAQB6I7Isp/LsdM=
- secure: YrDB4baCV00FPyRafR9UTAUsSgK/07Re+7T+blgX2gK/j54DJdof+EYbQPjc3HeWdfQgIzal2+KkwBItEu2lA8/j6qPwUngd9oRWJPLm19xFizECRY9SD1BxU53T3qmnoYqG0jFvKgYfnn9ggHRDEL31YDOA1monhFhq/8S3SdA= - secure: Ym8nx7nbfGYGo47my92M+deJykaiMkdZdb615EO51liv/xy/0aQ919Jpfieugc9d3zVnm+zFGPbpv4YzRpsik6OlVBNa4lP+BnQ27ptf5YcLWD8Hksi7845WFLecXMoaTCoYer/TvYZsIWJb2nSDMH9qbfZhnd1YZKuvUpK0rEU=

View File

@ -12,6 +12,7 @@
* Provide a 300% improvement when generating sites that use * Provide a 300% improvement when generating sites that use
`Post#next` or `Post#previous` (#1983) `Post#next` or `Post#previous` (#1983)
* Provide support for CoffeeScript (#1991) * Provide support for CoffeeScript (#1991)
* Replace Maruku with Kramdown as Default Markdown Processor (#1988)
### Minor Enhancements ### Minor Enhancements
* Move the EntryFilter class into the Jekyll module to avoid polluting the * Move the EntryFilter class into the Jekyll module to avoid polluting the
@ -34,6 +35,11 @@
* Excludes are now relative to the site source (#1916) * Excludes are now relative to the site source (#1916)
* Bring MIME Types file for `jekyll serve` to complete parity with GH Pages * Bring MIME Types file for `jekyll serve` to complete parity with GH Pages
servers (#1993) 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)
### Bug Fixes ### Bug Fixes
* Don't allow nil entries when loading posts (#1796) * Don't allow nil entries when loading posts (#1796)
@ -48,6 +54,9 @@
* Fixes full path leak to source directory when using include tag (#1951) * Fixes full path leak to source directory when using include tag (#1951)
* Don't generate pages that aren't being published (#1931) * Don't generate pages that aren't being published (#1931)
* Use `SafeYAML.load` to avoid conflicts with other projects (#1982) * 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)
### Development Fixes ### Development Fixes
* Add a link to the site in the README.md file (#1795) * Add a link to the site in the README.md file (#1795)
@ -66,6 +75,9 @@
* Speed up Travis CI builds by using Rebund (#1985) * Speed up Travis CI builds by using Rebund (#1985)
* Use Yarp as a Gem proxy for Travis CI (#1984) * Use Yarp as a Gem proxy for Travis CI (#1984)
* Remove Yarp as a Gem proxy for Travis CI (#2004) * 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)
### Site Enhancements ### Site Enhancements
* Document Kramdown's GFM parser option (#1791) * Document Kramdown's GFM parser option (#1791)
@ -100,6 +112,9 @@
* Add `sublime-jekyll` to list of Editor plugins (#2001) * Add `sublime-jekyll` to list of Editor plugins (#2001)
* Add `vim-jekyll` to the list of Editor plugins (#2005) * Add `vim-jekyll` to the list of Editor plugins (#2005)
* Fix non-semantic nesting of `p` tags in `news_item` layout (#2013) * 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)
## 1.4.3 / 2014-01-13 ## 1.4.3 / 2014-01-13

View File

@ -38,16 +38,16 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs
* Colorator: Colorizes command line output (Ruby) * Colorator: Colorizes command line output (Ruby)
* Classifier: Generating related posts (Ruby) * Classifier: Generating related posts (Ruby)
* Directory Watcher: Auto-regeneration of sites (Ruby) * Directory Watcher: Auto-regeneration of sites (Ruby)
* Kramdown: Default Markdown engine (Ruby)
* Liquid: Templating system (Ruby) * Liquid: Templating system (Ruby)
* Maruku: Default markdown engine (Ruby)
* Pygments.rb: Syntax highlighting (Ruby/Python) * Pygments.rb: Syntax highlighting (Ruby/Python)
* RedCarpet: Markdown engine (Ruby) * RedCarpet: Markdown engine (Ruby)
* Safe YAML: YAML Parser built for security (Ruby) * Safe YAML: YAML Parser built for security (Ruby)
## Developer Dependencies ## Developer Dependencies
* Kramdown: Markdown-superset converter (Ruby)
* Launchy: Cross-platform file launcher (Ruby) * Launchy: Cross-platform file launcher (Ruby)
* Maruku: Markdown-superset interpreter (Ruby)
* RDiscount: Discount Markdown Processor (Ruby) * RDiscount: Discount Markdown Processor (Ruby)
* RedCloth: Textile support (Ruby) * RedCloth: Textile support (Ruby)
* RedGreen: Nicer test output (Ruby) * RedGreen: Nicer test output (Ruby)

View File

@ -23,3 +23,13 @@ Feature: Draft Posts
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
And the "_site/recipe.html" file should not 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 with drafts
Then the _site directory should exist
And I should see "Post path: _drafts/recipe.textile" in "_site/recipe.html"

View File

@ -13,8 +13,8 @@ Feature: Markdown
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
And I should see "Index" in "_site/index.html" And I should see "Index" in "_site/index.html"
And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/2009/03/27/hackers.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/2009/03/27/hackers.html"
And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/index.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html"
Scenario: Markdown in pagination on index Scenario: Markdown in pagination on index
Given I have a configuration file with "paginate" set to "5" Given I have a configuration file with "paginate" set to "5"
@ -26,7 +26,7 @@ Feature: Markdown
When I run jekyll When I run jekyll
Then the _site directory should exist Then the _site directory should exist
And I should see "Index" in "_site/index.html" And I should see "Index" in "_site/index.html"
And I should see "<h1 id=\"my_title\">My Title</h1>" in "_site/index.html" And I should see "<h1 id=\"my-title\">My Title</h1>" in "_site/index.html"
Scenario: Maruku fenced codeblocks Scenario: Maruku fenced codeblocks
Given I have a configuration file with "markdown" set to "maruku" Given I have a configuration file with "markdown" set to "maruku"

View File

@ -2,12 +2,12 @@ Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version= 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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.rubygems_version = '1.3.5' s.rubygems_version = '1.3.5'
s.required_ruby_version = '>= 1.9.2' s.required_ruby_version = '>= 1.9.3'
s.name = 'jekyll' s.name = 'jekyll'
s.version = '1.4.3' s.version = '2.0.0.alpha.1'
s.license = 'MIT' s.license = 'MIT'
s.date = '2014-01-13' s.date = '2014-02-13'
s.rubyforge_project = 'jekyll' s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator." s.summary = "A simple, blog aware, static site generator."
@ -32,7 +32,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('mercenary', "~> 0.2.0") s.add_runtime_dependency('mercenary', "~> 0.2.0")
s.add_runtime_dependency('safe_yaml', "~> 1.0") s.add_runtime_dependency('safe_yaml', "~> 1.0")
s.add_runtime_dependency('colorator', "~> 0.1") s.add_runtime_dependency('colorator', "~> 0.1")
s.add_runtime_dependency('redcarpet', "~> 3.0") s.add_runtime_dependency('redcarpet', "~> 3.1")
s.add_runtime_dependency('toml', '~> 0.1.0') s.add_runtime_dependency('toml', '~> 0.1.0')
s.add_runtime_dependency('sass', '~> 3.2') s.add_runtime_dependency('sass', '~> 3.2')
s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0') s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0')
@ -109,6 +109,7 @@ Gem::Specification.new do |s|
lib/jekyll/generator.rb lib/jekyll/generator.rb
lib/jekyll/generators/pagination.rb lib/jekyll/generators/pagination.rb
lib/jekyll/layout.rb lib/jekyll/layout.rb
lib/jekyll/layout_reader.rb
lib/jekyll/mime.types lib/jekyll/mime.types
lib/jekyll/page.rb lib/jekyll/page.rb
lib/jekyll/plugin.rb lib/jekyll/plugin.rb
@ -232,6 +233,7 @@ Gem::Specification.new do |s|
test/source/_config.dev.toml test/source/_config.dev.toml
test/source/_data/languages.yml test/source/_data/languages.yml
test/source/_data/members.yaml test/source/_data/members.yaml
test/source/_data/products.yml
test/source/_includes/include.html test/source/_includes/include.html
test/source/_includes/params.html test/source/_includes/params.html
test/source/_includes/sig.markdown test/source/_includes/sig.markdown
@ -275,11 +277,13 @@ Gem::Specification.new do |s|
test/source/_posts/2013-12-17-include-variable-filters.markdown test/source/_posts/2013-12-17-include-variable-filters.markdown
test/source/_posts/2013-12-20-properties.text test/source/_posts/2013-12-20-properties.text
test/source/_posts/es/2008-11-21-nested.textile test/source/_posts/es/2008-11-21-nested.textile
test/source/_sass/_grid.scss
test/source/about.html test/source/about.html
test/source/category/_posts/2008-9-23-categories.textile test/source/category/_posts/2008-9-23-categories.textile
test/source/contacts.html test/source/contacts.html
test/source/contacts/bar.html test/source/contacts/bar.html
test/source/contacts/index.html test/source/contacts/index.html
test/source/css/main.scss
test/source/css/screen.css test/source/css/screen.css
test/source/deal.with.dots.html test/source/deal.with.dots.html
test/source/foo/_posts/bar/2008-12-12-topical-post.textile test/source/foo/_posts/bar/2008-12-12-topical-post.textile
@ -288,6 +292,9 @@ Gem::Specification.new do |s|
test/source/products.yml test/source/products.yml
test/source/properties.html test/source/properties.html
test/source/sitemap.xml 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/unpublished.html
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
test/source/z_category/_posts/2008-9-23-categories.textile test/source/z_category/_posts/2008-9-23-categories.textile
@ -302,6 +309,7 @@ Gem::Specification.new do |s|
test/test_filters.rb test/test_filters.rb
test/test_generated_site.rb test/test_generated_site.rb
test/test_kramdown.rb test/test_kramdown.rb
test/test_layout_reader.rb
test/test_new_command.rb test/test_new_command.rb
test/test_page.rb test/test_page.rb
test/test_pager.rb test/test_pager.rb

View File

@ -48,6 +48,7 @@ require 'jekyll/errors'
require 'jekyll/related_posts' require 'jekyll/related_posts'
require 'jekyll/cleaner' require 'jekyll/cleaner'
require 'jekyll/entry_filter' require 'jekyll/entry_filter'
require 'jekyll/layout_reader'
# extensions # extensions
require 'jekyll/plugin' require 'jekyll/plugin'
@ -67,7 +68,7 @@ require 'jekyll-coffeescript'
SafeYAML::OPTIONS[:suppress_warnings] = true SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll module Jekyll
VERSION = '1.4.0' VERSION = '2.0.0.alpha.1'
# Public: Generate a Jekyll configuration Hash by merging the default # Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top. # options with anything in _config.yml, and adding the given options on top.

View File

@ -16,7 +16,7 @@ module Jekyll
'timezone' => nil, # use the local timezone 'timezone' => nil, # use the local timezone
'encoding' => nil, # use the system encoding 'encoding' => 'utf-8', # always use utf-8 encoding. NEVER FORGET
'safe' => false, 'safe' => false,
'detach' => false, # default to not detaching the server 'detach' => false, # default to not detaching the server
@ -28,7 +28,7 @@ module Jekyll
'relative_permalinks' => true, # backwards-compatibility with < 1.0 'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 2.0 hits # will be set to false once 2.0 hits
'markdown' => 'maruku', 'markdown' => 'kramdown',
'highlighter' => 'pygments', 'highlighter' => 'pygments',
'permalink' => 'date', 'permalink' => 'date',
'baseurl' => '/', 'baseurl' => '/',
@ -36,7 +36,7 @@ module Jekyll
'exclude' => [], 'exclude' => [],
'paginate_path' => '/page:num', 'paginate_path' => '/page:num',
'markdown_ext' => 'markdown,mkd,mkdn,md', 'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md',
'textile_ext' => 'textile', 'textile_ext' => 'textile',
'port' => '4000', 'port' => '4000',
@ -229,6 +229,12 @@ module Jekyll
config[option] = csv_to_array(config[option]) config[option] = csv_to_array(config[option])
end end
end end
if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
Jekyll::Deprecator.deprecation_message "You're using the 'maruku' " +
"Markdown processor. Maruku support has been deprecated and will " +
"be removed in 3.0.0. We recommend you switch to Kramdown."
end
config config
end end

View File

@ -18,6 +18,11 @@ module Jekyll
File.join(source, dir, '_drafts') File.join(source, dir, '_drafts')
end end
# The path to the draft source file, relative to the site source
def relative_path
File.join(@dir, '_drafts', @name)
end
# Extract information from the post filename. # Extract information from the post filename.
# #
# name - The String filename of the post file. # name - The String filename of the post file.

View File

@ -0,0 +1,40 @@
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
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.exists?(directory)
Dir.chdir(directory) { yield }
end
def layout_directory
File.join(site.source, site.config['layouts'])
end
end
end

View File

@ -126,7 +126,7 @@ module Jekyll
# The path to the page source file, relative to the site source # The path to the page source file, relative to the site source
def relative_path def relative_path
File.join(@dir, @name) File.join(*[@dir, @name].map(&:to_s).reject(&:empty?))
end end
# Obtain destination path. # Obtain destination path.

View File

@ -123,7 +123,7 @@ module Jekyll
# The path to the post source file, relative to the site source # The path to the post source file, relative to the site source
def relative_path def relative_path
File.join(@dir, '_posts', @name) File.join(*[@dir, "_posts", @name].map(&:to_s).reject(&:empty?))
end end
# Compares Post objects. First compares the Post date. If the dates are # Compares Post objects. First compares the Post date. If the dates are

View File

@ -127,27 +127,11 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def read def read
self.read_layouts self.layouts = LayoutReader.new(self).read
self.read_directories self.read_directories
self.read_data(config['data_source']) self.read_data(config['data_source'])
end end
# Read all the files in <source>/<layouts> and create a new Layout object
# with each one.
#
# Returns nothing.
def read_layouts
base = File.join(self.source, self.config['layouts'])
return unless File.exists?(base)
entries = []
Dir.chdir(base) { entries = filter_entries(Dir['**/*.*'], base) }
entries.each do |f|
name = f.split(".")[0..-2].join(".")
self.layouts[name] = Layout.new(self, base, f)
end
end
# Recursively traverse directories to find posts, pages and static files # Recursively traverse directories to find posts, pages and static files
# that will become part of the site according to the rules in # that will become part of the site according to the rules in
# filter_entries. # filter_entries.

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

@ -64,6 +64,12 @@ a:visited { color: #a0a; }
line-height: 1.5em; line-height: 1.5em;
} }
@media screen and (max-width: 44em) {
.site {
width: 90%;
}
}
.header a { .header a {
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;

View File

@ -300,7 +300,7 @@ permalink: date
paginate_path: 'page:num' paginate_path: 'page:num'
paginate: nil paginate: nil
markdown: maruku markdown: kramdown
markdown_ext: markdown,mkd,mkdn,md markdown_ext: markdown,mkd,mkdn,md
textile_ext: textile textile_ext: textile

View File

@ -86,7 +86,7 @@ this script from within Textmate.
## Rack-Jekyll ## Rack-Jekyll
[Rack-Jekyll](http://github.com/bry4n/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](http://github.com/rtomakyo/shotgun/), [rackup](http://github.com/rack/rack), [mongrel](http://github.com/mongrel/mongrel), [unicorn](http://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme). [Rack-Jekyll](http://github.com/adaoraul/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](http://github.com/rtomakyo/shotgun/), [rackup](http://github.com/rack/rack), [mongrel](http://github.com/mongrel/mongrel), [unicorn](http://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme).
Read [this post](http://blog.crowdint.com/2010/08/02/instant-blog-using-jekyll-and-heroku.html) on how to deploy to Heroku using Rack-Jekyll. Read [this post](http://blog.crowdint.com/2010/08/02/instant-blog-using-jekyll-and-heroku.html) on how to deploy to Heroku using Rack-Jekyll.

View File

@ -28,10 +28,13 @@ sudo yum install ruby-devel
{% endhighlight %} {% endhighlight %}
On [NearlyFreeSpeech](http://nearlyfreespeech.net/) you need to run the On [NearlyFreeSpeech](http://nearlyfreespeech.net/) you need to run the
command with the following environment variable: following commands before installing Jekyll:
{% highlight bash %} {% highlight bash %}
RB_USER_INSTALL=true gem install jekyll export GEM_HOME=/home/private/gems
export GEM_PATH=/home/private/gems:/usr/local/lib/ruby/gems/1.8/
export PATH=$PATH:/home/private/gems/bin
export RB_USER_INSTALL='true'
{% endhighlight %} {% endhighlight %}
On OSX, you may need to update RubyGems: On OSX, you may need to update RubyGems:

View File

@ -24,6 +24,17 @@ $ jekyll build --watch
# watched for changes, and regenerated automatically. # watched for changes, and regenerated automatically.
{% endhighlight %} {% endhighlight %}
<div class="note warning">
<h5>Destination folders are cleaned on site builds</h5>
<p>
The contents of <code>&lt;destination&gt;</code> are automatically
cleaned when the site is built. Files or folders that are not
created by your site will be removed. Do not use an important
location for <code>&lt;destination&gt;</code>; instead, use it as
a staging area and copy files from there to your web server.
</p>
</div>
Jekyll also comes with a built-in development server that will allow you to Jekyll also comes with a built-in development server that will allow you to
preview what the generated site will look like in your browser locally. preview what the generated site will look like in your browser locally.

0
site/js/modernizr-2.5.3.min.js vendored Executable file → Normal file
View File

View File

@ -0,0 +1,11 @@
---
categories: foo bar baz
foo: bar
layout: default
tags: ay bee cee
title: Properties Draft
---
All the properties.
Plus an excerpt.

View File

@ -1,3 +1,3 @@
-- ---
Tom Preston-Werner Tom Preston-Werner
github.com/mojombo github.com/mojombo

View File

@ -0,0 +1 @@
.half { width: 50%; }

View File

@ -0,0 +1,4 @@
---
---
@import "grid";

View File

@ -4,14 +4,14 @@ class TestConfiguration < Test::Unit::TestCase
context "#stringify_keys" do context "#stringify_keys" do
setup do setup do
@mixed_keys = Configuration[{ @mixed_keys = Configuration[{
'markdown' => 'maruku', 'markdown' => 'kramdown',
:permalink => 'date', :permalink => 'date',
'baseurl' => '/', 'baseurl' => '/',
:include => ['.htaccess'], :include => ['.htaccess'],
:source => './' :source => './'
}] }]
@string_keys = Configuration[{ @string_keys = Configuration[{
'markdown' => 'maruku', 'markdown' => 'kramdown',
'permalink' => 'date', 'permalink' => 'date',
'baseurl' => '/', 'baseurl' => '/',
'include' => ['.htaccess'], 'include' => ['.htaccess'],

56
test/test_draft.rb Normal file
View File

@ -0,0 +1,56 @@
require 'helper'
class TestDraft < Test::Unit::TestCase
def setup_draft(file)
Draft.new(@site, source_dir, '', file)
end
context "A Draft" do
setup do
clear_dest
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
@site = Site.new(Jekyll.configuration)
end
should "ensure valid drafts are valid" do
assert Draft.valid?("2008-09-09-foo-bar.textile")
assert Draft.valid?("foo/bar/2008-09-09-foo-bar.textile")
assert Draft.valid?("lol2008-09-09-foo-bar.textile")
assert !Draft.valid?("blah")
end
should "make properties accessible through #[]" do
draft = setup_draft('draft-properties.text')
# ! need to touch the file! Or get its timestamp
date = File.mtime(File.join(source_dir, '_drafts', 'draft-properties.text'))
ymd = date.strftime("%Y/%m/%d")
attrs = {
categories: %w(foo bar baz),
content: "All the properties.\n\nPlus an excerpt.\n",
date: date,
dir: "/foo/bar/baz/#{ymd}",
excerpt: "All the properties.\n\n",
foo: 'bar',
id: "/foo/bar/baz/#{ymd}/draft-properties",
layout: 'default',
name: nil,
path: "_drafts/draft-properties.text",
permalink: nil,
published: nil,
tags: %w(ay bee cee),
title: 'Properties Draft',
url: "/foo/bar/baz/#{ymd}/draft-properties.html"
}
attrs.each do |attr, val|
attr_str = attr.to_s
result = draft[attr_str]
assert_equal val, result, "For <draft[\"#{attr_str}\"]>:"
end
end
end
end

View File

@ -108,7 +108,7 @@ class TestExcerpt < Test::Unit::TestCase
end end
should "be the first paragraph of the page" do should "be the first paragraph of the page" do
assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>", @extracted_excerpt.content assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n", @extracted_excerpt.content
end end
should "link properly" do should "link properly" do

View File

@ -28,7 +28,7 @@ class TestFilters < Test::Unit::TestCase
end end
should "markdownify with simple string" do should "markdownify with simple string" do
assert_equal "<p>something <strong>really</strong> simple</p>", @filter.markdownify("something **really** simple") assert_equal "<p>something <strong>really</strong> simple</p>\n", @filter.markdownify("something **really** simple")
end end
should "convert array to sentence string with no args" do should "convert array to sentence string with no args" do
@ -131,7 +131,7 @@ class TestFilters < Test::Unit::TestCase
assert_equal 2, g["items"].size assert_equal 2, g["items"].size
when "" when ""
assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array." assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
assert_equal 7, g["items"].size assert_equal 9, g["items"].size
end end
end end
end end

View File

@ -0,0 +1,17 @@
require 'helper'
class TestLayoutReader < Test::Unit::TestCase
context "reading layouts" do
setup do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
end
@site = Site.new(Jekyll.configuration)
end
should "read layouts" do
layouts = LayoutReader.new(@site).read
assert_equal ["default", "simple", "post/simple"].sort, layouts.keys.sort
end
end
end

View File

@ -38,7 +38,7 @@ class TestPost < Test::Unit::TestCase
id: "/foo/bar/baz/2013/12/20/properties", id: "/foo/bar/baz/2013/12/20/properties",
layout: 'default', layout: 'default',
name: nil, name: nil,
# path: "properties.html", path: "_posts/2013-12-20-properties.text",
permalink: nil, permalink: nil,
published: nil, published: nil,
tags: %w(ay bee cee), tags: %w(ay bee cee),
@ -323,7 +323,7 @@ class TestPost < Test::Unit::TestCase
end end
should "return rendered HTML" do should "return rendered HTML" do
assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>", assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n",
@post.excerpt @post.excerpt
end end
@ -543,7 +543,7 @@ class TestPost < Test::Unit::TestCase
post.site.source = File.join(File.dirname(__FILE__), 'source') post.site.source = File.join(File.dirname(__FILE__), 'source')
do_render(post) do_render(post)
assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", post.output assert_equal "<<< <hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n\n<p>This <em>is</em> cool</p>\n >>>", post.output
end end
should "render date specified in front matter properly" do should "render date specified in front matter properly" do

View File

@ -104,4 +104,19 @@ CSS
assert_equal css_output, converter.convert(scss_content) assert_equal css_output, converter.convert(scss_content)
end end
end end
context "importing partials" do
setup do
@site = Jekyll::Site.new(Jekyll.configuration({
"source" => source_dir,
"destination" => dest_dir
}))
@site.process
@test_css_file = dest_dir("css/main.css")
end
should "import SCSS partial" do
assert_equal ".half {\n width: 50%; }\n", File.read(@test_css_file)
end
end
end end

View File

@ -157,15 +157,11 @@ class TestSite < Test::Unit::TestCase
should "sort pages alphabetically" do should "sort pages alphabetically" do
stub.proxy(Dir).entries { |entries| entries.reverse } stub.proxy(Dir).entries { |entries| entries.reverse }
@site.process @site.process
sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html properties.html sitemap.xml symlinked-file) # files in symlinked directories may appear twice
sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html main.scss main.scss properties.html sitemap.xml symlinked-file)
assert_equal sorted_pages, @site.pages.map(&:name) assert_equal sorted_pages, @site.pages.map(&:name)
end end
should "read layouts" do
@site.read_layouts
assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort
end
should "read posts" do should "read posts" do
@site.read_posts('') @site.read_posts('')
posts = Dir[source_dir('_posts', '**', '*')] posts = Dir[source_dir('_posts', '**', '*')]

View File

@ -54,7 +54,7 @@ CONTENT
end end
context "initialized tag" do context "initialized tag" do
should "work" do should "set the correct options" do
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"]) tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
assert_equal({}, tag.instance_variable_get(:@options)) assert_equal({}, tag.instance_variable_get(:@options))
@ -85,11 +85,11 @@ CONTENT
end end
should "render markdown with pygments" do should "render markdown with pygments" do
assert_match %{<pre><code class='text'>test\n</code></pre>}, @result assert_match %{<pre><code class="text">test\n</code></pre>}, @result
end end
should "render markdown with pygments with line numbers" do should "render markdown with pygments with line numbers" do
assert_match %{<pre><code class='text'><span class='lineno'>1</span> test\n</code></pre>}, @result assert_match %{<pre><code class="text"><span class="lineno">1</span> test\n</code></pre>}, @result
end end
end end
@ -99,7 +99,7 @@ CONTENT
end end
should "not embed the file" do should "not embed the file" do
assert_match %{<pre><code class='text'>./jekyll.gemspec\n</code></pre>}, @result assert_match %{<pre><code class="text">./jekyll.gemspec\n</code></pre>}, @result
end end
end end
@ -109,7 +109,7 @@ CONTENT
end end
should "render markdown with pygments line handling" do should "render markdown with pygments line handling" do
assert_match %{<pre><code class='text'\n</code></pre>}, @result assert_match %{<pre><code class="text"\n</code></pre>}, @result
end end
end end
@ -268,7 +268,7 @@ CONTENT
end end
should "write script tag" do should "write script tag" do
assert_match "<script src='https://gist.github.com/#{@gist}.js'><![CDATA[\s]]></script>", @result assert_match "<script src=\"https://gist.github.com/#{@gist}.js\">\s</script>", @result
end end
end end
@ -288,7 +288,7 @@ CONTENT
end end
should "write script tag with specific file in gist" do should "write script tag with specific file in gist" do
assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'><![CDATA[\s]]></script>", @result assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
end end
end end
@ -324,7 +324,7 @@ CONTENT
end end
should "write script tag with specific file in gist" do should "write script tag with specific file in gist" do
assert_match "<script src='https://gist.github.com/#{@gist}.js?file=#{@filename}'><![CDATA[\s]]></script>", @result assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
end end
end end
@ -413,11 +413,11 @@ CONTENT
end end
should "correctly output include variable" do should "correctly output include variable" do
assert_match "<span id='include-param'>value</span>", @result.strip assert_match "<span id=\"include-param\">value</span>", @result.strip
end end
should "ignore parameters if unused" do should "ignore parameters if unused" do
assert_match "<hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n", @result assert_match "<hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n", @result
end end
end end
@ -465,7 +465,7 @@ CONTENT
end end
should "not include previously used parameters" do should "not include previously used parameters" do
assert_match "<span id='include-param' />", @result assert_match "<span id=\"include-param\"></span>", @result
end end
end end
@ -482,7 +482,7 @@ CONTENT
end end
should "include file with empty parameters" do should "include file with empty parameters" do
assert_match "<span id='include-param' />", @result assert_match "<span id=\"include-param\"></span>", @result
end end
end end
@ -499,7 +499,7 @@ CONTENT
end end
should "include file with empty parameters within if statement" do should "include file with empty parameters within if statement" do
assert_match "<span id='include-param' />", @result assert_match "<span id=\"include-param\"></span>", @result
end end
end end
@ -512,6 +512,7 @@ puts "Hello world"
``` ```
CONTENT CONTENT
create_post(content, { create_post(content, {
'markdown' => 'maruku',
'maruku' => {'fenced_code_blocks' => true}} 'maruku' => {'fenced_code_blocks' => true}}
) )
end end