From e09f058a061ff1736e8d8ca9d14055cef8e5f2e3 Mon Sep 17 00:00:00 2001 From: Seth Ladd Date: Tue, 20 Sep 2011 13:03:31 -0700 Subject: [PATCH 001/184] add page variable to liquid custom tags and blocks. thx to mike west for the patch --- lib/jekyll/convertible.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index d33abc56..a674ef53 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -69,7 +69,7 @@ module Jekyll # # Returns nothing. def do_layout(payload, layouts) - info = { :filters => [Jekyll::Filters], :registers => { :site => self.site } } + info = { :filters => [Jekyll::Filters], :registers => { :site => self.site, :page => payload['page'] } } # render and transform content (this becomes the final content of the object) payload["pygments_prefix"] = converter.pygments_prefix From 6f6ad001d2dcbda7f6acb1dd66e553be12bf585a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 19 Mar 2013 21:59:06 +0100 Subject: [PATCH 002/184] Ignore entries if they are directories. --- lib/jekyll/site.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index b4b40442..b3876722 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -405,6 +405,7 @@ module Jekyll base = File.join(self.source, dir, subfolder) return [] unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } + entries.delete_if { |e| File.directory?(File.join(base, e)) } end # Aggregate post information From 8f890cb064675321d506229c104d332aa4856ca6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 19 Mar 2013 21:59:43 +0100 Subject: [PATCH 003/184] Fix tests that fail due to having a directory that looks like a post --- test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep | 0 test/test_site.rb | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep diff --git a/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep b/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/test/test_site.rb b/test/test_site.rb index 6934596f..558cd779 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -161,6 +161,7 @@ class TestSite < Test::Unit::TestCase should "read posts" do @site.read_posts('') posts = Dir[source_dir('_posts', '*')] + posts.delete_if { |post| File.directory?(post) } assert_equal posts.size - 1, @site.posts.size end @@ -169,9 +170,10 @@ class TestSite < Test::Unit::TestCase @site.process posts = Dir[source_dir("**", "_posts", "*")] + posts.delete_if { |post| File.directory?(post) } categories = %w(bar baz category foo z_category publish_test win).sort - assert_equal posts.size - 1, @site.posts.size + assert_equal posts.size, @site.posts.size assert_equal categories, @site.categories.keys.sort assert_equal 4, @site.categories['foo'].size end From 6657f2add9477daf035876b6b7d825ecd6ce5f93 Mon Sep 17 00:00:00 2001 From: zachgersh Date: Tue, 26 Mar 2013 23:04:42 -0700 Subject: [PATCH 004/184] Added abbreviated month + test. --- lib/jekyll/post.rb | 1 + test/test_post.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 62c36d42..a124a8a8 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -169,6 +169,7 @@ module Jekyll "i_day" => date.strftime("%d").to_i.to_s, "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), + "abrv_month" => date.strftime("%b"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 5bff6e5e..63f68306 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -225,6 +225,17 @@ class TestPost < Test::Unit::TestCase end end + context "with custom abbreviated month date permalink" do + setup do + @post.site.permalink_style = '/:categories/:year/:abrv_month/:day/:title/' + @post.process(@fake_file) + end + + should "process the url correctly" do + assert_equal "/2008/Sep/09/foo-bar/", @post.url + end + end + context "with prefix style and no extension" do setup do @post.site.permalink_style = "/prefix/:title" From 186b68adb006c9a702abaa1f2a9af6fa0b7ead84 Mon Sep 17 00:00:00 2001 From: Rafael Rosa Fu Date: Wed, 27 Mar 2013 02:19:56 -0400 Subject: [PATCH 005/184] Added filter date_to_rfc822 According to the W3C RSS Feed Validator, feeds must format dates as described on RFC-822 to be valid. Refer to their site to get more info: http://feedvalidator.org/docs/error/InvalidRFC2822Date.html I also added a couple of missing unit tests to the other date filters --- lib/jekyll/filters.rb | 14 ++++++++++++++ test/test_filters.rb | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 0384f19c..37d4f1cb 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -56,6 +56,20 @@ module Jekyll 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) + date.rfc822 + end + # XML escape a string for use. Replaces any special characters with # appropriate HTML entity replacements. # diff --git a/test/test_filters.rb b/test/test_filters.rb index 205d4bca..24551bb3 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -13,6 +13,7 @@ class TestFilters < Test::Unit::TestCase context "filters" do setup do @filter = JekyllFilter.new + @sample_time = Time.parse "2013-03-27T11:22:33+00:00" end should "textilize with simple string" do @@ -42,6 +43,22 @@ class TestFilters < Test::Unit::TestCase assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"]) end + should "format a date with short format" do + assert_equal "27 Mar 2013", @filter.date_to_string(@sample_time) + end + + should "format a date with long format" do + assert_equal "27 March 2013", @filter.date_to_long_string(@sample_time) + end + + should "format a time with xmlschema" do + assert_equal "2013-03-27T11:22:33+00:00", @filter.date_to_xmlschema(@sample_time) + end + + should "format a time according to RFC-822" do + assert_equal "Wed, 27 Mar 2013 11:22:33 +0000", @filter.date_to_rfc822(@sample_time) + end + should "escape xml with ampersands" do assert_equal "AT&T", @filter.xml_escape("AT&T") assert_equal "<code>command &lt;filename&gt;</code>", @filter.xml_escape("command <filename>") From e931414b77078e7601c13f59342966c9247ec470 Mon Sep 17 00:00:00 2001 From: zachgersh Date: Wed, 27 Mar 2013 08:40:58 -0700 Subject: [PATCH 006/184] Changed to short_month and re-ran tests. --- lib/jekyll/post.rb | 2 +- test/test_post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index a124a8a8..42350643 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -169,7 +169,7 @@ module Jekyll "i_day" => date.strftime("%d").to_i.to_s, "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), - "abrv_month" => date.strftime("%b"), + "short_month" => date.strftime("%b"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 63f68306..8a9721e4 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -227,7 +227,7 @@ class TestPost < Test::Unit::TestCase context "with custom abbreviated month date permalink" do setup do - @post.site.permalink_style = '/:categories/:year/:abrv_month/:day/:title/' + @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/' @post.process(@fake_file) end From 7879d2e02c3fd851f7a4de37b4279246617eb173 Mon Sep 17 00:00:00 2001 From: Rafael Rosa Fu Date: Fri, 29 Mar 2013 01:07:47 -0400 Subject: [PATCH 007/184] Fixed expected output from xmlschema and rfc822 --- test/test_filters.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_filters.rb b/test/test_filters.rb index 24551bb3..41bd242c 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -13,7 +13,7 @@ class TestFilters < Test::Unit::TestCase context "filters" do setup do @filter = JekyllFilter.new - @sample_time = Time.parse "2013-03-27T11:22:33+00:00" + @sample_time = Time.utc(2013, 03, 27, 11, 22, 33) end should "textilize with simple string" do @@ -52,11 +52,11 @@ class TestFilters < Test::Unit::TestCase end should "format a time with xmlschema" do - assert_equal "2013-03-27T11:22:33+00:00", @filter.date_to_xmlschema(@sample_time) + assert_equal "2013-03-27T11:22:33Z", @filter.date_to_xmlschema(@sample_time) end should "format a time according to RFC-822" do - assert_equal "Wed, 27 Mar 2013 11:22:33 +0000", @filter.date_to_rfc822(@sample_time) + assert_equal "Wed, 27 Mar 2013 11:22:33 -0000", @filter.date_to_rfc822(@sample_time) end should "escape xml with ampersands" do From 8d1b6720c3e368f5dd3f1fd7280fd9d8a0648b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sellstr=C3=B6m?= Date: Sun, 31 Mar 2013 18:22:41 +0300 Subject: [PATCH 008/184] Added pkpass to the list --- lib/jekyll/mime.types | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jekyll/mime.types b/lib/jekyll/mime.types index fe827bb8..b926a009 100644 --- a/lib/jekyll/mime.types +++ b/lib/jekyll/mime.types @@ -35,6 +35,7 @@ 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 From 17bb13a686306dd0e95428d89311e45342532db0 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Wed, 3 Apr 2013 10:21:23 -0600 Subject: [PATCH 009/184] Clean up site docs to prepare for 1.0 release. --- CONTRIBUTING.md | 5 +- site/_posts/2012-07-01-configuration.md | 137 ++++++++++----------- site/_posts/2012-07-01-contributing.md | 93 ++++++++------ site/_posts/2012-07-01-extras.md | 74 ++++++----- site/_posts/2012-07-01-frontmatter.md | 76 +++++++++--- site/_posts/2012-07-01-github-pages.md | 47 +++++-- site/_posts/2012-07-01-home.md | 41 +++++-- site/_posts/2012-07-01-installation.md | 39 ++++-- site/_posts/2012-07-01-migrations.md | 40 ++++-- site/_posts/2012-07-01-pages.md | 75 ++++++++---- site/_posts/2012-07-01-pagination.md | 107 +++++++++------- site/_posts/2012-07-01-permalinks.md | 72 ++++++----- site/_posts/2012-07-01-plugins.md | 144 ++++++++++++++-------- site/_posts/2012-07-01-posts.md | 99 +++++++++++---- site/_posts/2012-07-01-structure.md | 73 +++++++++-- site/_posts/2012-07-01-templates.md | 107 +++++++++------- site/_posts/2012-07-01-usage.md | 53 +++++--- site/_posts/2012-07-01-variables.md | 156 ++++++++++++++++++++---- site/css/style.css | 2 +- 19 files changed, 984 insertions(+), 456 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5245c868..b3c3e07d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,9 +15,10 @@ following in mind: would be appreciated, and once merged it will be transferred over to the main wiki. * If your contribution changes any Jekyll behavior, make sure to update the - documentation. It lives in site/_posts. If the docs are missing information, + documentation. It lives in `site/_posts`. 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 follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby) + when modifying Ruby code. Test Dependencies ----------------- diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index 7fcb34fe..3248aecf 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -5,46 +5,54 @@ prev_section: structure next_section: frontmatter --- -Jekyll allows you to concoct your sites in any way you can dream up, and it’s thanks to the powerful and flexible configuration options that this is possible. These options can either be specified in a `_config.yml` file placed in your site’s root directory, or can be specified as flags for the `jekyll` executable in the terminal. +Jekyll allows you to concoct your sites in any way you can dream up, and it’s +thanks to the powerful and flexible configuration options that this is possible. +These options can either be specified in a `_config.yml` file placed in your +site’s root directory, or can be specified as flags for the `jekyll` executable +in the terminal. ## Configuration Settings ### Global Configuration -The table below lists the available settings for Jekyll, and the various options (specifed in the configuration file) and flags (specified on the command-line) that control them. +The table below lists the available settings for Jekyll, and the various options (specifed in the configuration file) and flags (specified on the command-line) that control them. - + - - - - - - - - - - - - @@ -46,7 +64,13 @@ There are a number of predefined global variables that you can set in the front-

permalink

@@ -54,7 +78,10 @@ There are a number of predefined global variables that you can set in the front-

published

@@ -63,7 +90,16 @@ There are a number of predefined global variables that you can set in the front-

categories

@@ -71,7 +107,13 @@ There are a number of predefined global variables that you can set in the front-

tags

@@ -80,16 +122,16 @@ There are a number of predefined global variables that you can set in the front- ## Custom Variables -Any variables in the front matter that are not predefined are mixed into -the data that is sent to the Liquid templating engine during the -conversion. For instance, if you set a title, you can use that in your -layout to set the page title: +Any variables in the front matter that are not predefined are mixed into the +data that is sent to the Liquid templating engine during the conversion. For +instance, if you set a title, you can use that in your layout to set the page +title: {% highlight html %} - {{ "{{ page.title " }}}} + {% raw %}{{ page.title }}{% endraw %} ... @@ -97,8 +139,7 @@ layout to set the page title: ## Predefined Variables for Posts -These are available out-of-the-box to be used in the front-matter for a -post. +These are available out-of-the-box to be used in the front-matter for a post.
SettingOptions and Flags + Options and Flags +

Site Source

-

Changes the directory where Jekyll will look to transform files

+

Change the directory where Jekyll will read files

source: [string]

-

--source [source]

+

-s, --source [source]

Site Destination

-

Changes the directory where Jekyll will write files to

+

Change the directory where Jekyll will write files

destination: [string]

-

--destination

+

-d, --destination [destination]

Safe

-

Disables custom plugins.

+

Disable custom plugins.

safe: [boolean]

@@ -54,7 +62,7 @@ The table below lists the available settings for Jekyll, and the various

Exclude

-

A list of directories and files to exclude from the conversion

+

Exclude directories and/or files from the conversion

exclude: [dir1, file1, dir2]

@@ -63,7 +71,11 @@ The table below lists the available settings for Jekyll, and the various

Include

-

A list of directories and files to specifically include in the conversion. .htaccess is a good example since dotfiles are excluded by default.

+

+ Force inclusion of directories and/or files in the conversion. + .htaccess is a good example since dotfiles are excluded + by default. +

include: [dir1, file1, dir2]

@@ -85,46 +97,34 @@ The table below lists the available settings for Jekyll, and the various

Regeneration

-

Enables auto-regeneration of the site when files are modified. Off by default.

+

Enable auto-regeneration of the site when files are modified.

-

--watch

+

-w, --watch

-

URL

-

Sets site.url, useful for environment switching

-
-

url: [URL]

-

--url [URL]

-
-

Markdown

-

Uses RDiscount or [engine] instead of Maruku.

+

Configuration

+

Specify a config file. Overrides settings in _config.yml

-

markdown: [engine]

-

--markdown [rdiscount|kramdown|redcarpet]

+

--config [FILE]

-

Pygments

-

Enables highlight tag with Pygments.

+

Drafts

+

Process and render draft posts.

-

pygments: [boolean]

-

--pygments

+

--drafts

Future

-

Publishes posts with a future date

+

Publish posts with a future date.

future: [boolean]

@@ -134,37 +134,17 @@ The table below lists the available settings for Jekyll, and the various

LSI

-

Produces an index for related posts.

+

Produce an index for related posts.

lsi: [boolean]

--lsi

-

Permalink

-

Controls the URLs that posts are generated with. Please refer to the Permalinks page for more info.

-
-

permalink: [style]

-

--permalink [style]

-
-

Pagination

-

Splits your posts up over multiple subdirectories called "page2", "page3", ... "pageN"

-
-

paginate: [per_page]

-

--paginate [per_page]

-

Limit Posts

-

Limits the number of posts to parse and publish

+

Limit the number of posts to parse and publish.

limit_posts: [max_posts]

@@ -191,7 +171,7 @@ before your site is served.

Local Server Port

-

Changes the port that the Jekyll server will run on

+

Listen on the given port.

port: [integer]

@@ -201,7 +181,7 @@ before your site is served.

Local Server Hostname

-

Changes the hostname that the Jekyll server will run on

+

Listen at the given hostname.

host: [string]

@@ -211,7 +191,7 @@ before your site is served.

Base URL

-

Serve website from a given base URL

+

Serve website with the given base URL

baseurl: [BASE_URL]

@@ -223,14 +203,38 @@ before your site is served.
Do not use tabs in configuration files
-

This will either lead to parsing errors, or Jekyll will revert to the default settings. Use spaces instead.

+

+ This will either lead to parsing errors, or Jekyll will revert to the + default settings. Use spaces instead. +

## Default Configuration -Jekyll runs with the following configuration options by default. Unless alternative settings for these options are explicitly specified in the configuration file or on the command-line, Jekyll will run using these options. +Jekyll runs with the following configuration options by default. Unless +alternative settings for these options are explicitly specified in the +configuration file or on the command-line, Jekyll will run using these options. {% highlight yaml %} +source: . +destination: ./_site +plugins: ./_plugins +layouts: ./_layouts +keep_files: ['.git','.svn'] + +future: true +pygments: false + +markdown: maruku +permalink: date +include: ['.htaccess'] +paginate_path: 'page:num' + +markdown_ext: markdown,mkd,mkdn,md +textile_ext: textile + +excerpt_separator: "\n\n" + safe: false watch: false server: false @@ -238,16 +242,7 @@ host: 0.0.0.0 port: 4000 baseurl: / url: http://localhost:4000 - -source: . -destination: ./_site -plugins: ./_plugins - -future: true lsi: false -pygments: false -markdown: maruku -permalink: date maruku: use_tex: false @@ -259,11 +254,15 @@ maruku: rdiscount: extensions: [] +redcarpet: + extensions: [] + kramdown: - auto_ids: true, + auto_ids: true footnote_nr: 1 entity_output: as_char toc_levels: 1..6 + smart_quotes: lsquo,rsquo,ldquo,rdquo use_coderay: false coderay: @@ -274,4 +273,6 @@ kramdown: coderay_bold_every: 10 coderay_css: style +redcloth: + hard_breaks: true {% endhighlight %} diff --git a/site/_posts/2012-07-01-contributing.md b/site/_posts/2012-07-01-contributing.md index 80e625b1..733d61b1 100644 --- a/site/_posts/2012-07-01-contributing.md +++ b/site/_posts/2012-07-01-contributing.md @@ -5,62 +5,83 @@ prev_section: deployment-methods next_section: troubleshooting --- -Contributions to Jekyll are always welcome, however there’s a few things that you should keep in mind to improve your chances of having your changes merged in. +So you've got an awesome idea to throw into Jekyll. Great! Please keep the +following in mind: -## Workflow - -Here’s the most typical way to get your change merged into the project: - -1. Fork the project [on GitHub](https://github.com/mojombo/jekyll) and clone it down to your local machine. -2. Create a topic branch to contain your change. -3. Hack away, add tests. Not necessarily in that order. -4. Make sure all the existing tests still pass. -5. If necessary, rebase your commits into logical chunks, without errors. -6. Push the branch up to your fork on GitHub. -7. Create an issue on GitHub with a link to your branch. +* 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](http://github.com/thoughtbot/shoulda/tree/master) and + [RR](http://github.com/btakita/rr/tree/master). +* 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 wiki + would be appreciated, and once merged it will be transferred over to the main + wiki. +* If your contribution changes any Jekyll behavior, make sure to update the + documentation. It lives in `site/_posts`. 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.
Contributions will not be accepted without tests
-

If you’re creating a small fix or patch to an existing feature, just - a simple test will do.

+

+ If you’re creating a small fix or patch to an existing feature, just + a simple test will do. +

-## Tests +Test Dependencies +----------------- -We’re big on tests, so please be sure to include them. Please stay in the confines of the current test suite and use [Shoulda](https://github.com/thoughtbot/shoulda) and [RR](https://github.com/btakita/rr). - -### Tests for brand-new features - -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 `gh-pages` branch would be appreciated, so the main website can be updated as soon as your new feature is merged. - -### Test dependencies - -To run the test suite and build the gem you’ll need to install Jekyll’s dependencies. Jekyll uses Bundler, so a quick run of the bundle command and you’re all set! +To run the test suite and build the gem you'll need to install Jekyll's +dependencies. Jekyll uses Bundler, so a quick run of the bundle command and +you're all set! {% highlight bash %} $ bundle {% endhighlight %} -Before you start, run the tests and make sure that they pass (to confirm -your environment is configured properly): +Before you start, run the tests and make sure that they pass (to confirm your +environment is configured properly): {% highlight bash %} $ rake test $ rake features {% endhighlight %} -## Common Gotchas +Workflow +-------- -- If you want to bump the gem version, please put that in a separate - commit. This way, the maintainers can control when the gem gets released. -- Try to keep your patch(es) based from [the latest commit on - mojombo/jekyll](https://github.com/mojombo/jekyll/commits/master). 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 labels like “fix” or “feature”. - The maintainers actively read the issues and will label it once they come - across it. +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//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 `rake`. +* 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 mojombo/jekyll and describe what your change + does and the why you think it should be merged. + +Gotchas +------- + +* If you want to bump the gem version, please put that in a separate commit. + This way, the maintainers can control when the gem gets released. +* Try to keep your patch(es) based from the latest commit on mojombo/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.
Let us know what could be better!
-

Both using and hacking on Jekyll should be fun, simple, and easy, so if for some reason you find it’s a pain, please create an issue on GitHub describing your experience so we can make it better.

+

+ Both using and hacking on Jekyll should be fun, simple, and easy, so if for + some reason you find it’s a pain, please create an issue on + GitHub describing your experience so we can make it better. +

diff --git a/site/_posts/2012-07-01-extras.md b/site/_posts/2012-07-01-extras.md index 7bbff0b9..2ac89e32 100644 --- a/site/_posts/2012-07-01-extras.md +++ b/site/_posts/2012-07-01-extras.md @@ -5,99 +5,111 @@ prev_section: plugins next_section: github-pages --- -There are a number of (optional) extra features that Jekyll supports that you may want to install, depending on how you plan to use Jekyll. +There are a number of (optional) extra features that Jekyll supports that you +may want to install, depending on how you plan to use Jekyll. ## Pygments -If you want syntax highlighting via the `{{ "{% highlight " }}%}` tag in your -posts, you’ll need to install [Pygments](http://pygments.org/). +If you want syntax highlighting via the `{% raw %}{% highlight %}{% endraw %}` +tag in your posts, you’ll need to install [Pygments](http://pygments.org/). ### Installing Pygments on OSX -Mac OS X (Leopard onwards) come preinstalled with Python, so on just about any OS X machine you can install Pygments simply by running: +Mac OS X (Leopard onwards) comes preinstalled with Python, so on just about any +OS X machine you can install Pygments simply by running: {% highlight bash %} -sudo easy_install Pygments +$ sudo easy_install Pygments {% endhighlight %} #### Installing Pygments using Homebrew -Alternatively, you can install Pygments with [Homebrew](http://mxcl.github.com/homebrew/), an excellent package manager for OS X: +Alternatively, you can install Pygments with +[Homebrew](http://mxcl.github.com/homebrew/), an excellent package manager for +OS X: + {% highlight bash %} -brew install python +$ brew install python # export PATH="/usr/local/share/python:${PATH}" -easy_install pip -pip install --upgrade distribute -pip install pygments +$ easy_install pip +$ pip install --upgrade distribute +$ pip install pygments {% endhighlight %} -**ProTip™**: Homebrew doesn’t symlink the executables for you. For the Homebrew default Cellar location and Python 2.7, be sure to add `/usr/local/share/python` to your `PATH`. For more information, check out [the Homebrew wiki](https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python). +
+
Homebrew's executable paths
+

+ Homebrew doesn’t symlink the executables for you. For the Homebrew default + Cellar location and Python 2.7, be sure to add `/usr/local/share/python` to + your `PATH`. For more information, check out [the Homebrew + wiki](https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python). +

+
#### Installing Pygments using MacPorts If you use MacPorts, you can install Pygments by running: {% highlight bash %} -sudo port install python25 py25-pygments +$ sudo port install python25 py25-pygments {% endhighlight %} -Seriously though, you should check out [Homebrew](http://mxcl.github.com/homebrew/)—it’s awesome. - +Seriously though, you should check out +[Homebrew](http://mxcl.github.com/homebrew/)—it’s awesome. ### Installing Pygments on Arch Linux You can install Pygments using the pacman package manager as follows: {% highlight bash %} -sudo pacman -S python-pygments +$ sudo pacman -S python-pygments {% endhighlight %} Or to use python2 for Pygments: + {% highlight bash %} -sudo pacman -S python2-pygments +$ sudo pacman -S python2-pygments {% endhighlight %} ### Installing Pygments on Ubuntu and Debian {% highlight bash %} -sudo apt-get install python-pygments +$ sudo apt-get install python-pygments {% endhighlight %} ### Installing Pygments on RedHat, Fedora, and CentOS {% highlight bash %} -sudo yum install python-pygments +$ sudo yum install python-pygments {% endhighlight %} ### Installing Pygments on Gentoo {% highlight bash %} -sudo emerge -av dev-python/pygments +$ sudo emerge -av dev-python/pygments {% endhighlight %} ## LaTeX Support -Maruku comes with optional support for LaTeX to PNG rendering via -blahtex (Version 0.6) which must be in your `$PATH` along with `dvips`. If you need Maruku to not assume a fixed location for `dvips`, check out [Remi’s Maruku fork](http://github.com/remi/maruku). +Maruku comes with optional support for LaTeX to PNG rendering via blahtex +(Version 0.6) which must be in your `$PATH` along with `dvips`. If you need +Maruku to not assume a fixed location for `dvips`, check out [Remi’s Maruku +fork](http://github.com/remi/maruku). ## RDiscount -If you prefer to use [RDiscount](http://github.com/rtomayko/rdiscount) instead of [Maruku](http://maruku.rubyforge.org/) for markdown, just make sure you have it installed: +If you prefer to use [RDiscount](http://github.com/rtomayko/rdiscount) instead +of [Maruku](http://maruku.rubyforge.org/) for markdown, just make sure you have +it installed: {% highlight bash %} -sudo gem install rdiscount +$ sudo gem install rdiscount {% endhighlight %} -And then run Jekyll with the following option: - -{% highlight bash %} -jekyll build --markdown rdiscount -{% endhighlight %} - -Or, specify RDiscount as the markdown engine in your `_config.yml` file to have Jekyll run with that option by default (so you don’t have to specify the flag every time). +And then specify RDiscount as the Markdown engine in your `_config.yml` file to +have Jekyll run with that option. {% highlight bash %} # In _config.yml markdown: rdiscount {% endhighlight %} - diff --git a/site/_posts/2012-07-01-frontmatter.md b/site/_posts/2012-07-01-frontmatter.md index 982e5ec1..337a7388 100644 --- a/site/_posts/2012-07-01-frontmatter.md +++ b/site/_posts/2012-07-01-frontmatter.md @@ -5,7 +5,11 @@ prev_section: configuration next_section: posts --- -The front-matter is where Jekyll starts to get really cool. Any files that contain a [YAML](http://yaml.org/) front matter block will be processed by Jekyll as special files. The front matter must be the first thing in the file and must take the form of sets of variables and values set between triple-dashed lines. Here is a basic example: +The front-matter is where Jekyll starts to get really cool. Any file that +contains a [YAML](http://yaml.org/) front matter block will be processed by +Jekyll as a special file. The front matter must be the first thing in the file +and must take the form of valid YAML set between triple-dashed lines. Here is a +basic example: {% highlight yaml %} --- @@ -14,11 +18,19 @@ title: Blogging Like a Hacker --- {% endhighlight %} -Between these triple-dashed lines, you can set predefined variables (see below for a reference) or even create custom ones of your own. These variables will then be available to you to access using Liquid tags both further down in the file and also in any layouts or includes that the page or post in question relies on. +Between these triple-dashed lines, you can set predefined variables (see below +for a reference) or even create custom ones of your own. These variables will +then be available to you to access using Liquid tags both further down in the +file and also in any layouts or includes that the page or post in question +relies on.
UTF-8 Character Encoding Warning
-

If you use UTF-8 encoding, make sure that no BOM header characters exist in your files or very, very bad things will happen to Jekyll. This is especially relevant if you’re running Jekyll on Windows.

+

+ If you use UTF-8 encoding, make sure that no BOM header + characters exist in your files or very, very bad things will happen to + Jekyll. This is especially relevant if you’re running Jekyll on Windows. +

## Predefined Global Variables @@ -38,7 +50,13 @@ There are a number of predefined global variables that you can set in the front-

layout

-

If set, this specifies the layout file to use. Use the layout file name without file extension. Layout files must be placed in the _layouts directory.

+

+ + If set, this specifies the layout file to use. Use the layout file + name without file extension. Layout files must be placed in the + _layouts directory. + +

-

If you need your processed URLs to be something other than the default /year/month/day/title.html then you can set this variable and it will be used as the final URL.

+

+ + If you need your processed blog post URLs to be something other than + the default /year/month/day/title.html then you can set + this variable and it will be used as the final URL. + +

-

Set to false if you don’t want a post to show up when the site is generated.

+

+ Set to false if you don’t want a specific post to show up when the + site is generated. +

-

Instead of placing posts inside of folders, you can specify one or more categories that the post belongs to. When the site is generated the post will act as though it had been set with these categories normally. Categories (plural key) can be specified as a YAML list or a space-separated string.

+

+ + Instead of placing posts inside of folders, you can specify one or + more categories that the post belongs to. When the site is generated + the post will act as though it had been set with these categories + normally. Categories (plural key) can be specified as a YAML list or a + space-separated string. + +

-

Similar to categories, one or multiple tags can be added to a post. Also like categories, tags can be specified as a YAML list or a space-separated string.

+

+ + Similar to categories, one or multiple tags can be added to a post. + Also like categories, tags can be specified as a YAML list or a space- + separated string. + +

@@ -113,7 +154,10 @@ post.

date

diff --git a/site/_posts/2012-07-01-github-pages.md b/site/_posts/2012-07-01-github-pages.md index dbe8434a..5382b4d0 100644 --- a/site/_posts/2012-07-01-github-pages.md +++ b/site/_posts/2012-07-01-github-pages.md @@ -5,30 +5,61 @@ prev_section: extras next_section: deployment-methods --- -[GitHub Pages](https://pages.github.com) are public web pages for users, organizations, and repositories, that are freely hosted on [GitHub](https://github.com/). GitHub Pages are powered by Jekyll behind the scenes, so in addition to supporting regular HTML content, they’re also a great way to host your Jekyll-powered website for free. +[GitHub Pages](https://pages.github.com) are public web pages for users, +organizations, and repositories, that are freely hosted on +[GitHub](https://github.com/). GitHub Pages are powered by Jekyll behind the +scenes, so in addition to supporting regular HTML content, they’re also a great +way to host your Jekyll-powered website for free. ## Deploying Jekyll to GitHub Pages -GitHub Pages work by looking at certain branches of repositories on GitHub. There are two basic types of Pages available, user/organization Pages and project Pages. The way to deploy these two types of pages are nearly identical, except for a few minor details. +GitHub Pages work by looking at certain branches of repositories on GitHub. +There are two basic types available: user/organization pages and project pages. +The way to deploy these two types of sites are nearly identical, except for a +few minor details. ### User and Organization Pages -User and organization Pages live in a special GitHub repository dedicated to only the Pages files. This repository must be named after the account name. For example, [@mojombo’s user page repository](https://github.com/mojombo/mojombo.github.com) has the name `mojombo.github.com`. +User and organization pages live in a special GitHub repository dedicated to +only the GitHub Pages files. This repository must be named after the account +name. For example, [@mojombo’s user page +repository](https://github.com/mojombo/mojombo.github.com) has the name +`mojombo.github.com`. -Content from the `master` branch of your repository will be used to build and publish the GitHub Pages site, so make sure your Jekyll site is stored there. +Content from the `master` branch of your repository will be used to build and +publish the GitHub Pages site, so make sure your Jekyll site is stored there.
Custom domains do not affect repository names
-

GitHub Pages are initially configured to live under the `username.github.com` subdomain, which is why repositories must be named this way even if a custom domain is being used.

+

+ GitHub Pages are initially configured to live under the + username.github.com subdomain, which is why repositories must + be named this way even if a custom domain is being used. +

### Project Pages -Unlike user and organization Pages, Project Pages are kept in the same repository as the project they are for, except that the website content is stored in a specially named `gh-pages` branch. The content of this branch will be used to rendered using Jekyll, and the output will become available under a subpath of your user pages subdomain, such as `username.github.com/project` (unless a custom domain is specified—see below). +Unlike user and organization Pages, Project Pages are kept in the same +repository as the project they are for, except that the website content is +stored in a specially named `gh-pages` branch. The content of this branch will +be rendered using Jekyll, and the output will become available under a subpath +of your user pages subdomain, such as `username.github.com/project` (unless a +custom domain is specified—see below). -The Jekyll project repository itself is a perfect example of this branch structure—the [master branch](https://github.com/mojombo/jekyll) contains the actual software project for Jekyll, however the Jekyll website (that you’re looking at right now) is contained in the [gh-pages branch](https://github.com/mojombo/jekyll/tree/gh-pages) of the same repository. +The Jekyll project repository itself is a perfect example of this branch +structure—the [master branch](https://github.com/mojombo/jekyll) contains the +actual software project for Jekyll, however the Jekyll website (that you’re +looking at right now) is contained in the [gh-pages +branch](https://github.com/mojombo/jekyll/tree/gh-pages) of the same repository.
GitHub Pages Documentation, Help, and Support
-

For more information about what you can do with GitHub Pages, as well as for troubleshooting guides, you should check out GitHub’s Pages Help section. If all else fails, you should contact GitHub Support.

+

+ For more information about what you can do with GitHub Pages, as well as for + troubleshooting guides, you should check out GitHub’s Pages Help + section. If all else fails, you should contact GitHub Support. +

diff --git a/site/_posts/2012-07-01-home.md b/site/_posts/2012-07-01-home.md index 34de7bb1..1d74545e 100644 --- a/site/_posts/2012-07-01-home.md +++ b/site/_posts/2012-07-01-home.md @@ -4,30 +4,45 @@ title: Welcome next_section: installation --- -This site aims to be a comprehensive guide to Jekyll. We’ll cover everything from getting your site up and running, creating and managing your content, customizing the way your site works and looks, deploying to various environments, as well as some advice on participating in the future development of Jekyll itself. +This site aims to be a comprehensive guide to Jekyll. We’ll cover everything +from getting your site up and running, creating and managing your content, +customizing the way your site works and looks, deploying to various +environments, as well as some advice on participating in the future development +of Jekyll itself. ## So what is Jekyll, exactly? -Jekyll is a simple, blog-aware, static site generator. It takes a template directory containing raw text files in various formats, runs it through [Markdown](http://daringfireball.net/projects/markdown/) (or [Textile](http://textile.sitemonks.com/)) and [Liquid](http://liquidmarkup.org/) converters, and spits out a complete, ready-to-publish static website suitable for serving with your favorite web server. Jekyll also happens to be the engine behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll to host your project’s page, blog, or website from GitHub’s servers **for free**. +Jekyll is a simple, blog-aware, static site generator. It takes a template +directory containing raw text files in various formats, runs it through +[Markdown](http://daringfireball.net/projects/markdown/) (or +[Textile](http://textile.sitemonks.com/)) and [Liquid](http://liquidmarkup.org/) +converters, and spits out a complete, ready-to-publish static website suitable +for serving with your favorite web server. Jekyll also happens to be the engine +behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll +to host your project’s page, blog, or website from GitHub’s servers **for +free**. ## Quick-start guide -For the impatient, here's how to get Jekyll up and running. +For the impatient, here's how to get a boilerplate Jekyll site up and running. {% highlight bash %} ~ $ gem install jekyll -~ $ mkdir -p my/new/site -~ $ cd my/new/site -~ $ vim index.html -~/my/new/site $ jekyll serve +~ $ jekyll new myblog +~ $ cd myblog +~/myblog $ jekyll serve # => Now browse to http://localhost:4000 {% endhighlight %} -That's nothing though. The real magic happens when you start creating posts, using the front-matter to conrol templates and layouts, and taking advantage of all the awesome configuration options Jekyll makes available. +That's nothing, though. The real magic happens when you start creating blog +posts, using the front-matter to control templates and layouts, and taking +advantage of all the awesome configuration options Jekyll makes available. ## ProTips™, Notes, and Warnings -Throughout this guide there are a number of small-but-handy pieces of information that can make using Jekyll easier, more interesting, and less hazardous. Here’s what to look out for. +Throughout this guide there are a number of small-but-handy pieces of +information that can make using Jekyll easier, more interesting, and less +hazardous. Here’s what to look out for.
ProTips™ help you get more from Jekyll
@@ -36,7 +51,8 @@ Throughout this guide there are a number of small-but-handy pieces of informatio
Notes are handy pieces of information
-

These are for the extra tidbits sometimes necessary to understand Jekyll.

+

These are for the extra tidbits sometimes necessary to understand + Jekyll.

@@ -44,4 +60,7 @@ Throughout this guide there are a number of small-but-handy pieces of informatio

Be aware of these messages if you wish to avoid certain death.

-If you come across anything along the way that we haven’t covered, or if you know of a tip yourself you think others would find handy, please [file an issue](https://github.com/mojombo/jekyll/issues/new) and we’ll see about including it in this guide. +If you come across anything along the way that we haven’t covered, or if you +know of a tip yourself you think others would find handy, please [file an +issue](https://github.com/mojombo/jekyll/issues/new) and we’ll see about +including it in this guide. diff --git a/site/_posts/2012-07-01-installation.md b/site/_posts/2012-07-01-installation.md index 190645fb..33f111be 100644 --- a/site/_posts/2012-07-01-installation.md +++ b/site/_posts/2012-07-01-installation.md @@ -5,11 +5,15 @@ prev_section: home next_section: usage --- -Getting Jekyll installed and ready-to-go should only take a few minutes. If it ever becomes a pain in the ass, you should [file an issue](https://github.com/mojombo/jekyll/issues/new) (or submit a pull request) about what might be a better way to do things. +Getting Jekyll installed and ready-to-go should only take a few minutes. If it +ever becomes a pain in the ass, please [file an +issue](https://github.com/mojombo/jekyll/issues/new) (or submit a pull request) +describing the issue you encountered, and how we might make the process easier. ### Requirements -Installing Jekyll is easy and straight-forward, but there’s a few requirements you’ll need to make sure your system has before you start. +Installing Jekyll is easy and straight-forward, but there are a few requirements +you’ll need to make sure your system has before you start. - [Ruby](http://www.ruby-lang.org/en/downloads/) - [RubyGems](http://rubygems.org/pages/download) @@ -17,27 +21,46 @@ Installing Jekyll is easy and straight-forward, but there’s a few requirements
Running Jekyll on Windows
-

It is possible to get Jekyll running on Windows however the official documentation does not support installation on Windows platforms.

+

+ It is possible to get + + Jekyll running on Windows, but the official documentation does not + support installation on Windows platforms. +

## Install with RubyGems The best way to install Jekyll is via -[RubyGems](http://docs.rubygems.org/read/chapter/3). At the terminal prompt, simply run the following command to install Jekyll: +[RubyGems](http://docs.rubygems.org/read/chapter/3). At the terminal prompt, +simply run the following command to install Jekyll: {% highlight bash %} -gem install jekyll +$ gem install jekyll {% endhighlight %} -All Jekyll’s gem dependancies are automatically installed by the above command, so you won’t have to worry about them at all. If you have problems installing Jekyll, check out the [troubleshooting](../troubleshooting) page or [report an issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll community can improve the experience for everyone. +All Jekyll’s gem dependencies are automatically installed by the above command, +so you won’t have to worry about them at all. If you have problems installing +Jekyll, check out the [troubleshooting](../troubleshooting) page or [report an +issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll community can +improve the experience for everyone. ## Optional Extras -There are a number of (optional) extra features that Jekyll supports that you may want to install, depending on how you plan to use Jekyll. These extras include syntax highlighting of code snippets using [Pygments](http://pygments.org/), LaTeX support, and the use of alternative content rendering engines. Check out [the extras page](../extras) for more information. +There are a number of (optional) extra features that Jekyll supports that you +may want to install, depending on how you plan to use Jekyll. These extras +include syntax highlighting of code snippets using +[Pygments](http://pygments.org/), LaTeX support, and the use of alternative +content rendering engines. Check out [the extras page](../extras) for more +information.
ProTip™: Enable Syntax Highlighting
-

If you’re the kind of person who is using Jekyll, then chances are you’ll definitely want to enable syntax highlighting using Pygments. You should really check out how to do that before you go any further.

+

+ If you’re the kind of person who is using Jekyll, then chances are you’ll + want to enable syntax highlighting using Pygments. You should really + check out how to do that before you go any further. +

Now that you’ve got everything installed, let’s get to work! diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index 3360fe4b..38c61d81 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -5,29 +5,53 @@ prev_section: variables next_section: templates --- -If you’re switching to Jekyll from another blogging system, Jekyll’s migrators can help you with the move. Most methods listed on this page require read access to the database to generate posts from your old system. Each method generates `.markdown` posts in the `_posts` directory based on the entries in the database. +If you’re switching to Jekyll from another blogging system, Jekyll’s importers +can help you with the move. Most methods listed on this page require read access +to the database to generate posts from your old system. Each method generates +`.markdown` posts in the `_posts` directory based on the entries in the foreign +system. ## Preparing for migrations -The migrators are [built-in to the Jekyll gem](https://github.com/mojombo/jekyll/tree/master/lib/jekyll/migrators), and require a few things to be set up in your project directory before they are run. This should all be done from the root folder of your Jekyll project. +Because the importers have many of their own dependencies, they are made +available via a separate gem called `jekyll-import`. To use them, all you need +to do is install the gem, and they will become available as part of Jekyll's +standard command line interface. {% highlight bash %} -$ mkdir _import -$ gem install sequel mysqlplus +$ gem install jekyll-import {% endhighlight %} -You should now be all set to run the migrators below. +You should now be all set to run the importers below. If you ever get stuck, you +can see help for each importer: + +{% highlight bash %} +$ jekyll help import # => See list of importers +$ jekyll help import IMPORTER # => See importer specific help +{% endhighlight %} + +Where IMPORTER is the name of the specific importer.
Note: Always double-check migrated content
-

Import scripts may not distinguish between published or private posts, so you should always check that the content Jekyll generates for you appears as you intended.

+

+ + Importers may not distinguish between published or private posts, so + you should always check that the content Jekyll generates for you appears as + you intended. + +

+ + ## WordPress ### Wordpress export files -If hpricot is not already installed, you will need to run `gem install hpricot`. Next, export your blog using the Wordpress export utility. Assuming that exported file is saved as `wordpress.xml`, here is the command you need to run: +If hpricot is not already installed, you will need to run `gem install hpricot`. +Next, export your blog using the Wordpress export utility. Assuming that +exported file is saved as `wordpress.xml`, here is the command you need to run: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/wordpressdotcom"; @@ -177,4 +201,4 @@ $ ruby -rubygems -e 'require "jekyll/migrators/tumblr"; ## Other Systems -If you have a system that there isn’t currently a migrator for, you should consider writing one and sending us a pull request. \ No newline at end of file +If you have a system that there isn’t currently a migrator for, you should consider writing one and sending us a pull request. diff --git a/site/_posts/2012-07-01-pages.md b/site/_posts/2012-07-01-pages.md index c53e06c2..c78d6145 100644 --- a/site/_posts/2012-07-01-pages.md +++ b/site/_posts/2012-07-01-pages.md @@ -5,58 +5,81 @@ prev_section: posts next_section: variables --- -As well as [writing posts](../posts), the other thing you may want to do with your Jekyll site is create static pages. This is pretty simple to do, simply by taking advantage of the way Jekyll copies files and directories. +In addition to [writing posts](../posts), another thing you may want to do with +your Jekyll site is create static pages. By taking advantage of the way Jekyll +copies files and directories, this is easy to do. ## Homepage -Just about every web server configuration you’ll come across will look for a HTML file called `index.html` (by convention) in the site root folder and display that as the homepage. Unless the web server you’re using is configured to look for some different filename as the default, this file will turn into the homepage of your Jekyll-generated site. +Just about every web server configuration you come across will look for an HTML +file called `index.html` (by convention) in the site's root folder and display +that as the homepage. Unless the web server you’re using is configured to look +for some different filename as the default, this file will turn into the +homepage of your Jekyll-generated site.
ProTip™: Use layouts on your homepage
-

Any HTML file on your site can make use of layouts and includes, even the homepage. It’s usually a good idea to extract everything that is the same across all your pages into an included file in a layout.

+

+ Any HTML file on your site can use layouts and/or includes, even the + homepage. Common content, like headers and footers, make excellent + candidates for extraction into a layout. +

## Where additional pages live -Where you put HTML files for pages depends on how you want the pages to work, since there are two main ways of creating pages: +Where you put HTML files for pages depends on how you want the pages to work. +There are two main ways of creating pages: -- By placing named HTML files for each page in the site root folder. -- Create a folder in the site root for each page, and placing an index.html file in each page folder. +- Place named HTML files for each page in your site's root folder. +- Create a folder in the site's root for each page, and place an index.html file + in each page folder. -Both methods work fine (and can be used in conduction with each other), with the only real difference being the resulting URLs each page has. +Both methods work fine (and can be used in conjunction with each other), with the +only real difference being the resulting URLs. ### Named HTML files -The simplest way of adding a page is just to add a HTML file in the root directory with a suitable name for the page you want to create. For a site with a homepage, an about page, and a contact page, here’s what the root directory and associated URLs might look like. +The simplest way of adding a page is just to add an HTML file in the root +directory with a suitable name for the page you want to create. For a site with +a homepage, an about page, and a contact page, here’s what the root directory +and associated URLs might look like: {% highlight bash %} . |-- _config.yml -|-- _includes -|-- _layouts -|-- _posts -|-- _site -|-- about.html #=> http://yoursite.com/about.html -|-- index.html #=> http://yoursite.com/ -└── contact.html #=> http://yoursite.com/contact.html +|-- _includes/ +|-- _layouts/ +|-- _posts/ +|-- _site/ +|-- about.html # => http://yoursite.com/about.html +|-- index.html # => http://yoursite.com/ +└── contact.html # => http://yoursite.com/contact.html {% endhighlight %} ### Named folders containing index HTML files -There is nothing wrong with the above method, however some people like to keep their URLs free from things like filename extensions. To achieve clean URLs for pages using Jekyll, you simply need to create a folder for each top-level page you want, and then place an `index.html` file in each page’s folder. This way the page URL ends up being the folder name, and the web server will serve up the respective `index.html` file. An example of what this structure would look like is as follows: +There is nothing wrong with the above method, however some people like to keep +their URLs free from things like filename extensions. To achieve clean URLs for +pages using Jekyll, you simply need to create a folder for each top-level page +you want, and then place an `index.html` file in each page’s folder. This way +the page URL ends up being the folder name, and the web server will serve up the +respective `index.html` file. Here's an example of what this structure might +look like: {% highlight bash %} . ├── _config.yml -├── _includes -├── _layouts -├── _posts -├── _site -├── about -| └── index.html #=> http://yoursite.com/about/ -├── contact -| └── index.html #=> http://yoursite.com/contact/ -└── index.html #=> http://yoursite.com/ +├── _includes/ +├── _layouts/ +├── _posts/ +├── _site/ +├── about/ +| └── index.html # => http://yoursite.com/about/ +├── contact/ +| └── index.html # => http://yoursite.com/contact/ +└── index.html # => http://yoursite.com/ {% endhighlight %} -This approach may not suit everyone, but for people who like clear URLs it’s simple and it works. In the end the decision is yours! +This approach may not suit everyone, but for people who like clean URLs it’s +simple and it works. In the end the decision is yours! diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index 71c4d55d..b470c370 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -5,117 +5,138 @@ prev_section: permalinks next_section: plugins --- -With many websites—especially blogs—it’s very common to break the main listing of posts up into smaller lists and display them over multiple pages. Jekyll has pagination built-in, so you can automatically generate the appropriate files and folders you need for paginated post listings. +With many websites—especially blogs—it’s very common to break the main listing +of posts up into smaller lists and display them over multiple pages. Jekyll has +pagination built-in, so you can automatically generate the appropriate files and +folders you need for paginated listings.
Pagination only works within HTML files
-

Pagination does not work with Markdown or Textile files in your Jekyll site. It will only work when used within HTML files. Since you’ll likely be using this for the list of posts, this probably won’t be an issue.

+

+ Pagination does not work with Markdown or Textile files in your Jekyll site. + It will only work when used within HTML files. Since you’ll likely be using + this for the list of Posts, this shouldn't be an issue. +

## Enable pagination -The first thing you need to do to enable pagination for your blog is add a line to the `_config.yml` Jekyll configuration file that specifies how many items should be displayed per page. Here is what the line should look like: +To enable pagination for your blog, add a line to the `_config.yml` file that +specifies how many items should be displayed per page: {% highlight yaml %} paginate: 5 {% endhighlight %} -The number should be the maximum number of posts you’d like to be displayed per-page in the generated site. +The number should be the maximum number of Posts you’d like to be displayed per- +page in the generated site.
Pagination does not support tags or categories

Pagination pages through every post in the posts variable regardless of variables defined in the YAML Front Matter of each. It does not currently allow paging over groups of posts linked by a common tag or category.

-## Render the paginated posts +## Render the paginated Posts -The next thing you need to do is to actually display your posts in a list using the `paginator` variable that will now be available to you. You’ll probably want to do this in one of the main pages of your site. Here’s one example of a simple way of rendering paginated posts in a HTML file: +The next thing you need to do is to actually display your posts in a list using +the `paginator` variable that will now be available to you. You’ll probably want +to do this in one of the main pages of your site. Here’s one example of a simple +way of rendering paginated Posts in a HTML file: {% highlight html %} +{% raw %} --- layout: default title: My Blog --- -{{ "{% for post in paginator.posts " }}%} -

{{ "{{ post.title " }}}}

+{% for post in paginator.posts %} +

{{ post.title }}

- {{ "{{post.date" }}}} + {{ post.date }}

- {{ "{{ post.content " }}}} + {{ post.content }}
-{{ "{% endfor " }}%} +{% endfor %} +{% endraw %} {% endhighlight %}
Beware the page one edge-case
-

Jekyll does not generate a ‘page1’ folder, so the above code will not work when a /page1 link is produced. See below for a way to handle this if it’s a problem for you.

+

+ Jekyll does not generate a ‘page1’ folder, so the above code will not work + when a /page1 link is produced. See below for a way to handle + this if it’s a problem for you. +

-The following HTML snippet should handle page one, and render a list of each page with links to all but the current page. +The following HTML snippet should handle page one, and render a list of each +page with links to all but the current page. {% highlight html %} +{% raw %} +{% endraw %} {% endhighlight %} diff --git a/site/_posts/2012-07-01-permalinks.md b/site/_posts/2012-07-01-permalinks.md index 9bee0d72..b0a7c8cf 100644 --- a/site/_posts/2012-07-01-permalinks.md +++ b/site/_posts/2012-07-01-permalinks.md @@ -5,8 +5,15 @@ prev_section: templates next_section: pagination --- -Jekyll supports a flexible way to build your site’s URLs. You can -specify the permalinks for your site through the [Configuration](../configuration) or on the [YAML Front Matter](../frontmatter) for each post. You’re free to choose one of the built-in styles to create your links or craft your own. The default style is always `date`. +Jekyll supports a flexible way to build your site’s URLs. You can specify the +permalinks for your site through the [Configuration](../configuration) or in the +[YAML Front Matter](../frontmatter) for each post. You’re free to choose one of +the built-in styles to create your links or craft your own. The default style is +`date`. + +Permalinks are constructed by creating a template URL where dynamic elements are +represented by colon-prefixed keywords. For example, the default `date` +permalink is defined as `/:categories/:year/:month/:day/:title.html`. ## Template variables @@ -23,7 +30,7 @@ specify the permalinks for your site through the [Configuration](../configuratio

year

@@ -31,31 +38,7 @@ specify the permalinks for your site through the [Configuration](../configuratio

month

- - - - - - - - - - - - @@ -63,7 +46,15 @@ specify the permalinks for your site through the [Configuration](../configuratio

i_month

+ + + + @@ -71,7 +62,27 @@ specify the permalinks for your site through the [Configuration](../configuratio

i_day

+ + + + + + + + @@ -160,4 +171,3 @@ Given a post named: `/2009-04-29-slap-chop.textile`
-

A date here overrides the date from the name of the post. This can be used to ensure correct sorting of posts.

+

+ A date here overrides the date from the name of the post. This can be + used to ensure correct sorting of posts. +

-

Year from the post’s filename

+

Year from the Post’s filename

-

Month from the post’s filename

-
-

day

-
-

Day from the post’s filename

-
-

title

-
-

Title from the post’s filename

-
-

categories

-
-

The specified categories for this post. Jekyll automatically parses out double slashes in the URLs, so if no categories are present, it basically ignores this.

+

Month from the Post’s filename

-

 Month from the post’s filename without leading zeros.

+

Month from the Post’s filename without leading zeros.

+
+

day

+
+

Day from the Post’s filename

-

Day from the post’s filename without leading zeros.

+

Day from the Post’s filename without leading zeros.

+
+

title

+
+

Title from the Post’s filename

+
+

categories

+
+

+ The specified categories for this Post. Jekyll automatically parses + out double slashes in the URLs, so if no categories are present, it + will ignore this. +

- diff --git a/site/_posts/2012-07-01-plugins.md b/site/_posts/2012-07-01-plugins.md index 6543e621..e41f1bbc 100644 --- a/site/_posts/2012-07-01-plugins.md +++ b/site/_posts/2012-07-01-plugins.md @@ -6,19 +6,27 @@ next_section: extras --- Jekyll has a plugin system with hooks that allow you to create custom generated -content specific to your site. You can run custom code for your site -without having to modify the Jekyll source itself. +content specific to your site. You can run custom code for your site without +having to modify the Jekyll source itself.
Plugins on GitHub Pages
-

GitHub Pages are powered by Jekyll, however all Pages sites are generated using the --safe option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.

+

+ GitHub Pages is powered by Jekyll, + however all Pages sites are generated using the --safe option + to disable custom plugins for security reasons. Unfortunately, this means + your plugins won’t work if you’re deploying to GitHub Pages.

+ You can still use GitHub Pages to publish your site, but you'll need to + convert the site locally and push the generated static files to your GitHub + repository instead of the Jekyll source files. +

## Installing a plugin -In your site source root, make a `_plugins` directory. Place your plugins -here. Any file ending in `*.rb` inside this directory will be required -when Jekyll generates your site. +In your site source root, make a `_plugins` directory. Place your plugins here. +Any file ending in `*.rb` inside this directory will be loaded before Jekyll +generates your site. In general, plugins you make will fall into one of three categories: @@ -28,9 +36,8 @@ In general, plugins you make will fall into one of three categories: ## Generators -You can create a generator when you need Jekyll to create additional -content based on your own rules. For example, a generator might look -like this: +You can create a generator when you need Jekyll to create additional content +based on your own rules. For example, a generator might look like this: {% highlight ruby %} module Jekyll @@ -68,8 +75,8 @@ end {% endhighlight %} In this example, our generator will create a series of files under the -`categories` directory for each category, listing the posts in each -category using the `category_index.html` layout. +`categories` directory for each category, listing the posts in each category +using the `category_index.html` layout. Generators are only required to implement one method: @@ -94,18 +101,20 @@ Generators are only required to implement one method: ## Converters -If you have a new markup language you’d like to include in your site, -you can include it by implementing your own converter. Both the markdown -and textile markup languages are implemented using this method. +If you have a new markup language you’d like to use with your site, you can +include it by implementing your own converter. Both the Markdown and Textile +markup languages are implemented using this method.
Remember your YAML front-matter
-

Jekyll will only convert files that have a YAML header at -the top, even for converters you add using a plugin. If there is no YAML header, Jekyll will ignore the file and not send it through the converter.

+

+ Jekyll will only convert files that have a YAML header at the top, even for + converters you add using a plugin. +

-Below is a converter that will take all posts ending in .upcase and -process them using the UpcaseConverter: +Below is a converter that will take all posts ending in `.upcase` and process +them using the `UpcaseConverter`: {% highlight ruby %} module Jekyll @@ -114,7 +123,7 @@ module Jekyll priority :low def matches(ext) - ext =~ /upcase/i + ext =~ /^\.upcase$/i end def output_ext(ext) @@ -142,37 +151,46 @@ Converters should implement at a minimum 3 methods:

matches

- -

Called to determine whether the specific converter will -run on the page.

- +

+ Does the given extension match this converter's list of acceptable + extensions? Takes one argument: the file's extension (including the + dot). Must return true if it matches, false + otherwise. +

output_ext

- -

The extension of the outputted file, usually this will be .html

- +

+ The extension to be given to the output file (including the dot). + Usually this will be ".html". +

convert

- -

Logic to do the content conversion

- +

+ Logic to do the content conversion. Takes one argument: the raw content + of the file (without YAML front matter). Must return a String. +

-In our example, UpcaseConverter-matches checks if our filename extension is `.upcase`, and will render using the converter if it is. It will call UpcaseConverter-convert to process the content - in our simple converter we’re simply capitalizing the entire content string. Finally, when it saves the page, it will do so with the `.html` extension. +In our example, `UpcaseConverter#matches` checks if our filename extension is +`.upcase`, and will render using the converter if it is. It will call +`UpcaseConverter#convert` to process the content. In our simple converter we’re +simply uppercasing the entire content string. Finally, when it saves the page, +it will do so with a `.html` extension. ## Tags -If you’d like to include custom liquid tags in your site, you can do so -by hooking into the tagging system. Built-in examples added by Jekyll -include the `{{"{% highlight "}}%}` and `{{"{% include "}}%}` tags. Below is an example custom liquid tag that will output the time the page was rendered: +If you’d like to include custom liquid tags in your site, you can do so by +hooking into the tagging system. Built-in examples added by Jekyll include the +`highlight` and `include` tags. Below is an example of a custom liquid tag that +will output the time the page was rendered: {% highlight ruby %} module Jekyll @@ -213,16 +231,20 @@ At a minimum, liquid tags must implement: -You must also register the custom tag with the Liquid template engine as follows: +You must also register the custom tag with the Liquid template engine as +follows: {% highlight ruby %} Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag) {% endhighlight %} -In the example above, we can place the following tag anywhere in one of our pages: +In the example above, we can place the following tag anywhere in one of our +pages: {% highlight ruby %} -

{{"{% render_time page rendered at: "}}%}

+{% raw %} +

{% render_time page rendered at: %}

+{% endraw %} {% endhighlight %} And we would get something like this on the page: @@ -233,7 +255,10 @@ And we would get something like this on the page: ### Liquid filters -You can add your own filters to the Liquid template system much like you can add tags above. Filters are simply modules that export their methods to liquid. All methods will have to take at least one parameter which represents the input of the filter. The return value will be the output of the filter. +You can add your own filters to the Liquid template system much like you can add +tags above. Filters are simply modules that export their methods to liquid. All +methods will have to take at least one parameter which represents the input of +the filter. The return value will be the output of the filter. {% highlight ruby %} module Jekyll @@ -249,7 +274,12 @@ Liquid::Template.register_filter(Jekyll::AssetFilter)
ProTip™: Access the site object using Liquid
-

Jekyll lets you access the site object through the context.registers feature of liquid. For example, you can access the global configuration file _config.yml using context.registers.config.

+

+ Jekyll lets you access the site object through the + context.registers feature of Liquid. For example, you can + access the global configuration file _config.yml using + context.registers.config. +

### Flags @@ -269,24 +299,35 @@ There are two flags to be aware of when writing a plugin:

safe

-

A boolean flag that allows a plugin to be safely included in -Jekyll core for exclusion from use with GitHub Pages. In general, set -this to true.

+

+ A boolean flag that informs Jekyll whether this plugin may be safely + executed in an environment where arbitrary code execution is not + allowed. This is used by GitHub Pages to determine which core plugins + may be used, and which are unsafe to run. If your plugin does not + allow for arbitrary code, execution, set this to true. + GitHub Pages still won't load your plugin, but if you submit it for + inclusion in core, it's best for this to be correct! +

-

priortiy

+

priority

-

This flag determines what order the plugin is loaded in. Valid -values are: :lowest, :low, :normal, :high, and :highest.

+

+ This flag determines what order the plugin is loaded in. Valid values + are: :lowest, :low, :normal, + :high, and :highest. Highest priority + matches are applied first, lowest priority are applied last. +

-To use one of the example plugins above as an illustration, here is how you’d specify these two flags: +To use one of the example plugins above as an illustration, here is how you’d +specify these two flags: {% highlight ruby %} module Jekyll @@ -298,16 +339,15 @@ module Jekyll end {% endhighlight %} - ## Available Plugins There are a few useful, prebuilt plugins at the following locations: - [Truncate HTML while preserving markup structure](https://github.com/MattHall/truncatehtml) by [Matt Hall](http://codebeef.com) -- [Generic Blog Plugins by Jose Diaz-Gonzalez](https://github.com/josegonzalez/josediazgonzalez.com/tree/master/_plugins): Contains plugins for tags, categories, archives, as well as a few liquid extensions +- [Generic Blog Plugins by Jose Diaz-Gonzalez](https://github.com/josegonzalez/josediazgonzalez.com/tree/master/_plugins): Contains plugins for tags, categories, archives, as well as a few Liquid extensions - [Domain Name Filter by Lawrence Woodman](https://github.com/LawrenceWoodman/domain_name-liquid_filter): Filters the input text so that just the domain name is left -- [Jekyll Plugins by Recursive Design](http://recursive-design.com/projects/jekyll-plugins/): Plugin to generate Project pages from github readmes, a Category page plugin, and a Sitemap generator -- [Tag Cloud Plugin from a Jekyll walk-through](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/): Plugin to generate a Tag Cloud +- [Jekyll Plugins by Recursive Design](http://recursive-design.com/projects/jekyll-plugins/): Plugin to generate Project pages from GitHub readmes, a Category page plugin, and a Sitemap generator +- [Tag Cloud Plugin from a Jekyll walk-through](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/): Plugin to generate a tag cloud - [Pygments Cache Path by Raimonds Simanovskis](https://github.com/rsim/blog.rayapps.com/blob/master/_plugins/pygments_cache_patch.rb): Plugin to cache syntax-highlighted code from Pygments - [Delicious Plugin by Christian Hellsten](https://github.com/christianhellsten/jekyll-plugins): Fetches and renders bookmarks from delicious.com. - [Ultraviolet plugin by Steve Alex](https://gist.github.com/480380): Jekyll Plugin for Ultraviolet @@ -380,5 +420,9 @@ There are a few useful, prebuilt plugins at the following locations:
Jekyll Plugins Wanted
-

If you have a Jekyll plugin that you would like to see added to this list, you should read the contributing page to find out how to make that happen.

+

+ If you have a Jekyll plugin that you would like to see added to this list, + you should read the contributing page to find + out how to make that happen. +

diff --git a/site/_posts/2012-07-01-posts.md b/site/_posts/2012-07-01-posts.md index 2871213b..80f6256e 100644 --- a/site/_posts/2012-07-01-posts.md +++ b/site/_posts/2012-07-01-posts.md @@ -5,77 +5,121 @@ prev_section: frontmatter next_section: pages --- -One of Jekyll’s best aspects is that it is “blog aware”. What does that mean, exactly? Well, simply put it means that blogging is baked into Jekyll’s functionality by default. For people who write articles and publish them online, this means that you can publish and maintain a blog simply by managing a folder full of text-files on your computer. Compared to the hassle of configuring and maintaining databases and web-based CMS systems, this will be a welcome change for many. +One of Jekyll’s best aspects is that it is “blog aware”. What does this mean, +exactly? Well, simply put, it means that blogging is baked into Jekyll’s +functionality. If you write articles and publish them online, this means that +you can publish and maintain a blog simply by managing a folder of text-files on +your computer. Compared to the hassle of configuring and maintaining databases +and web-based CMS systems, this will be a welcome change! ## The Posts Folder -As detailed on the [directory structure](../structure) page, the `_posts` folder in any Jekyll site is where the files for all your articles will live. These files can be either [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/) formatted text files, and as long as they have [YAML front-matter](../frontmatter) defined, they will be converted from their source format into a HTML page that is part of your static site. +As explained on the [directory structure](../structure) page, the `_posts` +folder is where your blog posts will live. These files can be either +[Markdown](http://daringfireball.net/projects/markdown/) or +[Textile](http://textile.sitemonks.com/) formatted text files, and as long as +they have [YAML front-matter](../frontmatter), they will be converted from their +source format into an HTML page that is part of your static site. ### Creating Post Files -To create a new post, all you need to do is create a new file in the `_posts` folder. The filename structure used for files in this folder is important—Jekyll requires the file to be named in the following format: +To create a new post, all you need to do is create a new file in the `_posts` +directory. How you name files in this folder is important. Jekyll requires blog +post files to be named according to the following format: {% highlight bash %} YEAR-MONTH-DAY-title.MARKUP {% endhighlight %} -Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is an appropriate file extension for the format your post is written in. For example, the following are examples of excellent post filenames: +Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit +numbers, and `MARKUP` is the file extension representing the format used in the +file. For example, the following are examples of valid post filenames: {% highlight bash %} -2011-12-31-new-years-eve-is-awesome.markdown +2011-12-31-new-years-eve-is-awesome.md 2012-09-12-how-to-write-a-blog.textile {% endhighlight %} ### Content Formats -The first thing you need to put in any post is a section for [YAML front-matter](../frontmatter), but after that, it's simply a case of deciding which format you prefer to write in. Jekyll supports two popular content markup formats: [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/). These formats each have their own way of signifying different types of content within a post, so you should read up on how these formats work and decide which one suits your needs best. +All blog post files must begin with [YAML front- matter](../frontmatter). After +that, it's simply a matter of deciding which format you prefer. Jekyll supports +two popular content markup formats: +[Markdown](http://daringfireball.net/projects/markdown/) and +[Textile](http://textile.sitemonks.com/). These formats each have their own way +of marking up different types of content within a post, so you should +familiarize yourself with these formats and decide which one best suits your +needs. ## Including images and resources -For people who publish articles on a regular basis, it’s quite common to need to include things like images, links, downloads, and other resources along with their text-based content. While the ways to link to these resources differ between Markdown and Textile, the problem of working out where to store these files in your site is something everyone will face. +Chances are, at some point, you'll want to include images, downloads, or other +digital assets along with your text content. While the syntax for linking to +these resources differs between Markdown and Textile, the problem of working out +where to store these files in your site is something everyone will face. -Because of Jekyll’s flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like `assets` or `downloads`, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the site’s root as the path for the asset to include. Again, this will depend on the way your site’s (sub)domain and path are configured, but here some examples (in Markdown) of how you could do this using the `{{ "{{ site.url " }}}}` variable in a post. +Because of Jekyll’s flexibility, there are many solutions to how to do this. One +common solution is to create a folder in the root of the project directory +called something like `assets` or `downloads`, into which any images, downloads +or other resources are placed. Then, from within any post, they can be linked to +using the site’s root as the path for the asset to include. Again, this will +depend on the way your site’s (sub)domain and path are configured, but here some +examples (in Markdown) of how you could do this using the `site.url` variable in +a post. Including an image asset in a post: -{% highlight bash %} +{% highlight text %} … which is shown in the screenshot below: -![My helpful screenshot]({{ "{{ site.url " }}}}/assets/screenshot.jpg) +![My helpful screenshot]({% raw %}{{ site.url }}{% endraw %}/assets/screenshot.jpg) {% endhighlight %} Linking to a PDF for readers to download: -{% highlight bash %} -… you can [get the PDF]({{ "{{ site.url " }}}}/assets/mydoc.pdf) directly. +{% highlight text %} +… you can [get the PDF]({% raw %}{{ site.url }}{% endraw %}/assets/mydoc.pdf) directly. {% endhighlight %}
ProTip™: Link using just the site root URL
-

You can skip the {{ "{{ site.url " }}}} variable if you know your site will only ever be displayed at the root URL of your domain. In this case you can reference assets directly with just /path/file.jpg.

+

+ You can skip the {% raw %}{{ site.url }}{% endraw %} variable + if you know your site will only ever be displayed at the + root URL of your domain. In this case you can reference assets directly with + just /path/file.jpg. +

## Displaying an index of posts -It’s all well and good to have posts in a folder, but a blog is no use unless you have a list of posts somewhere for people. Creating an index of posts on another page (or in a [template](../templates)) is easy, thanks to the [Liquid template language](http://liquidmarkup.org/) and it’s tags. Here’s a basic example of how to create an unordered list of links to posts for a Jekyll site: +It’s all well and good to have posts in a folder, but a blog is no use unless +you have a list of posts somewhere. Creating an index of posts on another page +(or in a [template](../templates)) is easy, thanks to the [Liquid template +language](http://liquidmarkup.org/) and its tags. Here’s a basic example of how +to create a list of links to your blog posts: {% highlight html %} {% endhighlight %} -Of course, you have full control over how (and where) you display your posts, and how you structure your site. You should read more about [how templates work](../templates) with Jekyll if you’re interested in these kinds of things. +Of course, you have full control over how (and where) you display your posts, +and how you structure your site. You should read more about [how templates +work](../templates) with Jekyll if you want to know more. ## Highlighting code snippets -Jekyll also has built-in support for syntax highlighting of code snippets using [Pygments](../extras), and including a code snippet in any post is easy. Just use the dedicated Liquid tag as follows: +Jekyll also has built-in support for syntax highlighting of code snippets using +[Pygments](../extras), and including a code snippet in any post is easy. Just +use the dedicated Liquid tag as follows: -{% highlight ruby %} -{{ "{% highlight ruby"}} %} +{% highlight text %} +{% raw %}{% highlight ruby %}{% endraw %} def show @widget = Widget(params[:id]) respond_to do |format| @@ -83,7 +127,7 @@ def show format.json { render json: @widget } end end -{{ "{% endhighlight"}} %} +{% raw %}{% endhighlight %}{% endraw %} {% endhighlight %} And the output will look like this: @@ -100,7 +144,14 @@ end
ProTip™: Show line numbers
-

You can make code snippets include line-numbers easily, simply add the word linenos to the end of the opening highlight tag like this: {{ "{% highlight ruby linenos " }}%}.

+

+ You can make code snippets include line-numbers by adding the word + linenos to the end of the opening highlight tag like this: + {% raw %}{% highlight ruby linenos %}{% endraw %}. +

-Those basics should be more than enough to get you started writing your first posts. When you’re ready to dig into what else is possible, you might be interested in doing things like [customizing post permalinks](../permalinks) or using [custom variables](../variables) in your posts and elsewhere on your site. \ No newline at end of file +These basics should be enough to get you started writing your first posts. When +you’re ready to dig into what else is possible, you might be interested in doing +things like [customizing post permalinks](../permalinks) or using [custom +variables](../variables) in your posts and elsewhere on your site. diff --git a/site/_posts/2012-07-01-structure.md b/site/_posts/2012-07-01-structure.md index 87362b44..1a41f8b0 100644 --- a/site/_posts/2012-07-01-structure.md +++ b/site/_posts/2012-07-01-structure.md @@ -5,7 +5,13 @@ prev_section: usage next_section: configuration --- -Jekyll at its core is a text transformation engine. The concept behind the system is this: you give it text written in your favorite markup language, be that Markdown, Textile, or just plain HTML, and it churns that through a layout or series of layout files. Throughout that process you can tweak how you want the site URLs to look, what data gets displayed on the layout and more. This is all done through strictly editing files, and the web interface is the final product. +Jekyll is, at its core, a text transformation engine. The concept behind the +system is this: you give it text written in your favorite markup language, be +that Markdown, Textile, or just plain HTML, and it churns that through a layout +or series of layout files. Throughout that process you can tweak how you want +the site URLs to look, what data gets displayed in the layout and more. This is +all done through editing text files, and the static web site is the final +product. A basic Jekyll site usually looks something like this: @@ -40,7 +46,13 @@ An overview of what each of these does:

_config.yml

-

Stores configuration data. A majority of these options can be specified from the command line executable but it’s easier to throw them in here so you don’t have to remember them.

+

+ + Stores configuration data. Many of + these options can be specified from the command line executable but + it’s easier to specify them here so you don’t have to remember them. + +

@@ -48,7 +60,14 @@ An overview of what each of these does:

_includes

-

These are the partials that can be mixed and matched by your _layouts and _posts to facilitate reuse. The liquid tag {{ "{% include file.ext " }}%} can be used to include the partial in _includes/file.ext.

+

+ + These are the partials that can be mixed and matched by your layouts + and posts to facilitate reuse. The liquid tag {% raw %}{% include + file.ext %}{% endraw %} can be used to include the partial in + _includes/file.ext. + +

@@ -56,7 +75,14 @@ An overview of what each of these does:

_layouts

-

These are the templates which posts are inserted into. Layouts are chosen on a post-by-post basis in the YAML front matter, which is described in the next section. The liquid tag {{ "{{ content " }}}} is used to inject data onto the page.

+

+ + These are the templates that wrap posts. Layouts are chosen on a post- + by-post basis in the YAML front matter, + which is described in the next section. The liquid tag {% raw %}{{ + content }}{% endraw %} is used to inject content into the web page. + +

@@ -64,7 +90,15 @@ An overview of what each of these does:

_posts

-

Your dynamic content, so to speak. The format of these files is important, as named as YEAR-MONTH-DAY-title.MARKUP. The permalinks can be adjusted very flexibly for each post, but the date and markup language are determined solely by the file name.

+

+ + Your dynamic content, so to speak. The format of these files is + important, and must follow the format: YEAR-MONTH-DAY- + title.MARKUP. The permalinks can be + customized for each post, but the date and markup language are + determined solely by the file name. + +

@@ -72,7 +106,13 @@ An overview of what each of these does:

_site

-

This is where the generated site will be placed once Jekyll is done transforming it. It's probably a good idea to add this to your .gitignore file.

+

+ + This is where the generated site will be placed (by default) once + Jekyll is done transforming it. It's probably a good idea to add this + to your .gitignore file. + +

@@ -80,7 +120,15 @@ An overview of what each of these does:

index.html and other HTML, Markdown, Textile files

-

Provided that the file has a YAML Front Matter section, it will be transformed by Jekyll. The same will happen for any .html, .markdown, .md, or .textile file in your site's root directory or directories not listed above.

+

+ + Provided that the file has a YAML Front + Matter section, it will be transformed by Jekyll. The same will + happen for any .html, .markdown, + .md, or .textile file in your site's root + directory or directories not listed above. + +

@@ -88,7 +136,16 @@ An overview of what each of these does:

Other Files/Folders

-

Every other directory and file except for those listed above—such as css and images folders, favicon.ico files, and so forth—will be transferred over verbatim to the generated site. There's plenty of sites already using Jekyll if you're curious as to how they're laid out.

+

+ + Every other directory and file except for those listed above—such as + css and images folders, + favicon.ico files, and so forth—will be copied verbatim + to the generated site. There are plenty of sites + already using Jekyll if you're curious to see how they're laid + out. + +

diff --git a/site/_posts/2012-07-01-templates.md b/site/_posts/2012-07-01-templates.md index edd76a71..d6792ff6 100644 --- a/site/_posts/2012-07-01-templates.md +++ b/site/_posts/2012-07-01-templates.md @@ -5,7 +5,11 @@ prev_section: migrations next_section: permalinks --- -Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to process templates. All of the [standard Liquid tags and filters](http://wiki.github.com/shopify/liquid/liquid-for-designers) are supported, Jekyll even adds a few handy filters and tags of its own to make common tasks easier. +Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to +process templates. All of the [standard Liquid tags and +filters](http://wiki.github.com/shopify/liquid/liquid-for-designers) are +supported, Jekyll even adds a few handy filters and tags of its own to make +common tasks easier. ## Filters @@ -24,7 +28,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ site.time | date_to_xmlschema " }}}} + {% raw %}{{ site.time | date_to_xmlschema }}{% endraw %}

2008-11-17T13:07:54-08:00 @@ -38,7 +42,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ site.time | date_to_string " }}}} + {% raw %}{{ site.time | date_to_string }}{% endraw %}

17 Nov 2008 @@ -52,7 +56,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ site.time | date_to_long_string " }}}} + {% raw %}{{ site.time | date_to_long_string }}{% endraw %}

17 November 2008 @@ -66,18 +70,21 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ page.content | xml_escape " }}}} + {% raw %}{{ page.content | xml_escape }}{% endraw %}

CGI Escape

-

CGI escape a string for use in a URL. Replaces any special characters with appropriate %XX replacements.

+

+ CGI escape a string for use in a URL. Replaces any special characters + with appropriate %XX replacements. +

- {{ "{{ “foo,bar;baz?” | cgi_escape " }}}} + {% raw %}{{ “foo,bar;baz?” | cgi_escape }}{% endraw %}

foo%2Cbar%3Bbaz%3F @@ -91,7 +98,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ page.content | number_of_words " }}}} + {% raw %}{{ page.content | number_of_words }}{% endraw %}

1337 @@ -105,7 +112,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ page.tags | array_to_sentence_string " }}}} + {% raw %}{{ page.tags | array_to_sentence_string }}{% endraw %}

foo, bar, and baz @@ -119,7 +126,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ page.excerpt | textilize " }}}} + {% raw %}{{ page.excerpt | textilize }}{% endraw %}

@@ -130,7 +137,7 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr

- {{ "{{ page.excerpt | markdownify " }}}} + {% raw %}{{ page.excerpt | markdownify }}{% endraw %}

@@ -139,79 +146,89 @@ Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to pr ## Tags -### Includes (Partials) +### Includes -If you have small page fragments that you wish to include in multiple -places on your site, you can use the `include` tag. +If you have small page fragments that you wish to include in multiple places on +your site, you can use the `include` tag. {% highlight ruby %} -{{ "{% include sig.textile " }}%} +{% raw %}{% include sig.md %}{% endraw %} {% endhighlight %} -Jekyll expects all include files to be placed in an `_includes` -directory at the root of your source dir. So this will embed the -contents of `/path/to/your/site/_includes/sig.textile` into the calling -file. +Jekyll expects all include files to be placed in an `_includes` directory at the +root of your source directory. This will embed the contents of +`/_includes/sig.md` into the calling file. ### Code snippet highlighting Jekyll has built in support for syntax highlighting of [over 100 languages](http://pygments.org/languages/) thanks to -[Pygments](http://pygments.org/). In order to take advantage of this -you’ll need to have Pygments installed, and the `pygmentize` binary must -be in your `$PATH`. When you run Jekyll, make sure you run it with -[Pygments enabled](../extras). +[Pygments](http://pygments.org/). In order to take advantage of this you’ll need +to have Pygments installed, and the `pygmentize` binary must be in your `$PATH`. +When you run Jekyll, make sure you run it with [Pygments enabled](../extras). To render a code block with syntax highlighting, surround your code as follows: +{% highlight text %} +{% raw %} {% highlight ruby %} -{{ "{% highlight ruby " }}%} def foo puts 'foo' end -{{ "{% endhighlight " }}%} +{% endhighlight %} +{% endraw %} {% endhighlight %} -The argument to the `highlight` tag (`ruby` in the example above) is the language identifier. To find the appropriate identifier to use for the language you want to highlight, look for the “short name” on the [Lexers page](http://pygments.org/docs/lexers/). +The argument to the `highlight` tag (`ruby` in the example above) is the +language identifier. To find the appropriate identifier to use for the language +you want to highlight, look for the “short name” on the [Lexers +page](http://pygments.org/docs/lexers/). #### Line numbers -There is a second argument to `highlight` called `linenos` that is -optional. Including the `linenos` argument will force the highlighted -code to include line numbers. For instance, the following code block -would include line numbers next to each line: +There is a second argument to `highlight` called `linenos` that is optional. +Including the `linenos` argument will force the highlighted code to include line +numbers. For instance, the following code block would include line numbers next +to each line: -{% highlight ruby %} -{{ "{% highlight ruby linenos " }}%} +{% highlight text %} +{% raw %} +{% highlight ruby linenos %} def foo puts 'foo' end -{{ "{% endhighlight " }}%} +{% endhighlight %} +{% endraw %} {% endhighlight %} #### Stylesheets for syntax highlighting -In order for the highlighting to show up, you’ll need to include a -highlighting stylesheet. For an example stylesheet you can look at -[syntax.css](http://github.com/mojombo/tpw/tree/master/css/syntax.css). -These are the same styles as used by GitHub and you are free to use them -for your own site. If you use linenos, you might want to include an -additional CSS class definition for the `.lineno` class in `syntax.css` to -distinguish the line numbers from the highlighted code. +In order for the highlighting to show up, you’ll need to include a highlighting +stylesheet. For an example stylesheet you can look at +[syntax.css](http://github.com/mojombo/tpw/tree/master/css/syntax.css). These +are the same styles as used by GitHub and you are free to use them for your own +site. If you use `linenos`, you might want to include an additional CSS class +definition for the `.lineno` class in `syntax.css` to distinguish the line +numbers from the highlighted code. ### Post URL -If you would like to include a link to a post on your site, the `post_url` tag will generate the correct permalink URL for the post you specify. +If you would like to include a link to a post on your site, the `post_url` tag +will generate the correct permalink URL for the post you specify. -{% highlight bash %} -{{ "{% post_url 2010-07-21-name-of-post " }}%} +{% highlight text %} +{% raw %} +{% post_url 2010-07-21-name-of-post %} +{% endraw %} {% endhighlight %} There is no need to include the file extension when using the `post_url` tag. You can also use this tag to create a link to a post in Markdown as follows: -{% highlight html %} -[Name of Link]({{ "{% post_url 2010-07-21-name-of-post " }}%}) +{% highlight text %} +{% raw %} +[Name of Link]({% post_url 2010-07-21-name-of-post %}) +{% endraw %} {% endhighlight %} diff --git a/site/_posts/2012-07-01-usage.md b/site/_posts/2012-07-01-usage.md index ae1b07e1..7088f8c3 100644 --- a/site/_posts/2012-07-01-usage.md +++ b/site/_posts/2012-07-01-usage.md @@ -5,34 +5,53 @@ prev_section: installation next_section: structure --- -The Jekyll gem makes a `jekyll` executable available to you in your Terminal window. You can use this command in a number of ways: +The Jekyll gem makes a `jekyll` executable available to you in your Terminal +window. You can use this command in a number of ways: {% highlight bash %} -jekyll build -#=> The current folder will get generated into ./_site -jekyll build --destination -#=> The current folder will get generated into -jekyll build --source --destination -#=> The folder will get generated into -jekyll build --watch -#=> The current folder will get generated into ./_site, -# and watch for changes and regenerate automatically. +$ jekyll build +# => The current folder will be generated into ./_site + +$ jekyll build --destination +# => The current folder will be generated into + +$ jekyll build --source --destination +# => The folder will be generated into + +$ jekyll build --watch +# => The current folder will be generated into ./_site, +# and watch for changes and regenerate automatically. {% endhighlight %} -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. +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. {% highlight bash %} -jekyll serve -#=> A development server will run at http://localhost:4000/ -jekyll serve --watch -#=> As above, but watch for changes and regenerate automatically too. +$ jekyll serve +# => A development server will run at http://localhost:4000/ + +$ jekyll serve --watch +# => As above, but watch for changes and regenerate automatically. {% endhighlight %} -These are just some of the many [configuration options](../configuration) available. All configuration options can either be specified as flags on the command line, or alternatively (and more commonly) they can be specified in a `_config.yml` file at the root of the source directory. Jekyll will automatically configuration options from this file when run, so placing the following one line in the configuration file will mean that running `jekyll build` or `jekyll serve` would be equivalent to running `jekyll [build|serve] --source _source --destination _deploy`: +This is just a few of the available [configuration options](../configuration). +Many configuration options can either be specified as flags on the command line, +or alternatively (and more commonly) they can be specified in a `_config.yml` +file at the root of the source directory. Jekyll will automatically use the +options from this file when run. For example, if you place the following lines +in your `_config.yml` file: {% highlight yaml %} source: _source destination: _deploy {% endhighlight %} -For more about the possible configuration options, see the [configuration](../configuration) page. +Then the following two commands will be equivalent: + +{% highlight bash %} +$ jekyll build +$ jekyll build --source _source --destination _deploy +{% endhighlight %} + +For more about the possible configuration options, see the +[configuration](../configuration) page. diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index 01091474..840c8526 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -5,7 +5,11 @@ prev_section: pages next_section: migrations --- -Jekyll traverses your site looking for files to process. Any files with [YAML Front Matter](../frontmatter) are subject to processing. For each of these files, Jekyll makes a variety of data available to the pages via the [Liquid templating system](http://wiki.github.com/shopify/liquid/liquid-for-designers). The following is a reference of the available data. +Jekyll traverses your site looking for files to process. Any files with [YAML +Front Matter](../frontmatter) are subject to processing. For each of these +files, Jekyll makes a variety of data available via the [Liquid templating +system](http://wiki.github.com/shopify/liquid/liquid-for-designers). The +following is a reference of the available data. ## Global Variables @@ -19,19 +23,41 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr

site

-

Sitewide information + Configuration settings from _config.yml

+

+ + Sitewide information + configuration settings from + _config.yml. See below for details. + +

page

-

This is just the YAML Front Matter with 2 additions: url and content.

+

+ + Page specific information + the YAML Front + Matter. Custom variables set via the YAML front matter will be + available here. See below for details. + +

content

-

In layout files, this contains the content of the subview(s). This is the variable used to insert the rendered content into the layout. This is not used in post files or page files.

+

+ + In layout files, the rendered content of the Post or Page being wrapped. + Not defined in Post or Page files. + +

paginator

-

When the paginate configuration option is set, this variable becomes available for use.

+

+ + When the paginate configuration option is set, this + variable becomes available for use. See Pagination for details. + +

@@ -48,27 +74,61 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr

site.time

-

The current time (when you run the jekyll command).

+

+ + The current time (when you run the jekyll command). + +

site.posts

-

A reverse chronological list of all Posts.

+

+ + A reverse chronological list of all Posts. + +

site.related_posts

-

If the page being processed is a Post, this contains a list of up to ten related Posts. By default, these are low quality but fast to compute. For high quality but slow to compute results, run the jekyll command with the --lsi (latent semantic indexing) option.

+

+ + If the page being processed is a Post, this contains a list of up to ten + related Posts. By default, these are low quality but fast to compute. + For high quality but slow to compute results, run the + jekyll command with the --lsi (latent semantic + indexing) option. + +

site.categories.CATEGORY

-

The list of all Posts in category CATEGORY.

+

+ + The list of all Posts in category CATEGORY. + +

site.tags.TAG

-

The list of all Posts with tag TAG.

+

+ + The list of all Posts with tag TAG. + +

site.[CONFIGURATION_DATA]

-

All variables set in your _config.yml are available through the site variable. For example, if you have url: http://mysite.com in your configuration file, then in your posts and pages it can be accessed using {{ "{{ site.url " }}}}. Jekyll does not parse changes to _config.yml in watch mode, you have to restart Jekyll to see changes to variables.

+

+ + All the variables set via the command line and your + _config.yml are available through the site + variable. For example, if you have url: http://mysite.com + in your configuration file, then in your Posts and Pages it will be + stored in site.url. Jekyll does not parse changes to + _config.yml in watch mode, you must restart + Jekyll to see changes to variables. + +

@@ -85,38 +145,83 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr

page.content

-

The un-rendered content of the Page.

+

+ + The un-rendered content of the Page. + +

page.title

-

The title of the Post.

+

+ + The title of the Post. + +

page.url

-

The URL of the Post without the domain. e.g. /2008/12/14/my-post.html

+

+ + The URL of the Post without the domain. e.g. /2008/12/14/my- + post.html + +

page.date

-

The Date assigned to the Post. This can be overridden in a post’s front matter by specifying a new date/time in the format YYYY-MM-DD HH:MM:SS

+

+ + The Date assigned to the Post. This can be overridden in a Post’s front + matter by specifying a new date/time in the format YYYY-MM-DD + HH:MM:SS + +

page.id

-

An identifier unique to the Post (useful in RSS feeds). e.g. /2008/12/14/my-post

+

+ + An identifier unique to the Post (useful in RSS feeds). e.g. + /2008/12/14/my-post + +

page.categories

-

The list of categories to which this post belongs. Categories are derived from the directory structure above the _posts directory. For example, a post at /work/code/_posts/2008-12-24-closures.textile would have this field set to ['work', 'code']. These can also be specified in the YAML Front Matter.

+

+ + The list of categories to which this post belongs. Categories are + derived from the directory structure above the _posts + directory. For example, a post at + /work/code/_posts/2008-12-24-closures.md would have this + field set to ['work', 'code']. These can also be specified + in the YAML Front Matter. + +

page.tags

-

The list of tags to which this post belongs. These can be specified in the YAML Front Matter

+

+ + The list of tags to which this post belongs. These can be specified in + the YAML Front Matter + +

ProTip™: Use custom front-matter
-

Any custom front matter that you specify will be available under page. For example, if you specify custom_css: true in a page’s front matter, that value will be available in templates as page.custom_css.

+

+ + Any custom front matter that you specify will be available under + page. For example, if you specify custom_css: true + in a page’s front matter, that value will be available as + page.custom_css. + +

## Paginator @@ -131,7 +236,7 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr

paginator.per_page

-

Number of posts per page.

+

Number of Posts per page.

paginator.posts

@@ -139,11 +244,11 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr

paginator.total_posts

-

Total number of posts.

+

Total number of Posts.

paginator.total_pages

-

Total number of pages.

+

Total number of Pages.

paginator.page

@@ -162,5 +267,10 @@ Jekyll traverses your site looking for files to process. Any files with [YAML Fr
Paginator variable availability
-

These are only available in index files, however they can be located in a subdirectory, such as /blog/index.html.

+

+ + These are only available in index files, however they can be located in a + subdirectory, such as /blog/index.html. + +

diff --git a/site/css/style.css b/site/css/style.css index 85e9a079..cbe9ff12 100644 --- a/site/css/style.css +++ b/site/css/style.css @@ -406,7 +406,7 @@ pre, code { line-height: 1.8em; } -.highlight, p > pre, p > code { +.highlight, p > pre, p > code, p > nobr > code, li > code { background: #333; color: #fff; border-radius: 5px; From d6d04573dacc800691b25277559f6a9aba2605cf Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 3 Apr 2013 13:48:13 -0500 Subject: [PATCH 010/184] Remove an unnecesary word. --- site/_posts/2012-07-01-home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-home.md b/site/_posts/2012-07-01-home.md index 1d74545e..1f28b9d1 100644 --- a/site/_posts/2012-07-01-home.md +++ b/site/_posts/2012-07-01-home.md @@ -61,6 +61,6 @@ hazardous. Here’s what to look out for. If you come across anything along the way that we haven’t covered, or if you -know of a tip yourself you think others would find handy, please [file an +know of a tip you think others would find handy, please [file an issue](https://github.com/mojombo/jekyll/issues/new) and we’ll see about including it in this guide. From bdcc50d3c7ef9a5c0d3ce500eded4a0c431171c1 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 3 Apr 2013 14:06:38 -0500 Subject: [PATCH 011/184] Fix up a few places where words were missing. This makes the text sound better when I read it out loud. --- site/_posts/2012-07-01-migrations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index 38c61d81..259c949f 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -50,7 +50,7 @@ Where IMPORTER is the name of the specific importer. ### Wordpress export files If hpricot is not already installed, you will need to run `gem install hpricot`. -Next, export your blog using the Wordpress export utility. Assuming that +Next, export your blog using the Wordpress export utility. Assuming that the exported file is saved as `wordpress.xml`, here is the command you need to run: {% highlight bash %} @@ -72,7 +72,7 @@ $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; Jekyll::WordPress.process("database", "user", "pass")' {% endhighlight %} -If you are using Webfaction and have to set an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), make sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on localhost and `127.0.0.1` not being equivalent in its authentication system: +If you are using Webfaction and have to set up an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on localhost and `127.0.0.1` not being equivalent in its authentication system: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; From 3b39a2a00cd28d7d04e86c4cd1b0bddb5afd75f8 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 3 Apr 2013 14:09:00 -0500 Subject: [PATCH 012/184] =?UTF-8?q?Highlight=20=E2=80=9Clocalhost=E2=80=9D?= =?UTF-8?q?=20as=20code=20in=20the=20migration=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/_posts/2012-07-01-migrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index 259c949f..3ab04bde 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -72,7 +72,7 @@ $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; Jekyll::WordPress.process("database", "user", "pass")' {% endhighlight %} -If you are using Webfaction and have to set up an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on localhost and `127.0.0.1` not being equivalent in its authentication system: +If you are using Webfaction and have to set up an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on `localhost` and `127.0.0.1` not being equivalent in its authentication system: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; From 8316e1da4a16660d03395b3f163811899d529d63 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 3 Apr 2013 14:10:24 -0500 Subject: [PATCH 013/184] Add a URL for Drupal --- site/_posts/2012-07-01-migrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index 3ab04bde..e4d85dea 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -89,7 +89,7 @@ While the above methods work, they do not import much of the metadata that is us ## Drupal -If you’re migrating from [Drupal](), there is [a migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb) for you too: +If you’re migrating from [Drupal](http://drupal.org), there is [a migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb) for you too: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/drupal"; From 608088105c8fffa38b841d1198a6e06a21a1dad3 Mon Sep 17 00:00:00 2001 From: Tom Bell Date: Thu, 4 Apr 2013 10:09:11 +0200 Subject: [PATCH 014/184] Remove pygments as a dependency Pygments is bundled in pygments.rb it's no longer required to be installed by the user. --- README.textile | 1 - 1 file changed, 1 deletion(-) diff --git a/README.textile b/README.textile index 759401af..cc8fcc3a 100644 --- a/README.textile +++ b/README.textile @@ -31,7 +31,6 @@ h2. Runtime Dependencies * Kramdown: Markdown-superset converter (Ruby) * Liquid: Templating system (Ruby) * Maruku: Default markdown engine (Ruby) -* Pygments: Syntax highlighting (Python) h2. Developer Dependencies From 28097a9ebb321a6830e6a2243c519d8867fffa64 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 4 Apr 2013 16:14:54 +0200 Subject: [PATCH 015/184] Updated version to 1.0.0.beta3. --- jekyll.gemspec | 6 ++++-- lib/jekyll.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index ac5c46e0..0c1b771e 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |s| s.rubygems_version = '1.3.5' s.name = 'jekyll' - s.version = '1.0.0.beta2' + s.version = '1.0.0.beta3' s.license = 'MIT' - s.date = '2013-03-19' + s.date = '2013-04-04' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -202,6 +202,8 @@ Gem::Specification.new do |s| test/source/foo/_posts/bar/2008-12-12-topical-post.textile test/source/index.html test/source/sitemap.xml + test/source/symlink-test/symlinked-dir + test/source/symlink-test/symlinked-file test/source/win/_posts/2009-05-24-yaml-linebreak.markdown test/source/z_category/_posts/2008-9-23-categories.textile test/suite.rb diff --git a/lib/jekyll.rb b/lib/jekyll.rb index b0401b99..831197b9 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -52,7 +52,7 @@ require_all 'jekyll/tags' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '1.0.0.beta2' + VERSION = '1.0.0.beta3' # Default options. Overriden by values in _config.yml. # Strings rather than symbols are used for compatability with YAML. From 464ea6e90c219420674fc67ef5de27488563134c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 5 Apr 2013 18:45:50 +0200 Subject: [PATCH 017/184] Update history to reflect merge of #890 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 9ad68d66..fd20ec8d 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,7 @@ * 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) * Minor Enhancements + * 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) From 7376d66af244d315f9ac2f7991376687d5775193 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 5 Apr 2013 19:04:10 +0200 Subject: [PATCH 018/184] Upgrade pygments.rb to 0.4.2. Fixes #927 --- History.txt | 1 + jekyll.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index fd20ec8d..015fe83b 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,7 @@ * 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) * Minor Enhancements + * 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) diff --git a/jekyll.gemspec b/jekyll.gemspec index 0c1b771e..b9d23a11 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('directory_watcher', "~> 1.4.1") s.add_runtime_dependency('maruku', "~> 0.5") s.add_runtime_dependency('kramdown', "~> 0.14") - s.add_runtime_dependency('pygments.rb', "~> 0.3.2") + s.add_runtime_dependency('pygments.rb', "~> 0.4.2") s.add_runtime_dependency('commander', "~> 4.1.3") s.add_runtime_dependency('safe_yaml', "~> 0.7.0") From ea753130e69dd3346e5cfe17c312442c254f6c04 Mon Sep 17 00:00:00 2001 From: Daniel Driver Date: Sat, 6 Apr 2013 08:17:02 -0400 Subject: [PATCH 019/184] add ordinal date permalink style (/YYYY/DDD/slug.html) --- lib/jekyll/post.rb | 3 +++ test/test_post.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 42350643..50fd983c 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -146,6 +146,8 @@ module Jekyll "/:categories/:title.html" when :date "/:categories/:year/:month/:day/:title.html" + when :ordinal + "/:categories/:year/:y_day/:title.html" else self.site.permalink_style.to_s end @@ -170,6 +172,7 @@ module Jekyll "i_month" => date.strftime("%m").to_i.to_s, "categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'), "short_month" => date.strftime("%b"), + "y_day" => date.strftime("%j"), "output_ext" => self.output_ext }.inject(template) { |result, token| result.gsub(/:#{Regexp.escape token.first}/, token.last) diff --git a/test/test_post.rb b/test/test_post.rb index 8a9721e4..b5b082a3 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -214,6 +214,18 @@ class TestPost < Test::Unit::TestCase end end + context "with ordinal style" do + setup do + @post.site.permalink_style = :ordinal + @post.process(@fake_file) + end + + should "process the url correctly" do + assert_equal "/:categories/:year/:y_day/:title.html", @post.template + assert_equal "/2008/253/foo-bar.html", @post.url + end + end + context "with custom date permalink" do setup do @post.site.permalink_style = '/:categories/:year/:i_month/:i_day/:title/' From 565e815354a3b275a96790cd3eb48b1e4fb14538 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sat, 6 Apr 2013 23:14:03 -0700 Subject: [PATCH 020/184] Fixes for @parkr comments. --- site/_posts/2012-07-01-contributing.md | 8 ++++---- site/_posts/2012-07-01-structure.md | 19 +++++++++++-------- site/_posts/2012-07-01-variables.md | 8 ++++---- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/site/_posts/2012-07-01-contributing.md b/site/_posts/2012-07-01-contributing.md index 733d61b1..dcab4ffa 100644 --- a/site/_posts/2012-07-01-contributing.md +++ b/site/_posts/2012-07-01-contributing.md @@ -17,9 +17,9 @@ following in mind: where appropriate. Also, whipping up some documentation in your fork's wiki would be appreciated, and once merged it will be transferred over to the main wiki. -* If your contribution changes any Jekyll behavior, make sure to update the - documentation. It lives in `site/_posts`. If the docs are missing information, - please feel free to add it in. Great docs make a great project! +* If your contribution adds or changes any Jekyll behavior, make sure to update + the documentation. It lives in `site/_posts`. 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. @@ -35,7 +35,7 @@ Test Dependencies ----------------- To run the test suite and build the gem you'll need to install Jekyll's -dependencies. Jekyll uses Bundler, so a quick run of the bundle command and +dependencies. Jekyll uses Bundler, so a quick run of the `bundle` command and you're all set! {% highlight bash %} diff --git a/site/_posts/2012-07-01-structure.md b/site/_posts/2012-07-01-structure.md index 1a41f8b0..4401373d 100644 --- a/site/_posts/2012-07-01-structure.md +++ b/site/_posts/2012-07-01-structure.md @@ -63,8 +63,9 @@ An overview of what each of these does:

These are the partials that can be mixed and matched by your layouts - and posts to facilitate reuse. The liquid tag {% raw %}{% include - file.ext %}{% endraw %} can be used to include the partial in + and posts to facilitate reuse. The liquid tag + {% raw %}{% include file.ext %}{% endraw %} + can be used to include the partial in _includes/file.ext.

@@ -79,8 +80,9 @@ An overview of what each of these does: These are the templates that wrap posts. Layouts are chosen on a post- by-post basis in the YAML front matter, - which is described in the next section. The liquid tag {% raw %}{{ - content }}{% endraw %} is used to inject content into the web page. + which is described in the next section. The liquid tag + {% raw %}{{ content }}{% endraw %} + is used to inject content into the web page.

@@ -93,10 +95,11 @@ An overview of what each of these does:

Your dynamic content, so to speak. The format of these files is - important, and must follow the format: YEAR-MONTH-DAY- - title.MARKUP. The permalinks can be - customized for each post, but the date and markup language are - determined solely by the file name. + important, and must follow the format: + YEAR-MONTH-DAY-title.MARKUP. + The permalinks can be customized for each + post, but the date and markup language are determined solely by the + file name.

diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index 840c8526..cbda02d4 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -163,8 +163,8 @@ following is a reference of the available data.

page.url

- The URL of the Post without the domain. e.g. /2008/12/14/my- - post.html + The URL of the Post without the domain. e.g. + /2008/12/14/my-post.html

@@ -173,8 +173,8 @@ following is a reference of the available data.

The Date assigned to the Post. This can be overridden in a Post’s front - matter by specifying a new date/time in the format YYYY-MM-DD - HH:MM:SS + matter by specifying a new date/time in the format + YYYY-MM-DD HH:MM:SS

From e427e8278529afd80b81f9c6df5f166caaaea7ba Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 7 Apr 2013 11:39:43 -0700 Subject: [PATCH 021/184] Clarify config option docs for problem in #858. --- site/_posts/2012-07-01-configuration.md | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index 3248aecf..30e20f8d 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -35,8 +35,8 @@ class="flag">flags (specified on the command-line) that control them.

Change the directory where Jekyll will read files

-

source: [string]

-

-s, --source [source]

+

source: DIR

+

-s, --source DIR

@@ -45,8 +45,8 @@ class="flag">flags (specified on the command-line) that control them.

Change the directory where Jekyll will write files

-

destination: [string]

-

-d, --destination [destination]

+

destination: DIR

+

-d, --destination DIR

@@ -55,7 +55,7 @@ class="flag">flags (specified on the command-line) that control them.

Disable custom plugins.

-

safe: [boolean]

+

safe: BOOL

--safe

@@ -65,7 +65,7 @@ class="flag">flags (specified on the command-line) that control them.

Exclude directories and/or files from the conversion

-

exclude: [dir1, file1, dir2]

+

exclude: [DIR, FILE, ...]

@@ -78,7 +78,7 @@ class="flag">flags (specified on the command-line) that control them.

-

include: [dir1, file1, dir2]

+

include: [DIR, FILE, ...]

@@ -109,7 +109,7 @@ class="flag">flags (specified on the command-line) that control them.

Specify a config file. Overrides settings in _config.yml

-

--config [FILE]

+

--config FILE

@@ -127,7 +127,7 @@ class="flag">flags (specified on the command-line) that control them.

Publish posts with a future date.

-

future: [boolean]

+

future: BOOL

--future

@@ -137,7 +137,7 @@ class="flag">flags (specified on the command-line) that control them.

Produce an index for related posts.

-

lsi: [boolean]

+

lsi: BOOL

--lsi

@@ -147,8 +147,8 @@ class="flag">flags (specified on the command-line) that control them.

Limit the number of posts to parse and publish.

-

limit_posts: [max_posts]

-

--limit_posts [max_posts]

+

limit_posts: NUM

+

--limit_posts NUM

@@ -174,8 +174,8 @@ before your site is served.

Listen on the given port.

-

port: [integer]

-

--port [port]

+

port: PORT

+

--port PORT

@@ -184,8 +184,8 @@ before your site is served.

Listen at the given hostname.

-

host: [string]

-

--host [hostname]

+

host: HOSTNAME

+

--host HOSTNAME

@@ -194,8 +194,8 @@ before your site is served.

Serve website with the given base URL

-

baseurl: [BASE_URL]

-

--baseurl [url]

+

baseurl: URL

+

--baseurl URL

From ccf9d19aeafba5edfc8fef13a581ccccf59a1db5 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 21:44:49 +0200 Subject: [PATCH 022/184] Update history to reflect merge of #892. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 015fe83b..5f7cef9f 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,7 @@ * 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) * Minor Enhancements + * 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) From b1c0f90d36e73af72d31325056e5ea857470d8d7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 21:56:28 +0200 Subject: [PATCH 023/184] Update history to reflect merge of #875 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 5f7cef9f..182f6c0b 100644 --- a/History.txt +++ b/History.txt @@ -33,6 +33,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From b5d1b4e34415abe2ab6da0882d4ac138ceb700b7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 22:22:05 +0200 Subject: [PATCH 024/184] Update history to reflect merge of #918 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 182f6c0b..4fb1ecc6 100644 --- a/History.txt +++ b/History.txt @@ -52,6 +52,7 @@ * Add SVG support to Jekyll/WEBrick. (#407, #406) * Prevent custom destination from causing continuous regen on watch (#528, #820, #862) * Site Enhancements + * 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 From ae462afb76b851e3686de5824eca392db867837e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 22:29:30 +0200 Subject: [PATCH 025/184] Backwards-compatibility for 'auto'. Fixes #821. --- lib/jekyll.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 831197b9..b7c711e8 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -152,6 +152,13 @@ module Jekyll config = {} end + # Provide backwards-compatibility + if config['auto'] + $stderr.puts "Deprecation: ".rjust(20) + "'auto' has been changed to " + + "'watch'. Please update your configuration to use 'watch'." + config['watch'] = config['auto'] + end + # Merge DEFAULTS < _config.yml < override Jekyll::DEFAULTS.deep_merge(config).deep_merge(override) end From 5fe31bcbcad8d7b99268352b5daea6edeff712a4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 22:39:53 +0200 Subject: [PATCH 026/184] Update history to reflect merge of #934. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 4fb1ecc6..ff412b9f 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,7 @@ * 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) * Minor Enhancements + * 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) From 1526aa3b1dac916bf7189dd0c7df6eb37188d7f8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 22:47:55 +0200 Subject: [PATCH 027/184] Fix cascade problem with site.baseurl. Fixes #931. --- bin/jekyll | 1 - lib/jekyll.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 5d3b229b..ccf5b5ef 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -77,7 +77,6 @@ command :serve do |c| c.action do |args, options| options.default :port => '4000', :host => '0.0.0.0', - :baseurl => '/', :serving => true options = normalize_options(options.__hash__) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index b7c711e8..8d10746c 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -68,7 +68,7 @@ module Jekyll 'markdown' => 'maruku', 'permalink' => 'date', - 'baseurl' => '', + 'baseurl' => '/', 'include' => ['.htaccess'], 'paginate_path' => 'page:num', From 90366941a292a355910beb12a6087bd93bbc9d45 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 22:53:56 +0200 Subject: [PATCH 028/184] Update history to reflect merge of #928 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index ff412b9f..4a8c8c09 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * 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 * Backwards compatibility for 'auto' (#821, #934) * Added date_to_rfc822 used on RSS feeds (#892) From dbb3dd3a1a12d42cbb57cdd7e1583c1a13cf9fed Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 7 Apr 2013 23:55:04 +0200 Subject: [PATCH 029/184] Move port and host configuration options to Jekyll::DEFAULTS so Commander doesn't override in serving awkwardly. --- bin/jekyll | 4 +--- lib/jekyll.rb | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index ccf5b5ef..1c3324ba 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -75,9 +75,7 @@ command :serve do |c| c.option '-b', '--baseurl [URL]', 'Base URL' c.action do |args, options| - options.default :port => '4000', - :host => '0.0.0.0', - :serving => true + options.default :serving => true options = normalize_options(options.__hash__) options = Jekyll.configuration(options) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 8d10746c..19ad0373 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -64,7 +64,7 @@ module Jekyll 'keep_files' => ['.git','.svn'], 'future' => true, # remove and make true just default - 'pygments' => true, # remove and make true just default + 'pygments' => true, # remove and make true just default 'markdown' => 'maruku', 'permalink' => 'date', @@ -75,6 +75,9 @@ module Jekyll 'markdown_ext' => 'markdown,mkd,mkdn,md', 'textile_ext' => 'textile', + 'port' => '4000', + 'host' => '0.0.0.0', + 'excerpt_separator' => "\n\n", 'maruku' => { From 7d71650b4c752a6b154cd5fffee469b8d89ffdb8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 8 Apr 2013 00:20:59 +0200 Subject: [PATCH 030/184] Update history to reflect merge of #935 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 4a8c8c09..4a058d36 100644 --- a/History.txt +++ b/History.txt @@ -35,6 +35,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From fbbcf78a99862c15e77ef277dfa061f67b0f9826 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 7 Apr 2013 15:31:40 -0700 Subject: [PATCH 031/184] Update GH Pages docs for github.io change. --- site/_posts/2012-07-01-github-pages.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/site/_posts/2012-07-01-github-pages.md b/site/_posts/2012-07-01-github-pages.md index 5382b4d0..67f49403 100644 --- a/site/_posts/2012-07-01-github-pages.md +++ b/site/_posts/2012-07-01-github-pages.md @@ -6,10 +6,10 @@ next_section: deployment-methods --- [GitHub Pages](https://pages.github.com) are public web pages for users, -organizations, and repositories, that are freely hosted on -[GitHub](https://github.com/). GitHub Pages are powered by Jekyll behind the -scenes, so in addition to supporting regular HTML content, they’re also a great -way to host your Jekyll-powered website for free. +organizations, and repositories, that are freely hosted on GitHub's +[github.io]() domain or on a custom domain name of your choice. GitHub Pages are +powered by Jekyll behind the scenes, so in addition to supporting regular HTML +content, they’re also a great way to host your Jekyll-powered website for free. ## Deploying Jekyll to GitHub Pages @@ -23,8 +23,8 @@ few minor details. User and organization pages live in a special GitHub repository dedicated to only the GitHub Pages files. This repository must be named after the account name. For example, [@mojombo’s user page -repository](https://github.com/mojombo/mojombo.github.com) has the name -`mojombo.github.com`. +repository](https://github.com/mojombo/mojombo.github.io) has the name +`mojombo.github.io`. Content from the `master` branch of your repository will be used to build and publish the GitHub Pages site, so make sure your Jekyll site is stored there. @@ -33,7 +33,7 @@ publish the GitHub Pages site, so make sure your Jekyll site is stored there.
Custom domains do not affect repository names

GitHub Pages are initially configured to live under the - username.github.com subdomain, which is why repositories must + username.github.io subdomain, which is why repositories must be named this way even if a custom domain is being used.

@@ -44,7 +44,7 @@ Unlike user and organization Pages, Project Pages are kept in the same repository as the project they are for, except that the website content is stored in a specially named `gh-pages` branch. The content of this branch will be rendered using Jekyll, and the output will become available under a subpath -of your user pages subdomain, such as `username.github.com/project` (unless a +of your user pages subdomain, such as `username.github.io/project` (unless a custom domain is specified—see below). The Jekyll project repository itself is a perfect example of this branch From 439278fc2c6a43fced8c622f916f7007f54a3b32 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Mon, 8 Apr 2013 13:25:47 +0200 Subject: [PATCH 032/184] exclude cucumber 1.2.4 --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index b9d23a11..205b03b0 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_development_dependency('redgreen', "~> 1.2") s.add_development_dependency('shoulda', "~> 3.3.2") s.add_development_dependency('rr', "~> 1.0") - s.add_development_dependency('cucumber', "~> 1.2.1") + s.add_development_dependency('cucumber', "~> 1.2.1", '!= 1.2.4') s.add_development_dependency('RedCloth', "~> 4.2") s.add_development_dependency('rdiscount', "~> 1.6") s.add_development_dependency('redcarpet', "~> 2.2.2") From 59040b84db89bb47028970e6feb2747b5079d619 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 8 Apr 2013 15:41:34 +0200 Subject: [PATCH 033/184] Update history to reflect merge of #938 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 4a058d36..00619164 100644 --- a/History.txt +++ b/History.txt @@ -59,6 +59,7 @@ * 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) From 6dcf3ad2658835d6d07a2a59420ced8da921315d Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Sun, 7 Apr 2013 22:22:49 -0300 Subject: [PATCH 034/184] Link to LICENSE --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index cc8fcc3a..9eb49a22 100644 --- a/README.textile +++ b/README.textile @@ -42,4 +42,4 @@ h2. Developer Dependencies h2. License -See LICENSE. +See "LICENSE":https://github.com/mojombo/jekyll/blob/master/LICENSE. From c9b03991f8ed5b103de02240846703230b6aed1f Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Mon, 8 Apr 2013 17:08:17 -0400 Subject: [PATCH 035/184] Remove superfluous references to File#close --- features/step_definitions/jekyll_steps.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 1b0eb519..05629e77 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -21,28 +21,24 @@ Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do | --- #{text} EOF - f.close end end Given /^I have an? "(.*)" file that contains "(.*)"$/ do |file, text| File.open(file, 'w') do |f| f.write(text) - f.close end end Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text| File.open(File.join('_layouts', layout + '.html'), 'w') do |f| f.write(text) - f.close end end Given /^I have a (.*) theme that contains "(.*)"$/ do |layout, text| File.open(File.join('_theme', layout + '.html'), 'w') do |f| f.write(text) - f.close end end @@ -87,7 +83,6 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire --- #{content} EOF - f.close end end end @@ -95,7 +90,6 @@ end Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value| File.open('_config.yml', 'w') do |f| f.write("#{key}: #{value}\n") - f.close end end @@ -104,7 +98,6 @@ Given /^I have a configuration file with:$/ do |table| table.hashes.each do |row| f.write("#{row["key"]}: #{row["value"]}\n") end - f.close end end @@ -114,7 +107,6 @@ Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table| table.hashes.each do |row| f.write("- #{row["value"]}\n") end - f.close end end From b10939912f9c6427161d77d8553c2e0d6fcc27b0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 19:48:41 +0200 Subject: [PATCH 036/184] Add paginator.previous_page_path and paginator.next_page_path --- lib/jekyll/generators/pagination.rb | 38 +++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index 70d63c88..bd797e4f 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -37,7 +37,7 @@ module Jekyll if num_page > 1 newpage = Page.new(site, site.source, page.dir, page.name) newpage.pager = pager - newpage.dir = File.join(page.dir, paginate_path(site, num_page)) + newpage.dir = File.join(page.dir, Pager.paginate_path(site.config, num_page)) site.pages << newpage else page.pager = pager @@ -45,16 +45,12 @@ module Jekyll end end - private - def paginate_path(site, num_page) - format = site.config['paginate_path'] - format.sub(':num', num_page.to_s) - end end end class Pager - attr_reader :page, :per_page, :posts, :total_posts, :total_pages, :previous_page, :next_page + attr_reader :page, :per_page, :posts, :total_posts, :total_pages, + :previous_page, :previous_page_path, :next_page, :next_page_path # Calculate the number of pages. # @@ -76,6 +72,28 @@ module Jekyll file == 'index.html' && !config['paginate'].nil? end + # Static: Return the pagination path of the page + # + # site_config - the site config + # num_page - the pagination page number + # + # Returns the pagination path as a string + def self.paginate_path(site_config, num_page) + return "/" if num_page.nil? || num_page <= 1 + format = site_config['paginate_path'] + format.sub(':num', num_page.to_s) + end + + def self.paginate_url(site_config, num_page) + return "" if num_page.nil? + path = paginate_path(site_config, num_page) + if path[0..1] == "/" + path + else + "/#{path}" + end + end + # Initialize a new Pager. # # config - The Hash configuration of the site. @@ -98,7 +116,9 @@ module Jekyll @total_posts = all_posts.size @posts = all_posts[init..offset] @previous_page = @page != 1 ? @page - 1 : nil + @previous_page_path = Pager.paginate_url(config, @previous_page) @next_page = @page != @total_pages ? @page + 1 : nil + @next_page_path = Pager.paginate_url(config, @next_page) end # Convert this Pager's data to a Hash suitable for use by Liquid. @@ -112,7 +132,9 @@ module Jekyll 'total_posts' => total_posts, 'total_pages' => total_pages, 'previous_page' => previous_page, - 'next_page' => next_page + 'previous_page_path' => previous_page_path, + 'next_page' => next_page, + 'next_page_path' => next_page_path } end end From c0f50f2c7876741bbc419d07eaf12f1ef5d1c6c4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 19:51:26 +0200 Subject: [PATCH 037/184] Update docs to use paginator.{next,previous}_page_path --- site/_posts/2012-07-01-pagination.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index b470c370..8f3f7b4d 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -98,7 +98,7 @@ page with links to all but the current page. {% if paginator.previous_page == 1 %} Previous {% else %} - Previous + Previous {% endif %}

{% else %} @@ -129,7 +129,7 @@ page with links to all but the current page. {% if paginator.next_page %}

- Next + Next

{% else %}

From 102e29899fd1a58de5d82759bd3a1d7b6794c0a8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 20:11:12 +0200 Subject: [PATCH 038/184] Add some docs regarding what the paginator exposes in liquid --- site/_posts/2012-07-01-pagination.md | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index 8f3f7b4d..e412e697 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -31,6 +31,58 @@ paginate: 5 The number should be the maximum number of Posts you’d like to be displayed per- page in the generated site. +## Liquid Attributes Available + +The pagination plugin exposes the `paginator` liquid object with the following +attributes: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeDescription

page

current page number

per_page

number of posts per page

posts

a list of posts for the current page

total_posts

total number of posts in the site

total_pages

number of pagination pages

previous_page

page number of the previous pagination page

previous_page_path

path (including leading "/") of previous pagination page

next_page

page number of the next pagination page

next_page_path

path (including leading "/") of next pagination page

+

Pagination does not support tags or categories

Pagination pages through every post in the posts variable regardless of variables defined in the YAML Front Matter of each. It does not currently allow paging over groups of posts linked by a common tag or category.

From e5bf5aa09e1ec5d554661ee1a7066abc276bdc93 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 20:25:33 +0200 Subject: [PATCH 039/184] Documentation for Pager.paginate_url --- lib/jekyll/generators/pagination.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index bd797e4f..1a239ce9 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -84,6 +84,12 @@ module Jekyll format.sub(':num', num_page.to_s) end + # Static: Return the URL for the pagination path of the page + # + # site_config - the site config + # num_page - the pagination page number + # + # Returns the the absolute URL for the pagination page def self.paginate_url(site_config, num_page) return "" if num_page.nil? path = paginate_path(site_config, num_page) From b9e7a31ab876c37527a9d8ac5c8fa506ffa9274d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 20:25:43 +0200 Subject: [PATCH 040/184] Return nil if num_page is nil --- lib/jekyll/generators/pagination.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index 1a239ce9..ca5eb9ed 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -91,7 +91,7 @@ module Jekyll # # Returns the the absolute URL for the pagination page def self.paginate_url(site_config, num_page) - return "" if num_page.nil? + return nil if num_page.nil? path = paginate_path(site_config, num_page) if path[0..1] == "/" path From 9c296f04a9b8823d05a119f39629c1488b4651d0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 20:26:08 +0200 Subject: [PATCH 041/184] Join the path with baseurl in Pager.paginate_url --- lib/jekyll/generators/pagination.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index ca5eb9ed..59a0d539 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -93,11 +93,7 @@ module Jekyll def self.paginate_url(site_config, num_page) return nil if num_page.nil? path = paginate_path(site_config, num_page) - if path[0..1] == "/" - path - else - "/#{path}" - end + File.join(site_config["baseurl"], path) end # Initialize a new Pager. From c9a8a1b29f060445284e07df2f4dbaabe18e3d21 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 20:29:48 +0200 Subject: [PATCH 042/184] A bunch of pagination attributes will be nil if the subsequent/previous pages don't exist --- site/_posts/2012-07-01-pagination.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index e412e697..4706a2cc 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -66,19 +66,39 @@ attributes:

previous_page

-

page number of the previous pagination page

+ +

+ page number of the previous pagination page, + or nil if no previous page exists +

+

previous_page_path

-

path (including leading "/") of previous pagination page

+ +

+ path (including leading "/") of previous pagination page, + or nil if no previous page exists +

+

next_page

-

page number of the next pagination page

+ +

+ page number of the next pagination page, + or nil if no subsequent page exists +

+

next_page_path

-

path (including leading "/") of next pagination page

+ +

+ path (including leading "/") of next pagination page, + or nil if no subsequent page exists +

+ From 88f92729bc2fa30cf8ab7d842d4f7a4f30fd8c76 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 21:00:27 +0200 Subject: [PATCH 043/184] Use paginate_path and don't help too much --- lib/jekyll/generators/pagination.rb | 18 +++--------------- site/_posts/2012-07-01-pagination.md | 4 ++-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index 59a0d539..71e27fba 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -79,23 +79,11 @@ module Jekyll # # Returns the pagination path as a string def self.paginate_path(site_config, num_page) - return "/" if num_page.nil? || num_page <= 1 + return nil if num_page.nil? || num_page <= 1 format = site_config['paginate_path'] format.sub(':num', num_page.to_s) end - # Static: Return the URL for the pagination path of the page - # - # site_config - the site config - # num_page - the pagination page number - # - # Returns the the absolute URL for the pagination page - def self.paginate_url(site_config, num_page) - return nil if num_page.nil? - path = paginate_path(site_config, num_page) - File.join(site_config["baseurl"], path) - end - # Initialize a new Pager. # # config - The Hash configuration of the site. @@ -118,9 +106,9 @@ module Jekyll @total_posts = all_posts.size @posts = all_posts[init..offset] @previous_page = @page != 1 ? @page - 1 : nil - @previous_page_path = Pager.paginate_url(config, @previous_page) + @previous_page_path = Pager.paginate_path(config, @previous_page) @next_page = @page != @total_pages ? @page + 1 : nil - @next_page_path = Pager.paginate_url(config, @next_page) + @next_page_path = Pager.paginate_path(config, @next_page) end # Convert this Pager's data to a Hash suitable for use by Liquid. diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index 4706a2cc..f1710d99 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -77,7 +77,7 @@ attributes:

previous_page_path

- path (including leading "/") of previous pagination page, + path of previous pagination page, or nil if no previous page exists

@@ -95,7 +95,7 @@ attributes:

next_page_path

- path (including leading "/") of next pagination page, + path of next pagination page, or nil if no subsequent page exists

From a715a8970b8bd2f1abbfc634bef73785d9ab7722 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 21:25:16 +0200 Subject: [PATCH 044/184] Update history to reflect merge of #942 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 00619164..8d6ab32a 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 1319b823f8dd2ee8155c63653c4d029f4b7c5d71 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 9 Apr 2013 21:31:23 +0200 Subject: [PATCH 045/184] Release 1.0.0.beta4 --- jekyll.gemspec | 5 +++-- lib/jekyll.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 205b03b0..4bff92df 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |s| s.rubygems_version = '1.3.5' s.name = 'jekyll' - s.version = '1.0.0.beta3' + s.version = '1.0.0.beta4' s.license = 'MIT' - s.date = '2013-04-04' + s.date = '2013-04-09' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -192,6 +192,7 @@ Gem::Specification.new do |s| test/source/_posts/2013-01-02-post-excerpt.markdown test/source/_posts/2013-01-12-nil-layout.textile test/source/_posts/2013-01-12-no-layout.textile + test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep test/source/about.html test/source/category/_posts/2008-9-23-categories.textile test/source/contacts.html diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 19ad0373..ab35a3b2 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -52,7 +52,7 @@ require_all 'jekyll/tags' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '1.0.0.beta3' + VERSION = '1.0.0.beta4' # Default options. Overriden by values in _config.yml. # Strings rather than symbols are used for compatability with YAML. From 8446d6e8adb2fa5f42006347a9c464997671fcff Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 10 Apr 2013 01:58:06 +0200 Subject: [PATCH 046/184] Update history to reflect merge of #413. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 8d6ab32a..b886d5fb 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From df1efeff25e60c3b7852fe92f7109e4b2d5f1aa9 Mon Sep 17 00:00:00 2001 From: Alex Kessinger Date: Wed, 10 Apr 2013 10:19:48 -0700 Subject: [PATCH 047/184] Accept multiple config files from command line Parse config as if it can contain multiple references to config files. This allows you to pass in multiple config files from the command line Helps with issues #514 and #703 --- lib/jekyll.rb | 16 +++++++++++----- test/test_configuration.rb | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index ab35a3b2..a1f0cdfd 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -136,13 +136,19 @@ module Jekyll source = override['source'] || Jekyll::DEFAULTS['source'] # Get configuration from /_config.yml or / - config_file = override.delete('config') - config_file = File.join(source, "_config.yml") if config_file.to_s.empty? + config_files = override.delete('config') + config_files = File.join(source, "_config.yml") if config_files.to_s.empty? + # If config is a list of space separate config files + config_files = config_files.split(' ') begin - config = YAML.safe_load_file(config_file) - raise "Configuration file: (INVALID) #{config_file}" if !config.is_a?(Hash) - $stdout.puts "Configuration file: #{config_file}" + config = {} + config_files.each do |config_file| + next_config = YAML.safe_load_file(config_file) + raise "Configuration file: (INVALID) #{config_file}" if !next_config.is_a?(Hash) + $stdout.puts "Configuration file: #{config_file}" + config = config.deep_merge(next_config) + end rescue SystemCallError # Errno:ENOENT = file not found $stderr.puts "Configuration file: none" diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 40b091de..ec42b8f5 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -46,10 +46,20 @@ class TestConfiguration < Test::Unit::TestCase assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] }) end - should "load default config if path passed is empty" do + 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($stdout).puts("Configuration file: #{@paths[:default]}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) + mock($stdout).puts("Configuration file: #{@paths[:other]}") + assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" }) + 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($stdout).puts("Configuration file: #{@paths[:default]}") + mock($stdout).puts("Configuration file: #{@paths[:other]}") + assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" }) end end end From 1e209c9bf3fcea671fcacfa01064fca40d49b21b Mon Sep 17 00:00:00 2001 From: Alex Kessinger Date: Wed, 10 Apr 2013 11:38:49 -0700 Subject: [PATCH 048/184] Upgrade --config to accept an array of files --- bin/jekyll | 4 ++-- lib/jekyll.rb | 5 +++-- test/test_configuration.rb | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 1c3324ba..79c368d8 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -44,7 +44,7 @@ command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' - c.option '--config [CONFIG_FILE]', 'Custom configuration file' + c.option '--config [CONFIG_FILE]', Array, 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' @@ -63,7 +63,7 @@ command :serve do |c| c.syntax = 'jekyll serve [options]' c.description = 'Serve your site locally' - c.option '--config [CONFIG_FILE]', 'Custom configuration file' + c.option '--config [CONFIG_FILE]', Array,'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' diff --git a/lib/jekyll.rb b/lib/jekyll.rb index a1f0cdfd..a88dedc7 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -138,8 +138,9 @@ module Jekyll # Get configuration from /_config.yml or / config_files = override.delete('config') config_files = File.join(source, "_config.yml") if config_files.to_s.empty? - # If config is a list of space separate config files - config_files = config_files.split(' ') + if not config_files.is_a? Array + config_files = [config_files] + end begin config = {} diff --git a/test/test_configuration.rb b/test/test_configuration.rb index ec42b8f5..361408d6 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -51,7 +51,7 @@ class TestConfiguration < Test::Unit::TestCase mock(YAML).safe_load_file(@paths[:other]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") mock($stdout).puts("Configuration file: #{@paths[:other]}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" }) + assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) end should "load multiple config files and last config should win" do @@ -59,7 +59,7 @@ class TestConfiguration < Test::Unit::TestCase mock(YAML).safe_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::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => "#{@paths[:default]} #{@paths[:other]}" }) + assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) end end end From 069e70d1b3dd2a21d4c36f2eecb677362b7384a9 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 14:25:47 +0200 Subject: [PATCH 049/184] do not override custom excerpt set in YAML frontmatter Fixes #933. --- lib/jekyll/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 50fd983c..2def58ed 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -80,7 +80,7 @@ module Jekyll # Returns nothing. def read_yaml(base, name) super(base, name) - self.excerpt = self.extract_excerpt + self.excerpt = self.data["excerpt"] || self.extract_excerpt self.data['layout'] = 'post' unless self.data.has_key?('layout') end From 0113fea7a1603363bc4099d5c5db1f11dfa6f7f2 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 14:26:20 +0200 Subject: [PATCH 050/184] Add tests for using custom excerpt --- .../_posts/2013-04-11-custom-excerpt.markdown | 8 ++++++++ test/test_generated_site.rb | 2 +- test/test_post.rb | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/source/_posts/2013-04-11-custom-excerpt.markdown diff --git a/test/source/_posts/2013-04-11-custom-excerpt.markdown b/test/source/_posts/2013-04-11-custom-excerpt.markdown new file mode 100644 index 00000000..7212704e --- /dev/null +++ b/test/source/_posts/2013-04-11-custom-excerpt.markdown @@ -0,0 +1,8 @@ +--- +layout: ~ +excerpt: 'I can set a custom excerpt with *markdown*' +--- + +This is not my excerpt. + +Neither is this. diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index abda0ba5..56413466 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase end should "ensure post count is as expected" do - assert_equal 31, @site.posts.size + assert_equal 32, @site.posts.size end should "insert site.posts into the index" do diff --git a/test/test_post.rb b/test/test_post.rb index b5b082a3..dfba0758 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -320,6 +320,21 @@ class TestPost < Test::Unit::TestCase assert !@post.excerpt.include?("---"), "does not contains separator" end end + + context "with custom excerpt" do + setup do + file = "2013-04-11-custom-excerpt.markdown" + @post.process(file) + @post.read_yaml(@source, file) + @post.transform + end + + should "use custom excerpt" do + assert_equal("

I can set a custom excerpt with markdown

", @post.excerpt) + end + + end + end end From 2792e1e427b5aa75da1cae58285a4a17f7a45b47 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 16:51:48 +0200 Subject: [PATCH 051/184] fix indentation of test --- test/test_post.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_post.rb b/test/test_post.rb index dfba0758..f8ba8392 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -323,17 +323,17 @@ class TestPost < Test::Unit::TestCase context "with custom excerpt" do setup do - file = "2013-04-11-custom-excerpt.markdown" - @post.process(file) + file = "2013-04-11-custom-excerpt.markdown" + @post.process(file) @post.read_yaml(@source, file) @post.transform - end + end should "use custom excerpt" do - assert_equal("

I can set a custom excerpt with markdown

", @post.excerpt) - end + assert_equal("

I can set a custom excerpt with markdown

", @post.excerpt) + end - end + end end end From 654d598fcf8492a4ed4a62cc4d9e77afe6e799d7 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 17:13:15 +0200 Subject: [PATCH 052/184] rework excerpt to be an accessor method Instead of setting self.excerpt, make it a method that returns either the custom excerpt or the pre- viously extracted excerpt. --- lib/jekyll/post.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 2def58ed..99968152 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -19,10 +19,10 @@ module Jekyll end attr_accessor :site - attr_accessor :data, :excerpt, :content, :output, :ext + attr_accessor :data, :extracted_excerpt, :content, :output, :ext attr_accessor :date, :slug, :published, :tags, :categories - attr_reader :name + attr_reader :name, :excerpt # Initialize this Post instance. # @@ -80,10 +80,18 @@ module Jekyll # Returns nothing. def read_yaml(base, name) super(base, name) - self.excerpt = self.data["excerpt"] || self.extract_excerpt + self.extracted_excerpt = self.extract_excerpt self.data['layout'] = 'post' unless self.data.has_key?('layout') end + # The post excerpt. This is either a custom excerpt + # set in YAML front matter or the result of extract_excerpt. + # + # Returns excerpt string. + def excerpt + self.data['excerpt'] ? converter.convert(self.data['excerpt']) : self.extracted_excerpt + end + # Compares Post objects. First compares the Post date. If the dates are # equal, it compares the Post slugs. # @@ -117,7 +125,7 @@ module Jekyll # Returns nothing. def transform super - self.excerpt = converter.convert(self.excerpt) + self.extracted_excerpt = converter.convert(self.extracted_excerpt) end # The generated directory into which the post will be placed From 951ee09a75c3a07d7525db2b3ce4afa668a68e89 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 19:05:28 +0200 Subject: [PATCH 053/184] remove useless attr_reader for excerpt (is a method now) --- lib/jekyll/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 99968152..47627e7b 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -22,7 +22,7 @@ module Jekyll attr_accessor :data, :extracted_excerpt, :content, :output, :ext attr_accessor :date, :slug, :published, :tags, :categories - attr_reader :name, :excerpt + attr_reader :name # Initialize this Post instance. # From 14a669530edabe19976af9329994bc94fe8b0217 Mon Sep 17 00:00:00 2001 From: Alex Kessinger Date: Thu, 11 Apr 2013 10:17:59 -0700 Subject: [PATCH 054/184] Fixing tests, and making it more ruby friendly --- lib/jekyll.rb | 2 +- test/test_configuration.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index a88dedc7..b3f6b22f 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -138,7 +138,7 @@ module Jekyll # Get configuration from /_config.yml or / config_files = override.delete('config') config_files = File.join(source, "_config.yml") if config_files.to_s.empty? - if not config_files.is_a? Array + unless config_files.is_a? Array config_files = [config_files] end diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 361408d6..988d1c7d 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -46,6 +46,12 @@ class TestConfiguration < Test::Unit::TestCase assert_equal Jekyll::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($stdout).puts("Configuration file: #{@paths[:default]}") + assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) + 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 } From b10e06ce47efec6e7152d47dfcda026d82757664 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 19:33:32 +0200 Subject: [PATCH 055/184] new test: ensure the correct excerpt is exposed to liquid Also shorten test code a little bit. --- test/source/_posts/2013-04-11-custom-excerpt.markdown | 2 ++ test/test_post.rb | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/source/_posts/2013-04-11-custom-excerpt.markdown b/test/source/_posts/2013-04-11-custom-excerpt.markdown index 7212704e..ff5b721f 100644 --- a/test/source/_posts/2013-04-11-custom-excerpt.markdown +++ b/test/source/_posts/2013-04-11-custom-excerpt.markdown @@ -6,3 +6,5 @@ excerpt: 'I can set a custom excerpt with *markdown*' This is not my excerpt. Neither is this. + +I can use the excerpt: {{page.excerpt}} \ No newline at end of file diff --git a/test/test_post.rb b/test/test_post.rb index f8ba8392..88d25723 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -324,15 +324,18 @@ class TestPost < Test::Unit::TestCase context "with custom excerpt" do setup do file = "2013-04-11-custom-excerpt.markdown" - @post.process(file) - @post.read_yaml(@source, file) - @post.transform + @post = setup_post(file) + do_render(@post) end should "use custom excerpt" do assert_equal("

I can set a custom excerpt with markdown

", @post.excerpt) end + should "expose custom excerpt to liquid" do + assert @post.content.include?("I can use the excerpt:

I can set a custom excerpt with markdown

") + end + end end From bcda51f97bb1ab3c8513f09f46350b6ebd7f44b1 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 11 Apr 2013 21:02:08 +0200 Subject: [PATCH 056/184] do not allow markdown etc. in excerpt Adjust the tests accordingly. Also add a message for one of the tests. --- lib/jekyll/post.rb | 6 +++++- test/source/_posts/2013-04-11-custom-excerpt.markdown | 2 +- test/test_post.rb | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 47627e7b..14c287bd 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -89,7 +89,11 @@ module Jekyll # # Returns excerpt string. def excerpt - self.data['excerpt'] ? converter.convert(self.data['excerpt']) : self.extracted_excerpt + if self.data.has_key? 'excerpt' + self.data['excerpt'] + else + self.extracted_excerpt + end end # Compares Post objects. First compares the Post date. If the dates are diff --git a/test/source/_posts/2013-04-11-custom-excerpt.markdown b/test/source/_posts/2013-04-11-custom-excerpt.markdown index ff5b721f..023251fe 100644 --- a/test/source/_posts/2013-04-11-custom-excerpt.markdown +++ b/test/source/_posts/2013-04-11-custom-excerpt.markdown @@ -1,6 +1,6 @@ --- layout: ~ -excerpt: 'I can set a custom excerpt with *markdown*' +excerpt: 'I can set a custom excerpt' --- This is not my excerpt. diff --git a/test/test_post.rb b/test/test_post.rb index 88d25723..62da1343 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -329,11 +329,11 @@ class TestPost < Test::Unit::TestCase end should "use custom excerpt" do - assert_equal("

I can set a custom excerpt with markdown

", @post.excerpt) + assert_equal("I can set a custom excerpt", @post.excerpt) end should "expose custom excerpt to liquid" do - assert @post.content.include?("I can use the excerpt:

I can set a custom excerpt with markdown

") + assert @post.content.include?("I can use the excerpt: I can set a custom excerpt"), "Exposes incorrect excerpt to liquid." end end From 2b238786a28a4e347fac1435d13acc7a8d3a6817 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 12 Apr 2013 12:05:07 +0200 Subject: [PATCH 057/184] one more indentation fix --- lib/jekyll/post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 14c287bd..e040fb02 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -90,9 +90,9 @@ module Jekyll # Returns excerpt string. def excerpt if self.data.has_key? 'excerpt' - self.data['excerpt'] + self.data['excerpt'] else - self.extracted_excerpt + self.extracted_excerpt end end From 64aa31b3d39af08acb6f2634b5376499ee588315 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 15:20:55 +0200 Subject: [PATCH 058/184] Update history to reflect merge of #945 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index b886d5fb..378a1c44 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 5c680db7584027de3bfc4fde04a144d16087aaa2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 15:42:09 +0200 Subject: [PATCH 059/184] Update history to reflect merge of #946. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 378a1c44..453a9435 100644 --- a/History.txt +++ b/History.txt @@ -38,6 +38,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From d64fd1e8fea9de400109cf0f3f181d590e67293f Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 12 Apr 2013 17:37:16 +0200 Subject: [PATCH 060/184] expose file path relative to source dir to liquid Fixes #633. --- lib/jekyll/page.rb | 3 ++- lib/jekyll/post.rb | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 0de5e254..c56396a4 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -124,7 +124,8 @@ module Jekyll def to_liquid self.data.deep_merge({ "url" => self.url, - "content" => self.content }) + "content" => self.content, + "path" => File.join(@dir, @name).sub(/\A\//, '') }) end # Obtain destination path. diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index e040fb02..45de5267 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -33,6 +33,7 @@ module Jekyll # Returns the new Post. def initialize(site, source, dir, name) @site = site + @dir = dir @base = self.containing_dir(source, dir) @name = name @@ -285,7 +286,8 @@ module Jekyll "previous" => self.previous, "tags" => self.tags, "content" => self.content, - "excerpt" => self.excerpt }) + "excerpt" => self.excerpt, + "path" => File.join(@dir, @name).sub(/\A\//, '') }) end # Returns the shorthand String identifier of this Post. From dc4d7c0bf4cf20b16ad0c51040bf4aca05de9c04 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 12 Apr 2013 18:17:57 +0200 Subject: [PATCH 061/184] fix path for posts: must include "_posts" --- lib/jekyll/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 45de5267..1da37001 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -287,7 +287,7 @@ module Jekyll "tags" => self.tags, "content" => self.content, "excerpt" => self.excerpt, - "path" => File.join(@dir, @name).sub(/\A\//, '') }) + "path" => File.join(@dir, '_posts', @name).sub(/\A\//, '') }) end # Returns the shorthand String identifier of this Post. From 5a92a73010eb810eb0f185645f1023022522b7c6 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 12 Apr 2013 18:18:17 +0200 Subject: [PATCH 062/184] add cucumber tests for page.path variable --- features/post_data.feature | 15 +++++++++++++++ features/site_data.feature | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/features/post_data.feature b/features/post_data.feature index 61732f90..6ff48d6c 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -153,6 +153,21 @@ Feature: Post data 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 post.path variable + Given I have a /_posts directory + And I have the following post in "": + | title | type | date | content | + | my-post | html | 4/12/2013 | Source path: {{ page.path }} | + When I run jekyll + Then 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: Disable a post from being published Given I have a _posts directory And I have an "index.html" file that contains "Published!" diff --git a/features/site_data.feature b/features/site_data.feature index 0a0b1a7e..36b0f861 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -9,6 +9,19 @@ Feature: Site data Then the _site directory should exist And I should see "Contact: email@me.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 + Then 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: Use site.time variable Given I have an "index.html" page that contains "{{ site.time }}" When I run jekyll From 5f5450720414e6d3f16f9b19b48c62e5608f3207 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 19:35:46 +0200 Subject: [PATCH 063/184] Remove code duplication --- lib/jekyll/command.rb | 11 +++++++++++ lib/jekyll/commands/build.rb | 20 ++------------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index ea513e0d..ff3d5eb3 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -8,5 +8,16 @@ module Jekyll dirs += ['*'] end end + def self.process_site(site) + begin + site.process + rescue Jekyll::FatalException => e + puts + puts "ERROR: YOUR SITE COULD NOT BE BUILT:" + puts "------------------------------------" + puts e.message + exit(1) + end + end end end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 1a23e49b..2ee78d22 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -20,15 +20,7 @@ module Jekyll puts " Source: #{source}" puts " Destination: #{destination}" print " Generating... " - begin - site.process - rescue Jekyll::FatalException => e - puts - puts "ERROR: YOUR SITE COULD NOT BE BUILT:" - puts "------------------------------------" - puts e.message - exit(1) - end + self.process_site(site) puts "done." end @@ -52,15 +44,7 @@ module Jekyll dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") print " Regenerating: #{args.size} files at #{t} " - begin - site.process - rescue Jekyll::FatalException => e - puts - puts "ERROR: YOUR SITE COULD NOT BE BUILT:" - puts "------------------------------------" - puts e.message - exit(1) - end + self.process_site(site) puts "...done." end From 0884a52fea70c144ab924aebef3b0b1a6a86a148 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 20:01:25 +0200 Subject: [PATCH 064/184] Add TomDoc for Jekyll::Command.process_site --- lib/jekyll/command.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index ff3d5eb3..1e4de052 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -8,6 +8,12 @@ module Jekyll dirs += ['*'] end end + + # Static: Run Site#process and catch errors + # + # site - the Jekyll::Site object + # + # Returns nothing def self.process_site(site) begin site.process From 04fd68a232258e004caa59c4e3c6b9e008896f1a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 21:19:20 +0200 Subject: [PATCH 065/184] Move Jekyll::DEFAULTS to Jekyll::Configuration::DEFAULTS --- lib/jekyll.rb | 68 ++----------------------------------- lib/jekyll/site.rb | 2 +- test/test_configuration.rb | 16 ++++----- test/test_generated_site.rb | 6 ++-- test/test_page.rb | 2 +- test/test_pager.rb | 4 +-- test/test_post.rb | 6 ++-- test/test_site.rb | 32 ++++++++--------- test/test_tags.rb | 2 +- 9 files changed, 37 insertions(+), 101 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index b3f6b22f..12082194 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -28,6 +28,7 @@ require 'pygments' # internal requires require 'jekyll/core_ext' +require 'jekyll/configuration' require 'jekyll/site' require 'jekyll/convertible' require 'jekyll/layout' @@ -54,76 +55,11 @@ SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll VERSION = '1.0.0.beta4' - # Default options. Overriden by values in _config.yml. - # Strings rather than symbols are used for compatability with YAML. - DEFAULTS = { - 'source' => Dir.pwd, - 'destination' => File.join(Dir.pwd, '_site'), - 'plugins' => '_plugins', - 'layouts' => '_layouts', - 'keep_files' => ['.git','.svn'], - - 'future' => true, # remove and make true just default - 'pygments' => true, # remove and make true just default - - 'markdown' => 'maruku', - 'permalink' => 'date', - 'baseurl' => '/', - 'include' => ['.htaccess'], - 'paginate_path' => 'page:num', - - 'markdown_ext' => 'markdown,mkd,mkdn,md', - 'textile_ext' => 'textile', - - 'port' => '4000', - 'host' => '0.0.0.0', - - 'excerpt_separator' => "\n\n", - - 'maruku' => { - 'use_tex' => false, - 'use_divs' => false, - 'png_engine' => 'blahtex', - 'png_dir' => 'images/latex', - 'png_url' => '/images/latex' - }, - - 'rdiscount' => { - 'extensions' => [] - }, - - 'redcarpet' => { - 'extensions' => [] - }, - - 'kramdown' => { - 'auto_ids' => true, - 'footnote_nr' => 1, - 'entity_output' => 'as_char', - 'toc_levels' => '1..6', - 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo', - 'use_coderay' => false, - - 'coderay' => { - 'coderay_wrap' => 'div', - 'coderay_line_numbers' => 'inline', - 'coderay_line_number_start' => 1, - 'coderay_tab_width' => 4, - 'coderay_bold_every' => 10, - 'coderay_css' => 'style' - } - }, - - 'redcloth' => { - 'hard_breaks' => true - } - } - # 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::DEFAULTS for a + # the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a # list of option names and their defaults. # # Returns the final configuration Hash. diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index d5901886..6e23edf4 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -97,7 +97,7 @@ module Jekyll # # Returns an Array of plugin search paths def plugins_path - if (config['plugins'] == Jekyll::DEFAULTS['plugins']) + if (config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins']) [File.join(self.source, config['plugins'])] else Array(config['plugins']).map { |d| File.expand_path(d) } diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 988d1c7d..64975552 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -9,20 +9,20 @@ class TestConfiguration < Test::Unit::TestCase should "fire warning with no _config.yml" do mock(YAML).safe_load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } mock($stderr).puts("Configuration file: none") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "load configuration as hash" do mock(YAML).safe_load_file(@path) { Hash.new } mock($stdout).puts("Configuration file: #{@path}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end should "fire warning with bad config" do mock(YAML).safe_load_file(@path) { Array.new } mock($stderr).puts(" WARNING: Error reading configuration. Using defaults (and options).") mock($stderr).puts("Configuration file: (INVALID) #{@path}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end end context "loading config from external file" do @@ -37,19 +37,19 @@ class TestConfiguration < Test::Unit::TestCase should "load default config if no config_file is set" do mock(YAML).safe_load_file(@paths[:default]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) + 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($stdout).puts("Configuration file: #{@paths[:other]}") - assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @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($stdout).puts("Configuration file: #{@paths[:default]}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) end should "load multiple config files" do @@ -57,7 +57,7 @@ class TestConfiguration < Test::Unit::TestCase mock(YAML).safe_load_file(@paths[:other]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") mock($stdout).puts("Configuration file: #{@paths[:other]}") - assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) end should "load multiple config files and last config should win" do @@ -65,7 +65,7 @@ class TestConfiguration < Test::Unit::TestCase mock(YAML).safe_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::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) + assert_equal Jekyll::Configuration::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) end end end diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 56413466..ca676861 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -5,7 +5,7 @@ class TestGeneratedSite < Test::Unit::TestCase setup do clear_dest stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) end @site = Site.new(Jekyll.configuration) @@ -46,7 +46,7 @@ class TestGeneratedSite < Test::Unit::TestCase setup do clear_dest stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5}) end @site = Site.new(Jekyll.configuration) @@ -62,7 +62,7 @@ class TestGeneratedSite < Test::Unit::TestCase assert_raise ArgumentError do clear_dest stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) end @site = Site.new(Jekyll.configuration) diff --git a/test/test_page.rb b/test/test_page.rb index fda7cd9c..58e7b1fa 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -15,7 +15,7 @@ class TestPage < Test::Unit::TestCase context "A Page" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) end diff --git a/test/test_pager.rb b/test/test_pager.rb index 4d420f79..fe1156ca 100644 --- a/test/test_pager.rb +++ b/test/test_pager.rb @@ -14,7 +14,7 @@ class TestPager < Test::Unit::TestCase context "pagination disabled" do setup do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({ + Jekyll::Configuration::DEFAULTS.merge({ 'source' => source_dir, 'destination' => dest_dir }) @@ -31,7 +31,7 @@ class TestPager < Test::Unit::TestCase context "pagination enabled for 2" do setup do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({ + Jekyll::Configuration::DEFAULTS.merge({ 'source' => source_dir, 'destination' => dest_dir, 'paginate' => 2 diff --git a/test/test_post.rb b/test/test_post.rb index 62da1343..e57c7c6a 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -13,7 +13,7 @@ class TestPost < Test::Unit::TestCase context "A Post" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) end @@ -344,7 +344,7 @@ class TestPost < Test::Unit::TestCase context "when in a site" do setup do clear_dest - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) @site.posts = [setup_post('2008-02-02-published.textile'), setup_post('2009-01-27-categories.textile')] @@ -537,7 +537,7 @@ class TestPost < Test::Unit::TestCase context "converter file extension settings" do setup do - stub(Jekyll).configuration { Jekyll::DEFAULTS } + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } @site = Site.new(Jekyll.configuration) end diff --git a/test/test_site.rb b/test/test_site.rb index 57b29f16..e8eb104d 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -3,49 +3,49 @@ require 'helper' class TestSite < Test::Unit::TestCase context "configuring sites" do should "have an array for plugins by default" do - site = Site.new(Jekyll::DEFAULTS) + site = Site.new(Jekyll::Configuration::DEFAULTS) assert_equal [File.join(Dir.pwd, '_plugins')], site.plugins end should "look for plugins under the site directory by default" do - site = Site.new(Jekyll::DEFAULTS.merge({'source' => File.expand_path(source_dir)})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'source' => File.expand_path(source_dir)})) assert_equal [File.join(source_dir, '_plugins')], site.plugins end should "have an array for plugins if passed as a string" do - site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) assert_equal ['/tmp/plugins'], site.plugins end should "have an array for plugins if passed as an array" do - site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => ['/tmp/plugins', '/tmp/otherplugins']})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => ['/tmp/plugins', '/tmp/otherplugins']})) assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins end should "have an empty array for plugins if nothing is passed" do - site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => []})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => []})) assert_equal [], site.plugins end should "have an empty array for plugins if nil is passed" do - site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => nil})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'plugins' => nil})) assert_equal [], site.plugins end should "expose default baseurl" do - site = Site.new(Jekyll::DEFAULTS) - assert_equal Jekyll::DEFAULTS['baseurl'], site.baseurl + site = Site.new(Jekyll::Configuration::DEFAULTS) + assert_equal Jekyll::Configuration::DEFAULTS['baseurl'], site.baseurl end should "expose baseurl passed in from config" do - site = Site.new(Jekyll::DEFAULTS.merge({'baseurl' => '/blog'})) + site = Site.new(Jekyll::Configuration::DEFAULTS.merge({'baseurl' => '/blog'})) assert_equal '/blog', site.baseurl end end context "creating sites" do setup do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) end @site = Site.new(Jekyll.configuration) end @@ -205,7 +205,7 @@ class TestSite < Test::Unit::TestCase should "filter symlink entries when safe mode enabled" do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) end site = Site.new(Jekyll.configuration) stub(File).symlink?('symlink.js') {true} @@ -221,7 +221,7 @@ class TestSite < Test::Unit::TestCase should "not include symlinks in safe mode" do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) end site = Site.new(Jekyll.configuration) @@ -232,7 +232,7 @@ class TestSite < Test::Unit::TestCase should "include symlinks in unsafe mode" do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false}) end site = Site.new(Jekyll.configuration) @@ -244,7 +244,7 @@ class TestSite < Test::Unit::TestCase context 'error handling' do should "raise if destination is included in source" do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => source_dir}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => source_dir}) end assert_raise Jekyll::FatalException do @@ -254,7 +254,7 @@ class TestSite < Test::Unit::TestCase should "raise if destination is source" do stub(Jekyll).configuration do - Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => File.join(source_dir, "..")}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => File.join(source_dir, "..")}) end assert_raise Jekyll::FatalException do @@ -303,7 +303,7 @@ class TestSite < Test::Unit::TestCase end should 'remove orphaned files in destination - keep_files .svn' do - config = Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'keep_files' => ['.svn']}) + config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'keep_files' => ['.svn']}) @site = Site.new(config) @site.process assert !File.exist?(dest_dir('.htpasswd')) diff --git a/test/test_tags.rb b/test/test_tags.rb index f7916fc5..0ba6b647 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -6,7 +6,7 @@ class TestTags < Test::Unit::TestCase def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown) stub(Jekyll).configuration do - Jekyll::DEFAULTS.deep_merge({'pygments' => true}).deep_merge(override) + Jekyll::Configuration::DEFAULTS.deep_merge({'pygments' => true}).deep_merge(override) end site = Site.new(Jekyll.configuration) From 64f224933b68ebcb3f6257ff96a70535011b42b7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 21:20:14 +0200 Subject: [PATCH 066/184] Add Jekyll::Configuration --- lib/jekyll/configuration.rb | 135 ++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 lib/jekyll/configuration.rb diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb new file mode 100644 index 00000000..8fb476cf --- /dev/null +++ b/lib/jekyll/configuration.rb @@ -0,0 +1,135 @@ +module Jekyll + class Configuration < Hash + + # Default options. Overriden by values in _config.yml. + # Strings rather than symbols are used for compatability with YAML. + DEFAULTS = { + 'source' => Dir.pwd, + 'destination' => File.join(Dir.pwd, '_site'), + 'plugins' => '_plugins', + 'layouts' => '_layouts', + 'keep_files' => ['.git','.svn'], + + 'future' => true, # remove and make true just default + 'pygments' => true, # remove and make true just default + + 'markdown' => 'maruku', + 'permalink' => 'date', + 'baseurl' => '/', + 'include' => ['.htaccess'], + 'paginate_path' => 'page:num', + + 'markdown_ext' => 'markdown,mkd,mkdn,md', + 'textile_ext' => 'textile', + + 'port' => '4000', + 'host' => '0.0.0.0', + + 'excerpt_separator' => "\n\n", + + 'maruku' => { + 'use_tex' => false, + 'use_divs' => false, + 'png_engine' => 'blahtex', + 'png_dir' => 'images/latex', + 'png_url' => '/images/latex' + }, + + 'rdiscount' => { + 'extensions' => [] + }, + + 'redcarpet' => { + 'extensions' => [] + }, + + 'kramdown' => { + 'auto_ids' => true, + 'footnote_nr' => 1, + 'entity_output' => 'as_char', + 'toc_levels' => '1..6', + 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo', + 'use_coderay' => false, + + 'coderay' => { + 'coderay_wrap' => 'div', + 'coderay_line_numbers' => 'inline', + 'coderay_line_number_start' => 1, + 'coderay_tab_width' => 4, + 'coderay_bold_every' => 10, + 'coderay_css' => 'style' + } + }, + + 'redcloth' => { + 'hard_breaks' => true + } + } + + # 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 + + # Public: Generate list of configuration files from the override§ + def config_files(override) + # _config.yml may override default source location, but until + # then, we need to know where to look for _config.yml + source = override['source'] || DEFAULTS['source'] + + # Get configuration from /_config.yml or / + config_files = override.delete('config') + config_files = File.join(source, "_config.yml") if config_files.to_s.empty? + unless config_files.is_a? Array + config_files = [config_files] + end + config_files + end + + # Public: Read configuration and return merged Hash + # + # file - + def read_config_file(file) + configuration = dup + next_config = YAML.safe_load_file(file) + raise "Configuration file: (INVALID) #{file}" if !next_config.is_a?(Hash) + $stdout.puts "Configuration file: #{file}" + configuration.deep_merge(next_config) + end + + def read_config_files(files) + configuration = dup + + begin + files.each do |config_file| + configuration = read_config_file(config_file) + end + rescue SystemCallError + # Errno:ENOENT = file not found + $stderr.puts "Configuration file: none" + rescue => err + $stderr.puts " " + + "WARNING: Error reading configuration. " + + "Using defaults (and options)." + $stderr.puts "#{err}" + end + + configuration + end + + def backwards_compatibilize + config = dup + # Provide backwards-compatibility + if config['auto'] + $stderr.puts "Deprecation: ".rjust(20) + "'auto' has been changed to " + + "'watch'. Please update your configuration to use 'watch'." + config['watch'] = config['auto'] + end + + config + end + + end +end From e2967c96cd0309a7be7702288690a02857c58a7a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 21:20:30 +0200 Subject: [PATCH 067/184] Jekyll.configuration should use the new Jekyll::Configuration class --- lib/jekyll.rb | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 12082194..fad6c769 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -64,48 +64,12 @@ module Jekyll # # Returns the final configuration Hash. def self.configuration(override) - # Convert any symbol keys to strings and remove the old key/values - override = override.reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) } - - # _config.yml may override default source location, but until - # then, we need to know where to look for _config.yml - source = override['source'] || Jekyll::DEFAULTS['source'] - - # Get configuration from /_config.yml or / - config_files = override.delete('config') - config_files = File.join(source, "_config.yml") if config_files.to_s.empty? - unless config_files.is_a? Array - config_files = [config_files] - end - - begin - config = {} - config_files.each do |config_file| - next_config = YAML.safe_load_file(config_file) - raise "Configuration file: (INVALID) #{config_file}" if !next_config.is_a?(Hash) - $stdout.puts "Configuration file: #{config_file}" - config = config.deep_merge(next_config) - end - rescue SystemCallError - # Errno:ENOENT = file not found - $stderr.puts "Configuration file: none" - config = {} - rescue => err - $stderr.puts " " + - "WARNING: Error reading configuration. " + - "Using defaults (and options)." - $stderr.puts "#{err}" - config = {} - end - - # Provide backwards-compatibility - if config['auto'] - $stderr.puts "Deprecation: ".rjust(20) + "'auto' has been changed to " + - "'watch'. Please update your configuration to use 'watch'." - config['watch'] = config['auto'] - end + config = Configuration[Configuration::DEFAULTS] + override = Configuration[override].stringify_keys + config = config.read_config_files(config.config_files(override)) + config = config.backwards_compatibilize # Merge DEFAULTS < _config.yml < override - Jekyll::DEFAULTS.deep_merge(config).deep_merge(override) + config.deep_merge(override).stringify_keys end end From 810a29c7196209b68dfcf2d64a7e02a96e208656 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 22:25:58 +0300 Subject: [PATCH 068/184] Rescue the entire method instead of just a `begin` block --- lib/jekyll/command.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 1e4de052..1f305a3c 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -15,15 +15,13 @@ module Jekyll # # Returns nothing def self.process_site(site) - begin - site.process - rescue Jekyll::FatalException => e - puts - puts "ERROR: YOUR SITE COULD NOT BE BUILT:" - puts "------------------------------------" - puts e.message - exit(1) - end + site.process + rescue Jekyll::FatalException => e + puts + puts "ERROR: YOUR SITE COULD NOT BE BUILT:" + puts "------------------------------------" + puts e.message + exit(1) end end end From f2f20d18f01a8cf262b587c95074c0108d5e7202 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 21:38:30 +0200 Subject: [PATCH 069/184] TomDoc Jekyll::Configuration --- lib/jekyll/configuration.rb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 8fb476cf..39cb6726 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -73,7 +73,11 @@ module Jekyll reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) } end - # Public: Generate list of configuration files from the override§ + # 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) # _config.yml may override default source location, but until # then, we need to know where to look for _config.yml @@ -90,7 +94,9 @@ module Jekyll # Public: Read configuration and return merged Hash # - # file - + # 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) configuration = dup next_config = YAML.safe_load_file(file) @@ -98,7 +104,13 @@ module Jekyll $stdout.puts "Configuration file: #{file}" configuration.deep_merge(next_config) 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 = dup @@ -118,7 +130,11 @@ module Jekyll configuration 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 = dup # Provide backwards-compatibility From 0c0b13e69b29cffca46694d29f85c8b624fb8f27 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 21:56:45 +0200 Subject: [PATCH 070/184] Unit test for Configuration#stringify_keys --- test/test_configuration.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 64975552..0c57ec10 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -1,6 +1,30 @@ require 'helper' class TestConfiguration < Test::Unit::TestCase + context "#stringify_keys" do + setup do + @mixed_keys = Configuration[{ + 'markdown' => 'maruku', + :permalink => 'date', + 'baseurl' => '/', + :include => ['.htaccess'], + :source => './' + }] + @string_keys = Configuration[{ + 'markdown' => 'maruku', + 'permalink' => 'date', + 'baseurl' => '/', + 'include' => ['.htaccess'], + 'source' => './' + }] + end + should "stringify symbol keys" do + assert_equal @string_keys, @mixed_keys.stringify_keys + end + should "not mess with keys already strings" do + assert_equal @string_keys, @string_keys.stringify_keys + end + end context "loading configuration" do setup do @path = File.join(Dir.pwd, '_config.yml') From 0812c1b4c97bcbfb13f9ef75eb8eedea0d4faffd Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 22:29:27 +0200 Subject: [PATCH 071/184] Add unit tests for Configuration#config_files --- test/test_configuration.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 0c57ec10..c8a2aac5 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -25,6 +25,30 @@ class TestConfiguration < Test::Unit::TestCase assert_equal @string_keys, @string_keys.stringify_keys end end + context "#config_files" do + setup do + @config = Configuration[Configuration::DEFAULTS] + @base_config = {"source" => source_dir} + @no_override = @base_config.merge({}) + @one_config_file = @base_config.merge({ "config" => "config.yml" }) + @multiple_files = @base_config.merge({ "config" => %w[config/site.yml config/deploy.yml configuration.yml] }) + end + + should "always return an array" do + assert @config.config_files(@no_override).is_a?(Array) + assert @config.config_files(@one_config_file).is_a?(Array) + assert @config.config_files(@multiple_files).is_a?(Array) + end + should "return the default config path if no config files are specified" do + assert_equal [File.join(source_dir, "_config.yml")], @config.config_files(@no_override) + end + should "return the config if given one config file" do + assert_equal %w[config.yml], @config.config_files(@one_config_file) + end + should "return an array of the config files if given many config files" do + assert_equal %w[config/site.yml config/deploy.yml configuration.yml], @config.config_files(@multiple_files) + end + end context "loading configuration" do setup do @path = File.join(Dir.pwd, '_config.yml') From 879b08a0b05c3775f365272d1983d56be667d7c2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 22:29:52 +0200 Subject: [PATCH 072/184] In Configuration#config_files, cascade to the Configuration's value of 'source' before the default --- lib/jekyll/configuration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 39cb6726..08b7dbf6 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -81,7 +81,7 @@ module Jekyll def config_files(override) # _config.yml may override default source location, but until # then, we need to know where to look for _config.yml - source = override['source'] || DEFAULTS['source'] + source = override['source'] || self['source'] || DEFAULTS['source'] # Get configuration from /_config.yml or / config_files = override.delete('config') @@ -127,7 +127,7 @@ module Jekyll "Using defaults (and options)." $stderr.puts "#{err}" end - + configuration end From 7c7bacffe76fd05e20f5f2b4d45fa57c3ca7533c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 22:37:01 +0200 Subject: [PATCH 073/184] Refactor setup block for test of Configuration#config_files --- test/test_configuration.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index c8a2aac5..8793b29d 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -27,11 +27,10 @@ class TestConfiguration < Test::Unit::TestCase end context "#config_files" do setup do - @config = Configuration[Configuration::DEFAULTS] - @base_config = {"source" => source_dir} - @no_override = @base_config.merge({}) - @one_config_file = @base_config.merge({ "config" => "config.yml" }) - @multiple_files = @base_config.merge({ "config" => %w[config/site.yml config/deploy.yml configuration.yml] }) + @config = Configuration[{"source" => source_dir}] + @no_override = {} + @one_config_file = {"config" => "config.yml"} + @multiple_files = {"config" => %w[config/site.yml config/deploy.yml configuration.yml]} end should "always return an array" do From 0f600a322c0146d4334d4d79ea99f6c839a9ac54 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 22:42:54 +0200 Subject: [PATCH 074/184] Added a unit test for Configuration#backwards_compatibilize --- test/test_configuration.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 8793b29d..6eb35fc4 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -48,6 +48,15 @@ class TestConfiguration < Test::Unit::TestCase assert_equal %w[config/site.yml config/deploy.yml configuration.yml], @config.config_files(@multiple_files) end end + context "#backwards_compatibilize" do + setup do + @config = Configuration[{"auto" => true}] + end + should "create 'watch' key for 'auto'" do + assert @config.backwards_compatibilize.has_key? "watch" + assert_equal true, @config.backwards_compatibilize["watch"] + end + end context "loading configuration" do setup do @path = File.join(Dir.pwd, '_config.yml') From bd8d271ce3153a1bf49223dfc3380ea079fc969b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 23:11:38 +0200 Subject: [PATCH 075/184] Moving the backwards-compatibilizing to Configuration#read_config_files. @mattr- --- lib/jekyll.rb | 1 - lib/jekyll/configuration.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index fad6c769..78572491 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -67,7 +67,6 @@ module Jekyll config = Configuration[Configuration::DEFAULTS] override = Configuration[override].stringify_keys config = config.read_config_files(config.config_files(override)) - config = config.backwards_compatibilize # Merge DEFAULTS < _config.yml < override config.deep_merge(override).stringify_keys diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 08b7dbf6..619b33ae 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -128,7 +128,7 @@ module Jekyll $stderr.puts "#{err}" end - configuration + configuration.backwards_compatibilize end # Public: Ensure the proper options are set in the configuration to allow for From 65f0d66e39a89f9895be097f45935f303ea700c6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 23:34:34 +0200 Subject: [PATCH 076/184] Update history to reflect merge of #951 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 453a9435..47dad7d6 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From dc39f021328e234a9110beba5298e3facd93487f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 23:39:20 +0200 Subject: [PATCH 077/184] Add new pagination variables to the Variables page in the docs site. #942 --- site/_posts/2012-07-01-variables.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index cbda02d4..c722a10e 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -258,10 +258,18 @@ following is a reference of the available data.

paginator.previous_page

The number of the previous page.

+ +

paginator.previous_page_path

+

The path to the previous page.

+

paginator.next_page

The number of the next page.

+ +

paginator.next_page_path

+

The path to the next page.

+ From b44cf939e60eebcacaafc09d7ed44e26ba29eda1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 23:43:25 +0200 Subject: [PATCH 078/184] Add note in docs about page.path. #951. --- site/_posts/2012-07-01-variables.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index c722a10e..767041a1 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -205,7 +205,17 @@ following is a reference of the available data.

The list of tags to which this post belongs. These can be specified in - the YAML Front Matter + the YAML Front Matter. + +

+ + +

page.path

+

+ + The path to the raw post or page. Example usage: Linking back to the + page or post's source on GitHub. This can be overridden in the + YAML Front Matter.

From 6881d3bfbffd8fd856e7f9146fc55a184b8e0953 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 12 Apr 2013 23:59:37 +0200 Subject: [PATCH 079/184] Refactored Configuration#config_files --- lib/jekyll/configuration.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 619b33ae..f0617744 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -73,22 +73,25 @@ module Jekyll reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) } 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) + override['source'] || self['source'] || DEFAULTS['source'] + 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) - # _config.yml may override default source location, but until - # then, we need to know where to look for _config.yml - source = override['source'] || self['source'] || DEFAULTS['source'] - # Get configuration from /_config.yml or / config_files = override.delete('config') - config_files = File.join(source, "_config.yml") if config_files.to_s.empty? - unless config_files.is_a? Array - config_files = [config_files] - end + config_files = File.join(source(override), "_config.yml") if config_files.to_s.empty? + config_files = [config_files] unless config_files.is_a? Array config_files end From 968f3b0911245de58a8c4a19aae115baa19b6992 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Sat, 13 Apr 2013 00:05:49 +0200 Subject: [PATCH 080/184] allow overriding page.path in YAML frontmatter --- lib/jekyll/page.rb | 2 +- lib/jekyll/post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index c56396a4..80f5b884 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -125,7 +125,7 @@ module Jekyll self.data.deep_merge({ "url" => self.url, "content" => self.content, - "path" => File.join(@dir, @name).sub(/\A\//, '') }) + "path" => self.data['path'] || File.join(@dir, @name).sub(/\A\//, '') }) end # Obtain destination path. diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 1da37001..5ea56898 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -287,7 +287,7 @@ module Jekyll "tags" => self.tags, "content" => self.content, "excerpt" => self.excerpt, - "path" => File.join(@dir, '_posts', @name).sub(/\A\//, '') }) + "path" => self.data['path'] || File.join(@dir, '_posts', @name).sub(/\A\//, '') }) end # Returns the shorthand String identifier of this Post. From c20fc036042aa5092f22981b264a9d53ee4dbd9f Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Sat, 13 Apr 2013 00:06:09 +0200 Subject: [PATCH 081/184] add cucumber tests for overriding path --- features/post_data.feature | 9 +++++++++ features/site_data.feature | 6 ++++++ features/step_definitions/jekyll_steps.rb | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/features/post_data.feature b/features/post_data.feature index 6ff48d6c..04c385ac 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -168,6 +168,15 @@ Feature: Post data | dir | dir/ | | dir/nested | dir/nested/ | + Scenario: Override page.path variable + Given I have a _posts directory + And I have the following post: + | title | date | path | content | + | override | 4/12/2013 | override-path.html | Custom path: {{ page.path }} | + When I run jekyll + Then the _site directory should exist + And I should see "Custom path: override-path.html" 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!" diff --git a/features/site_data.feature b/features/site_data.feature index 36b0f861..47f34ec0 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -22,6 +22,12 @@ Feature: Site data | 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 + Then 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 diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 05629e77..fd58679d 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -66,7 +66,7 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire end matter_hash = {} - %w(title layout tag tags category categories published author).each do |key| + %w(title layout tag tags category categories published author path).each do |key| matter_hash[key] = post[key] if post[key] end matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp From 63cdd21353bfd047b11998aaa99e6bd23fcacfcb Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 01:47:40 +0200 Subject: [PATCH 082/184] Move initialization of parsers to separate classes --- lib/jekyll.rb | 1 + lib/jekyll/converters/markdown.rb | 76 ++----------------- .../converters/parsers/kramdown_parser.rb | 16 ++++ .../converters/parsers/maruku_parser.rb | 43 +++++++++++ .../converters/parsers/rdiscount_parser.rb | 17 +++++ .../converters/parsers/redcarpet_parser.rb | 35 +++++++++ 6 files changed, 118 insertions(+), 70 deletions(-) create mode 100644 lib/jekyll/converters/parsers/kramdown_parser.rb create mode 100644 lib/jekyll/converters/parsers/maruku_parser.rb create mode 100644 lib/jekyll/converters/parsers/rdiscount_parser.rb create mode 100644 lib/jekyll/converters/parsers/redcarpet_parser.rb diff --git a/lib/jekyll.rb b/lib/jekyll.rb index b3f6b22f..f8a65409 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -46,6 +46,7 @@ require 'jekyll/command' require_all 'jekyll/commands' require_all 'jekyll/converters' +require_all 'jekyll/converters/parsers' require_all 'jekyll/generators' require_all 'jekyll/tags' diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index b345b88c..79c72c4e 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -8,79 +8,15 @@ module Jekyll def setup return if @setup - case @config['markdown'] + @parser = case @config['markdown'] when 'redcarpet' - begin - require 'redcarpet' - - @renderer ||= Class.new(Redcarpet::Render::HTML) do - def block_code(code, lang) - lang = lang && lang.split.first || "text" - output = add_code_tags( - Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }), - lang - ) - end - - def add_code_tags(code, lang) - code = code.sub(/
/,'
')
-                  code = code.sub(/<\/pre>/,"
") - end - end - - @redcarpet_extensions = {} - @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } - rescue LoadError - STDERR.puts 'You are missing a library required for Markdown. Please run:' - STDERR.puts ' $ [sudo] gem install redcarpet' - raise FatalException.new("Missing dependency: redcarpet") - end + RedcarpetParser.new @config when 'kramdown' - begin - require 'kramdown' - rescue LoadError - STDERR.puts 'You are missing a library required for Markdown. Please run:' - STDERR.puts ' $ [sudo] gem install kramdown' - raise FatalException.new("Missing dependency: kramdown") - end + KramdownParser.new @config when 'rdiscount' - begin - require 'rdiscount' - @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym } - rescue LoadError - STDERR.puts 'You are missing a library required for Markdown. Please run:' - STDERR.puts ' $ [sudo] gem install rdiscount' - raise FatalException.new("Missing dependency: rdiscount") - end + RDiscountParser.new @config when 'maruku' - begin - require 'maruku' - - if @config['maruku']['use_divs'] - require 'maruku/ext/div' - STDERR.puts 'Maruku: Using extended syntax for div elements.' - end - - if @config['maruku']['use_tex'] - require 'maruku/ext/math' - STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`." - - # Switch off MathML output - MaRuKu::Globals[:html_math_output_mathml] = false - MaRuKu::Globals[:html_math_engine] = 'none' - - # Turn on math to PNG support with blahtex - # Resulting PNGs stored in `images/latex` - MaRuKu::Globals[:html_math_output_png] = true - MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine'] - MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir'] - MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url'] - end - rescue LoadError - STDERR.puts 'You are missing a library required for Markdown. Please run:' - STDERR.puts ' $ [sudo] gem install maruku' - raise FatalException.new("Missing dependency: maruku") - end + MarukuParser.new @config else STDERR.puts "Invalid Markdown processor: #{@config['markdown']}" STDERR.puts " Valid options are [ maruku | rdiscount | kramdown ]" @@ -88,7 +24,7 @@ module Jekyll end @setup = true end - + def matches(ext) rgx = '(' + @config['markdown_ext'].gsub(',','|') +')' ext =~ Regexp.new(rgx, Regexp::IGNORECASE) diff --git a/lib/jekyll/converters/parsers/kramdown_parser.rb b/lib/jekyll/converters/parsers/kramdown_parser.rb new file mode 100644 index 00000000..5f658e55 --- /dev/null +++ b/lib/jekyll/converters/parsers/kramdown_parser.rb @@ -0,0 +1,16 @@ +module Jekyll + module Converters + class Markdown + class KramdownParser + def initialize(config) + require 'kramdown' + @config = config + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install kramdown' + raise FatalException.new("Missing dependency: kramdown") + end + end + end + end +end diff --git a/lib/jekyll/converters/parsers/maruku_parser.rb b/lib/jekyll/converters/parsers/maruku_parser.rb new file mode 100644 index 00000000..84d5dca4 --- /dev/null +++ b/lib/jekyll/converters/parsers/maruku_parser.rb @@ -0,0 +1,43 @@ +module Jekyll + module Converters + class Markdown + class MarukuParser + def initialize(config) + require 'maruku' + @config = config + if @config['maruku']['use_divs'] + load_divs_library + end + if @config['maruku']['use_tex'] + load_blahtext_library + end + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install maruku' + raise FatalException.new("Missing dependency: maruku") + end + + def load_divs_library + require 'maruku/ext/div' + STDERR.puts 'Maruku: Using extended syntax for div elements.' + end + + def load_blahtext_library + require 'maruku/ext/math' + STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`." + + # Switch off MathML output + MaRuKu::Globals[:html_math_output_mathml] = false + MaRuKu::Globals[:html_math_engine] = 'none' + + # Turn on math to PNG support with blahtex + # Resulting PNGs stored in `images/latex` + MaRuKu::Globals[:html_math_output_png] = true + MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine'] + MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir'] + MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url'] + end + end + end + end +end diff --git a/lib/jekyll/converters/parsers/rdiscount_parser.rb b/lib/jekyll/converters/parsers/rdiscount_parser.rb new file mode 100644 index 00000000..32970ff5 --- /dev/null +++ b/lib/jekyll/converters/parsers/rdiscount_parser.rb @@ -0,0 +1,17 @@ +module Jekyll + module Converters + class Markdown + class RDiscountParser + def initialize(config) + require 'rdiscount' + @config = config + @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym } + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install rdiscount' + raise FatalException.new("Missing dependency: rdiscount") + end + end + end + end +end diff --git a/lib/jekyll/converters/parsers/redcarpet_parser.rb b/lib/jekyll/converters/parsers/redcarpet_parser.rb new file mode 100644 index 00000000..381e1b0e --- /dev/null +++ b/lib/jekyll/converters/parsers/redcarpet_parser.rb @@ -0,0 +1,35 @@ +module Jekyll + module Converters + class Markdown + class RedcarpetParser + def initialize(config) + begin + require 'redcarpet' + @config = config + @redcarpet_extensions = {} + @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } + + @renderer ||= Class.new(Redcarpet::Render::HTML) do + def block_code(code, lang) + lang = lang && lang.split.first || "text" + output = add_code_tags( + Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }), + lang + ) + end + + def add_code_tags(code, lang) + code = code.sub(/
/,'
')
+                code = code.sub(/<\/pre>/,"
") + end + end + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install redcarpet' + raise FatalException.new("Missing dependency: redcarpet") + end + end + end + end + end +end From 3bc497c1c9fcffffc9e06099de541b8064d69494 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 01:55:03 +0200 Subject: [PATCH 083/184] Moved out conversion logic --- lib/jekyll/converters/markdown.rb | 44 +------------------ .../converters/parsers/kramdown_parser.rb | 28 ++++++++++++ .../converters/parsers/maruku_parser.rb | 4 ++ .../converters/parsers/rdiscount_parser.rb | 9 ++++ .../converters/parsers/redcarpet_parser.rb | 7 +++ 5 files changed, 49 insertions(+), 43 deletions(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 79c72c4e..6f6580fc 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -36,49 +36,7 @@ module Jekyll def convert(content) setup - case @config['markdown'] - when 'redcarpet' - @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) - when 'kramdown' - # Check for use of coderay - if @config['kramdown']['use_coderay'] - Kramdown::Document.new(content, { - :auto_ids => @config['kramdown']['auto_ids'], - :footnote_nr => @config['kramdown']['footnote_nr'], - :entity_output => @config['kramdown']['entity_output'], - :toc_levels => @config['kramdown']['toc_levels'], - :smart_quotes => @config['kramdown']['smart_quotes'], - - :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'], - :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'], - :coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'], - :coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'], - :coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'], - :coderay_css => @config['kramdown']['coderay']['coderay_css'] - }).to_html - else - # not using coderay - Kramdown::Document.new(content, { - :auto_ids => @config['kramdown']['auto_ids'], - :footnote_nr => @config['kramdown']['footnote_nr'], - :entity_output => @config['kramdown']['entity_output'], - :toc_levels => @config['kramdown']['toc_levels'], - :smart_quotes => @config['kramdown']['smart_quotes'] - }).to_html - end - when 'rdiscount' - rd = RDiscount.new(content, *@rdiscount_extensions) - html = rd.to_html - if rd.generate_toc and html.include?(@config['rdiscount']['toc_token']) - html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content.force_encoding('utf-8')) - end - html - when 'maruku' - Maruku.new(content).to_html - end + @parser.convert(content) end end end diff --git a/lib/jekyll/converters/parsers/kramdown_parser.rb b/lib/jekyll/converters/parsers/kramdown_parser.rb index 5f658e55..58857276 100644 --- a/lib/jekyll/converters/parsers/kramdown_parser.rb +++ b/lib/jekyll/converters/parsers/kramdown_parser.rb @@ -10,6 +10,34 @@ module Jekyll STDERR.puts ' $ [sudo] gem install kramdown' raise FatalException.new("Missing dependency: kramdown") end + + def convert(content) + # Check for use of coderay + kramdown_configs = if @config['kramdown']['use_coderay'] + base_kramdown_configs.merge({ + :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'], + :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'], + :coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'], + :coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'], + :coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'], + :coderay_css => @config['kramdown']['coderay']['coderay_css'] + }) + else + # not using coderay + base_kramdown_configs + end + Kramdown::Document.new(content, kramdown_configs).to_html + end + + def base_kramdown_configs + { + :auto_ids => @config['kramdown']['auto_ids'], + :footnote_nr => @config['kramdown']['footnote_nr'], + :entity_output => @config['kramdown']['entity_output'], + :toc_levels => @config['kramdown']['toc_levels'], + :smart_quotes => @config['kramdown']['smart_quotes'] + } + end end end end diff --git a/lib/jekyll/converters/parsers/maruku_parser.rb b/lib/jekyll/converters/parsers/maruku_parser.rb index 84d5dca4..911366c7 100644 --- a/lib/jekyll/converters/parsers/maruku_parser.rb +++ b/lib/jekyll/converters/parsers/maruku_parser.rb @@ -37,6 +37,10 @@ module Jekyll MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir'] MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url'] end + + def convert(content) + Maruku.new(content).to_html + end end end end diff --git a/lib/jekyll/converters/parsers/rdiscount_parser.rb b/lib/jekyll/converters/parsers/rdiscount_parser.rb index 32970ff5..87b09831 100644 --- a/lib/jekyll/converters/parsers/rdiscount_parser.rb +++ b/lib/jekyll/converters/parsers/rdiscount_parser.rb @@ -11,6 +11,15 @@ module Jekyll STDERR.puts ' $ [sudo] gem install rdiscount' raise FatalException.new("Missing dependency: rdiscount") end + + def convert(content) + rd = RDiscount.new(content, *@rdiscount_extensions) + html = rd.to_html + if rd.generate_toc and html.include?(@config['rdiscount']['toc_token']) + html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content.force_encoding('utf-8')) + end + html + end end end end diff --git a/lib/jekyll/converters/parsers/redcarpet_parser.rb b/lib/jekyll/converters/parsers/redcarpet_parser.rb index 381e1b0e..5225af8e 100644 --- a/lib/jekyll/converters/parsers/redcarpet_parser.rb +++ b/lib/jekyll/converters/parsers/redcarpet_parser.rb @@ -29,6 +29,13 @@ module Jekyll raise FatalException.new("Missing dependency: redcarpet") 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 From a971fec80130ddc37ae97971ec8f58e3fd08c10d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 02:13:50 +0200 Subject: [PATCH 084/184] rescue block for the method and added redcarpet as option for parser --- lib/jekyll/converters/markdown.rb | 2 +- .../converters/parsers/redcarpet_parser.rb | 42 +++++++++---------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 6f6580fc..baeb9bf7 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -19,7 +19,7 @@ module Jekyll MarukuParser.new @config else STDERR.puts "Invalid Markdown processor: #{@config['markdown']}" - STDERR.puts " Valid options are [ maruku | rdiscount | kramdown ]" + STDERR.puts " Valid options are [ maruku | rdiscount | kramdown | redcarpet ]" raise FatalException.new("Invalid Markdown process: #{@config['markdown']}") end @setup = true diff --git a/lib/jekyll/converters/parsers/redcarpet_parser.rb b/lib/jekyll/converters/parsers/redcarpet_parser.rb index 5225af8e..92d8aec9 100644 --- a/lib/jekyll/converters/parsers/redcarpet_parser.rb +++ b/lib/jekyll/converters/parsers/redcarpet_parser.rb @@ -3,31 +3,29 @@ module Jekyll class Markdown class RedcarpetParser def initialize(config) - begin - require 'redcarpet' - @config = config - @redcarpet_extensions = {} - @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } + require 'redcarpet' + @config = config + @redcarpet_extensions = {} + @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } - @renderer ||= Class.new(Redcarpet::Render::HTML) do - def block_code(code, lang) - lang = lang && lang.split.first || "text" - output = add_code_tags( - Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }), - lang - ) - end - - def add_code_tags(code, lang) - code = code.sub(/
/,'
')
-                code = code.sub(/<\/pre>/,"
") - end + @renderer ||= Class.new(Redcarpet::Render::HTML) do + def block_code(code, lang) + lang = lang && lang.split.first || "text" + output = add_code_tags( + Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }), + lang + ) + end + + def add_code_tags(code, lang) + code = code.sub(/
/,'
')
+              code = code.sub(/<\/pre>/,"
") end - rescue LoadError - STDERR.puts 'You are missing a library required for Markdown. Please run:' - STDERR.puts ' $ [sudo] gem install redcarpet' - raise FatalException.new("Missing dependency: redcarpet") end + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install redcarpet' + raise FatalException.new("Missing dependency: redcarpet") end def convert(content) From 73a1ffd77a40d0b9470dc64f1cac96a489eb2f6c Mon Sep 17 00:00:00 2001 From: Jhaura Wachsman Date: Fri, 12 Apr 2013 17:42:48 -0700 Subject: [PATCH 085/184] Add 'excerpt' page variable to Docs Variables page. --- site/_posts/2012-07-01-variables.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index 767041a1..1d4b1214 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -151,6 +151,14 @@ following is a reference of the available data.

+ +

page.excerpt

+

+ + The un-rendered excerpt of the Page. + +

+

page.title

From 48bb29c1f78e557df114ee986996e00ac08c8fe8 Mon Sep 17 00:00:00 2001 From: Jhaura Wachsman Date: Fri, 12 Apr 2013 18:26:29 -0700 Subject: [PATCH 086/184] Moved 'excerpt' var below 'title'. --- site/_posts/2012-07-01-variables.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/site/_posts/2012-07-01-variables.md b/site/_posts/2012-07-01-variables.md index 1d4b1214..3188ec28 100644 --- a/site/_posts/2012-07-01-variables.md +++ b/site/_posts/2012-07-01-variables.md @@ -151,14 +151,6 @@ following is a reference of the available data.

- -

page.excerpt

-

- - The un-rendered excerpt of the Page. - -

-

page.title

@@ -167,6 +159,14 @@ following is a reference of the available data.

+ +

page.excerpt

+

+ + The un-rendered excerpt of the Page. + +

+

page.url

From 61465053eb367dadf117230d4ae0e7f236570c45 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 18:02:16 +0200 Subject: [PATCH 087/184] Add Jekyll::Logger --- lib/jekyll/logger.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/jekyll/logger.rb diff --git a/lib/jekyll/logger.rb b/lib/jekyll/logger.rb new file mode 100644 index 00000000..fe598a14 --- /dev/null +++ b/lib/jekyll/logger.rb @@ -0,0 +1,42 @@ +module Jekyll + module Logger + # Public: Print a jekyll message to stdout + # + # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. + # message - the message detail + # + # Returns nothing + def info(topic, message) + $stdout.puts Jekyll.message(topic, message) + end + + # Public: Print a jekyll message to stderr + # + # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. + # message - the message detail + # + # Returns nothing + def warn(topic, message) + $stderr.puts Jekyll.message(topic, message) + end + + # Public: Build a Jekyll 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) + formatted_topic(topic) + message.gsub(/\s+/, ' ') + end + + # Public: 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 From bc6748f1399d150440190d4fe0ef351498e587af Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 18:03:38 +0200 Subject: [PATCH 088/184] Add Jekyll::Deprecator --- lib/jekyll/deprecator.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/jekyll/deprecator.rb diff --git a/lib/jekyll/deprecator.rb b/lib/jekyll/deprecator.rb new file mode 100644 index 00000000..02f00d15 --- /dev/null +++ b/lib/jekyll/deprecator.rb @@ -0,0 +1,25 @@ +module Jekyll + class Deprecator + def self.process(args) + deprecation_message args, "--server", "The --server command has been replaced by the \ + 'serve' subcommand." + deprecation_message args, "--no-server", "To build Jekyll without launching a server, \ + use the 'build' subcommand." + deprecation_message args, "--auto", "The switch '--auto' has been replaced with '--watch'." + deprecation_message args, "--no-auto", "To disable auto-replication, simply leave off \ + the '--watch' switch." + deprecation_message args, "--pygments", "The 'pygments' setting can only be set in \ + your config files." + deprecation_message args, "--paginate", "The 'paginate' setting can only be set in your \ + config files." + deprecation_message args, "--url", "The 'url' setting can only be set in your config files." + end + + def self.deprecation_message(args, deprecated_argument, message) + if args.include?(deprecated_argument) + Jekyll.warn "Deprecation:", message + exit(1) + end + end + end +end From a355762190c2d4e656d5fc492a9ce798d063232b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 18:04:37 +0200 Subject: [PATCH 089/184] Run Jekyll::Deprecator.process upon invocation of Jekyll --- bin/jekyll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/jekyll b/bin/jekyll index 79c368d8..7556a317 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -6,6 +6,8 @@ $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib }) require 'commander/import' require 'jekyll' +Jekyll::Deprecator.process(ARGV) + program :name, 'jekyll' program :version, Jekyll::VERSION program :description, 'Jekyll is a blog-aware, static site generator in Ruby' From c5f6e527b5017a92cac5319079a095190ba449da Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 18:05:03 +0200 Subject: [PATCH 090/184] Bring Logger and Deprecator into the fold --- lib/jekyll.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 78572491..1941a794 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -28,6 +28,8 @@ require 'pygments' # internal requires require 'jekyll/core_ext' +require 'jekyll/logger' +require 'jekyll/deprecator' require 'jekyll/configuration' require 'jekyll/site' require 'jekyll/convertible' @@ -55,6 +57,8 @@ SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll VERSION = '1.0.0.beta4' + extend Logger + # Public: Generate a Jekyll configuration Hash by merging the default # options with anything in _config.yml, and adding the given options on top. # From 17f97cdbab1067844c32f52eb626a3862b24be13 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 18:22:34 +0200 Subject: [PATCH 091/184] Move manual printing to Jekyll.info and Jekyll.warn --- lib/jekyll/command.rb | 6 +++--- lib/jekyll/commands/build.rb | 10 +++++----- lib/jekyll/configuration.rb | 13 ++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 1f305a3c..a7678c30 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -18,9 +18,9 @@ module Jekyll site.process rescue Jekyll::FatalException => e puts - puts "ERROR: YOUR SITE COULD NOT BE BUILT:" - puts "------------------------------------" - puts e.message + Jekyll.warn "ERROR:", "YOUR SITE COULD NOT BE BUILT:" + Jekyll.warn "", "------------------------------------" + Jekyll.warn "", e.message exit(1) end end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 2ee78d22..a40d261f 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -17,9 +17,9 @@ module Jekyll def self.build(site, options) source = options['source'] destination = options['destination'] - puts " Source: #{source}" - puts " Destination: #{destination}" - print " Generating... " + Jekyll.info "Source:", source + Jekyll.info "Destination:", destination + print Jekyll.formatted_topic "Generating..." self.process_site(site) puts "done." end @@ -36,14 +36,14 @@ module Jekyll source = options['source'] destination = options['destination'] - puts " Auto-regeneration: enabled" + Jekyll.info "Auto-regeneration:", "enabled" dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true) dw.interval = 1 dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") - print " Regenerating: #{args.size} files at #{t} " + print Jekyll.formatted_topic("Regenerating:") + "#{args.size} files at #{t} " self.process_site(site) puts "...done." end diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index f0617744..19deaf32 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -104,7 +104,7 @@ module Jekyll configuration = dup next_config = YAML.safe_load_file(file) raise "Configuration file: (INVALID) #{file}" if !next_config.is_a?(Hash) - $stdout.puts "Configuration file: #{file}" + Jekyll.info "Configuration file:", file configuration.deep_merge(next_config) end @@ -123,12 +123,11 @@ module Jekyll end rescue SystemCallError # Errno:ENOENT = file not found - $stderr.puts "Configuration file: none" + Jekyll.warn "Configuration file:", "none" rescue => err - $stderr.puts " " + - "WARNING: Error reading configuration. " + + Jekyll.warn "WARNING", "Error reading configuration. " + "Using defaults (and options)." - $stderr.puts "#{err}" + Jekyll.warn "", "#{err}" end configuration.backwards_compatibilize @@ -141,8 +140,8 @@ module Jekyll def backwards_compatibilize config = dup # Provide backwards-compatibility - if config['auto'] - $stderr.puts "Deprecation: ".rjust(20) + "'auto' has been changed to " + + if config.has_key? 'auto' + Jekyll.warn "Deprecation:", "'auto' has been changed to " + "'watch'. Please update your configuration to use 'watch'." config['watch'] = config['auto'] end From e7815d873c93982804e722706c6432ec98f78165 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Sat, 13 Apr 2013 12:37:38 -0400 Subject: [PATCH 092/184] Add implicit defaults to DEFAULTS --- lib/jekyll/configuration.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index f0617744..0810276f 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -8,8 +8,12 @@ module Jekyll 'destination' => File.join(Dir.pwd, '_site'), 'plugins' => '_plugins', 'layouts' => '_layouts', - 'keep_files' => ['.git','.svn'], + 'keep_files' => ['.git','.svn'], + 'safe' => false, + 'show_drafts' => nil, + 'limit_posts' => nil, + 'lsi' => false, 'future' => true, # remove and make true just default 'pygments' => true, # remove and make true just default @@ -17,6 +21,7 @@ module Jekyll 'permalink' => 'date', 'baseurl' => '/', 'include' => ['.htaccess'], + 'exclude' => [], 'paginate_path' => 'page:num', 'markdown_ext' => 'markdown,mkd,mkdn,md', From 028e580bb85b4daa660b037b9ba686f877740c4c Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Sat, 13 Apr 2013 12:39:49 -0400 Subject: [PATCH 093/184] Remove short-circuits from Site --- lib/jekyll/site.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 6e23edf4..1354cb67 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -23,12 +23,12 @@ module Jekyll self.pygments = config['pygments'] self.baseurl = config['baseurl'] self.permalink_style = config['permalink'].to_sym - self.exclude = config['exclude'] || [] - self.include = config['include'] || [] + self.exclude = config['exclude'] + self.include = config['include'] self.future = config['future'] - self.show_drafts = config['show_drafts'] || nil - self.limit_posts = config['limit_posts'] || nil - self.keep_files = config['keep_files'] || [] + self.show_drafts = config['show_drafts'] + self.limit_posts = config['limit_posts'] + self.keep_files = config['keep_files'] self.reset self.setup From 485b37e3d14941f486b38d454fc8b9afd4fb724f Mon Sep 17 00:00:00 2001 From: "Benjamin J. Balter" Date: Sat, 13 Apr 2013 12:41:03 -0400 Subject: [PATCH 094/184] move template site to default markdown renderer --- lib/site_template/_config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/site_template/_config.yml b/lib/site_template/_config.yml index 6d67c09e..b136b575 100644 --- a/lib/site_template/_config.yml +++ b/lib/site_template/_config.yml @@ -1,2 +1 @@ -markdown: rdiscount pygments: true From cef0a80897e8394d51316272e22c7cf32d1fa617 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 19:27:21 +0200 Subject: [PATCH 095/184] Update history to reflect merge of #961 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 47dad7d6..b444bf77 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 97dbadb5dd90cf65861dd6586c30cff085e64711 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 19:46:25 +0200 Subject: [PATCH 096/184] Add colorator gem --- jekyll.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/jekyll.gemspec b/jekyll.gemspec index 4bff92df..21977b6e 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -31,6 +31,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('pygments.rb', "~> 0.4.2") s.add_runtime_dependency('commander', "~> 4.1.3") s.add_runtime_dependency('safe_yaml', "~> 0.7.0") + s.add_runtime_dependency('colorator', "~> 0.1") s.add_development_dependency('rake', "~> 10.0.3") s.add_development_dependency('rdoc', "~> 3.11") From b99baeae27135c1978d6c1e867ef9b5ebca2bcc4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 19:58:41 +0200 Subject: [PATCH 097/184] Colorize warns as yellow --- lib/jekyll.rb | 1 + lib/jekyll/logger.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 1941a794..4b385fb2 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -25,6 +25,7 @@ require 'English' require 'liquid' require 'maruku' require 'pygments' +require 'colorator' # internal requires require 'jekyll/core_ext' diff --git a/lib/jekyll/logger.rb b/lib/jekyll/logger.rb index fe598a14..e7af4563 100644 --- a/lib/jekyll/logger.rb +++ b/lib/jekyll/logger.rb @@ -17,7 +17,7 @@ module Jekyll # # Returns nothing def warn(topic, message) - $stderr.puts Jekyll.message(topic, message) + $stderr.puts (Jekyll.message(topic, message)).yellow end # Public: Build a Jekyll topic method From f69a716d933191211f81c39400a2257667b8f157 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Balter" Date: Sat, 13 Apr 2013 14:09:58 -0400 Subject: [PATCH 098/184] Update quickstart instructions with `new` command Quickstart instructions as written would serve an empty directory. They instruct the user to install Jekyll (:metal), `cd` to a directory that may not exist, and then run `jekyll serve` (:hurtrealbad:). Instead, lets have them run `jekyll new` to stand up a scaffold site, so they can see how things work and poke around a bit. It's one more command, but IMHO a better user experience for someone just getting started. --- site/index.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/site/index.html b/site/index.html index c0a35828..4cc8917b 100644 --- a/site/index.html +++ b/site/index.html @@ -49,10 +49,15 @@ overview: true

~ $ - cd my/awesome/site + jekyll new my-awesome-site

- ~/my/awesome/site + ~ + $ + cd my-awesome-site +

+

+ ~/my-awesome-site $ jekyll serve

From ef9d8ddb7d6fb4eefc2f655fe6c6264af89a59f9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 20:24:45 +0200 Subject: [PATCH 099/184] Matching tests to new colorized output --- lib/jekyll/configuration.rb | 6 +++--- test/test_configuration.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 19deaf32..e67300a7 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -103,7 +103,7 @@ module Jekyll def read_config_file(file) configuration = dup next_config = YAML.safe_load_file(file) - raise "Configuration file: (INVALID) #{file}" if !next_config.is_a?(Hash) + raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash) Jekyll.info "Configuration file:", file configuration.deep_merge(next_config) end @@ -125,9 +125,9 @@ module Jekyll # Errno:ENOENT = file not found Jekyll.warn "Configuration file:", "none" rescue => err - Jekyll.warn "WARNING", "Error reading configuration. " + + Jekyll.warn "WARNING:", "Error reading configuration. " + "Using defaults (and options)." - Jekyll.warn "", "#{err}" + $stderr.puts "#{err}" end configuration.backwards_compatibilize diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 6eb35fc4..6e4675c6 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -64,7 +64,7 @@ class TestConfiguration < Test::Unit::TestCase should "fire warning with no _config.yml" do mock(YAML).safe_load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } - mock($stderr).puts("Configuration file: none") + mock($stderr).puts("Configuration file: none".yellow) assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({}) end @@ -76,8 +76,8 @@ class TestConfiguration < Test::Unit::TestCase should "fire warning with bad config" do mock(YAML).safe_load_file(@path) { Array.new } - mock($stderr).puts(" WARNING: Error reading configuration. Using defaults (and options).") - mock($stderr).puts("Configuration file: (INVALID) #{@path}") + 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 end From ef51b0f9e4d753ab39e2c09f874c15545fdc7164 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 20:27:44 +0200 Subject: [PATCH 100/184] Error message is red --- lib/jekyll/deprecator.rb | 2 +- lib/jekyll/logger.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/deprecator.rb b/lib/jekyll/deprecator.rb index 02f00d15..642f6f48 100644 --- a/lib/jekyll/deprecator.rb +++ b/lib/jekyll/deprecator.rb @@ -17,7 +17,7 @@ module Jekyll def self.deprecation_message(args, deprecated_argument, message) if args.include?(deprecated_argument) - Jekyll.warn "Deprecation:", message + Jekyll.error "Deprecation:", message exit(1) end end diff --git a/lib/jekyll/logger.rb b/lib/jekyll/logger.rb index e7af4563..6b30ad95 100644 --- a/lib/jekyll/logger.rb +++ b/lib/jekyll/logger.rb @@ -20,6 +20,16 @@ module Jekyll $stderr.puts (Jekyll.message(topic, message)).yellow end + # Public: Print a jekyll error message to stderr + # + # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. + # message - the message detail + # + # Returns nothing + def error(topic, message) + $stderr.puts (Jekyll.message(topic, message)).red + end + # Public: Build a Jekyll topic method # # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. From db3a2ab941c38c7401f29a468ac524fdce2ea1b6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 20:39:52 +0200 Subject: [PATCH 101/184] Update history to reflect merge of #966 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index b444bf77..83c2450f 100644 --- a/History.txt +++ b/History.txt @@ -61,6 +61,7 @@ * Add SVG support to Jekyll/WEBrick. (#407, #406) * Prevent custom destination from causing continuous regen on watch (#528, #820, #862) * Site Enhancements + * Update quickstart instructions with `new` command (#966) * Clean up site docs to prepare for 1.0 release (#918) * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) From 0ba7bc12b095d10d959f4163ee42e54279c71c0a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 20:41:43 +0200 Subject: [PATCH 102/184] Update history to reflect merge of #956 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 83c2450f..4ac2a788 100644 --- a/History.txt +++ b/History.txt @@ -62,6 +62,7 @@ * Prevent custom destination from causing continuous regen on watch (#528, #820, #862) * Site Enhancements * Update quickstart instructions with `new` command (#966) + * Add docs for page.excerpt (#956) * Clean up site docs to prepare for 1.0 release (#918) * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) From 7557e732a294d53cda924655a137473b7c4ced8e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 20:42:35 +0200 Subject: [PATCH 103/184] Update history to reflect addition of docs for page.path #951 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 4ac2a788..e5e48d8e 100644 --- a/History.txt +++ b/History.txt @@ -63,6 +63,7 @@ * Site Enhancements * 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) From 30b49e7d4df8e68cfc082d6566bc221dc793a242 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 04:22:29 +0200 Subject: [PATCH 104/184] Update history to reflect merge of #907 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index e5e48d8e..845ddd41 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 7a7990fb9afce1606d9d4e487f5ae5148860132b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 05:23:42 +0200 Subject: [PATCH 105/184] Moved markdown converters into lib/jekyll/converters/markdown --- lib/jekyll.rb | 2 +- lib/jekyll/converters/{parsers => markdown}/kramdown_parser.rb | 0 lib/jekyll/converters/{parsers => markdown}/maruku_parser.rb | 0 lib/jekyll/converters/{parsers => markdown}/rdiscount_parser.rb | 0 lib/jekyll/converters/{parsers => markdown}/redcarpet_parser.rb | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename lib/jekyll/converters/{parsers => markdown}/kramdown_parser.rb (100%) rename lib/jekyll/converters/{parsers => markdown}/maruku_parser.rb (100%) rename lib/jekyll/converters/{parsers => markdown}/rdiscount_parser.rb (100%) rename lib/jekyll/converters/{parsers => markdown}/redcarpet_parser.rb (100%) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index f8a65409..58318011 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -46,7 +46,7 @@ require 'jekyll/command' require_all 'jekyll/commands' require_all 'jekyll/converters' -require_all 'jekyll/converters/parsers' +require_all 'jekyll/converters/markdown' require_all 'jekyll/generators' require_all 'jekyll/tags' diff --git a/lib/jekyll/converters/parsers/kramdown_parser.rb b/lib/jekyll/converters/markdown/kramdown_parser.rb similarity index 100% rename from lib/jekyll/converters/parsers/kramdown_parser.rb rename to lib/jekyll/converters/markdown/kramdown_parser.rb diff --git a/lib/jekyll/converters/parsers/maruku_parser.rb b/lib/jekyll/converters/markdown/maruku_parser.rb similarity index 100% rename from lib/jekyll/converters/parsers/maruku_parser.rb rename to lib/jekyll/converters/markdown/maruku_parser.rb diff --git a/lib/jekyll/converters/parsers/rdiscount_parser.rb b/lib/jekyll/converters/markdown/rdiscount_parser.rb similarity index 100% rename from lib/jekyll/converters/parsers/rdiscount_parser.rb rename to lib/jekyll/converters/markdown/rdiscount_parser.rb diff --git a/lib/jekyll/converters/parsers/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb similarity index 100% rename from lib/jekyll/converters/parsers/redcarpet_parser.rb rename to lib/jekyll/converters/markdown/redcarpet_parser.rb From 91b9d974b238146caa26acc992b68734b418a49a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 05:26:32 +0200 Subject: [PATCH 106/184] Update history to reflect merge of #955 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 845ddd41..1573323a 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 64702f2fafe1e095655f723d1e6a5f4d29f5c5ae Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Sun, 14 Apr 2013 09:52:30 +0200 Subject: [PATCH 107/184] minor test fix: the variable is named page.path --- features/post_data.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/post_data.feature b/features/post_data.feature index 04c385ac..5ed7e862 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -153,7 +153,7 @@ Feature: Post data 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 post.path variable + Scenario Outline: Use page.path variable Given I have a /_posts directory And I have the following post in "": | title | type | date | content | From 4ef107f3e811f48c8e674762944c3733ce4f2e03 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 19:27:19 +0200 Subject: [PATCH 108/184] Remove Logger methods from main Jekyll module. --- lib/jekyll.rb | 2 -- lib/jekyll/command.rb | 6 +++--- lib/jekyll/commands/build.rb | 8 ++++---- lib/jekyll/configuration.rb | 8 ++++---- lib/jekyll/deprecator.rb | 2 +- lib/jekyll/logger.rb | 16 ++++++++-------- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 4b385fb2..cbc0d3ae 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -58,8 +58,6 @@ SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll VERSION = '1.0.0.beta4' - extend Logger - # Public: Generate a Jekyll configuration Hash by merging the default # options with anything in _config.yml, and adding the given options on top. # diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index a7678c30..a352028b 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -18,9 +18,9 @@ module Jekyll site.process rescue Jekyll::FatalException => e puts - Jekyll.warn "ERROR:", "YOUR SITE COULD NOT BE BUILT:" - Jekyll.warn "", "------------------------------------" - Jekyll.warn "", e.message + Jekyll::Logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:" + Jekyll::Logger.error "", "------------------------------------" + Jekyll::Logger.error "", e.message exit(1) end end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index a40d261f..e559ff4f 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -17,9 +17,9 @@ module Jekyll def self.build(site, options) source = options['source'] destination = options['destination'] - Jekyll.info "Source:", source - Jekyll.info "Destination:", destination - print Jekyll.formatted_topic "Generating..." + Jekyll::Logger.info "Source:", source + Jekyll::Logger.info "Destination:", destination + print Jekyll::Logger.formatted_topic "Generating..." self.process_site(site) puts "done." end @@ -36,7 +36,7 @@ module Jekyll source = options['source'] destination = options['destination'] - Jekyll.info "Auto-regeneration:", "enabled" + Jekyll::Logger.info "Auto-regeneration:", "enabled" dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true) dw.interval = 1 diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index e67300a7..074d13c3 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -104,7 +104,7 @@ module Jekyll configuration = dup next_config = YAML.safe_load_file(file) raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash) - Jekyll.info "Configuration file:", file + Jekyll::Logger.info "Configuration file:", file configuration.deep_merge(next_config) end @@ -123,9 +123,9 @@ module Jekyll end rescue SystemCallError # Errno:ENOENT = file not found - Jekyll.warn "Configuration file:", "none" + Jekyll::Logger.warn "Configuration file:", "none" rescue => err - Jekyll.warn "WARNING:", "Error reading configuration. " + + Jekyll::Logger.warn "WARNING:", "Error reading configuration. " + "Using defaults (and options)." $stderr.puts "#{err}" end @@ -141,7 +141,7 @@ module Jekyll config = dup # Provide backwards-compatibility if config.has_key? 'auto' - Jekyll.warn "Deprecation:", "'auto' has been changed to " + + Jekyll::Logger.warn "Deprecation:", "'auto' has been changed to " + "'watch'. Please update your configuration to use 'watch'." config['watch'] = config['auto'] end diff --git a/lib/jekyll/deprecator.rb b/lib/jekyll/deprecator.rb index 642f6f48..88e959b7 100644 --- a/lib/jekyll/deprecator.rb +++ b/lib/jekyll/deprecator.rb @@ -17,7 +17,7 @@ module Jekyll def self.deprecation_message(args, deprecated_argument, message) if args.include?(deprecated_argument) - Jekyll.error "Deprecation:", message + Jekyll::Logger.error "Deprecation:", message exit(1) end end diff --git a/lib/jekyll/logger.rb b/lib/jekyll/logger.rb index 6b30ad95..74a1bdc4 100644 --- a/lib/jekyll/logger.rb +++ b/lib/jekyll/logger.rb @@ -6,8 +6,8 @@ module Jekyll # message - the message detail # # Returns nothing - def info(topic, message) - $stdout.puts Jekyll.message(topic, message) + def self.info(topic, message) + $stdout.puts message(topic, message) end # Public: Print a jekyll message to stderr @@ -16,8 +16,8 @@ module Jekyll # message - the message detail # # Returns nothing - def warn(topic, message) - $stderr.puts (Jekyll.message(topic, message)).yellow + def self.warn(topic, message) + $stderr.puts message(topic, message).yellow end # Public: Print a jekyll error message to stderr @@ -26,8 +26,8 @@ module Jekyll # message - the message detail # # Returns nothing - def error(topic, message) - $stderr.puts (Jekyll.message(topic, message)).red + def self.error(topic, message) + $stderr.puts message(topic, message).red end # Public: Build a Jekyll topic method @@ -36,7 +36,7 @@ module Jekyll # message - the message detail # # Returns the formatted message - def message(topic, message) + def self.message(topic, message) formatted_topic(topic) + message.gsub(/\s+/, ' ') end @@ -45,7 +45,7 @@ module Jekyll # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc. # # Returns the formatted topic statement - def formatted_topic(topic) + def self.formatted_topic(topic) "#{topic} ".rjust(20) end end From 85fc27bdd5bea292c8ac4ce92fb4e34a8ed0c683 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:06:58 +0200 Subject: [PATCH 109/184] Update history to reflect merge of #959. --- History.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.txt b/History.txt index 1573323a..90d00fb2 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,8 @@ * 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 + * 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) From e0335e21673f7f9c3511975cc439b4aeb9199b56 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:21:39 +0200 Subject: [PATCH 110/184] .formatted_topic has moved back to Jekyll::Logger. Update Build.watch to use it --- lib/jekyll/commands/build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index e559ff4f..148869df 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -43,7 +43,7 @@ module Jekyll dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") - print Jekyll.formatted_topic("Regenerating:") + "#{args.size} files at #{t} " + print Jekyll::Logger.formatted_topic("Regenerating:") + "#{args.size} files at #{t} " self.process_site(site) puts "...done." end From e531925caecdf6521bd11b5ed9ca65fe6dde64f8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 23:04:20 +0200 Subject: [PATCH 111/184] Fixes multiple config loading. Closes #973. Rel: #945. --- bin/jekyll | 5 ++--- lib/jekyll/configuration.rb | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 7556a317..db912011 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -46,7 +46,7 @@ command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' - c.option '--config [CONFIG_FILE]', Array, 'Custom configuration file' + c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' @@ -54,7 +54,6 @@ command :build do |c| c.option '--drafts', 'Render posts in the _drafts folder' c.action do |args, options| - options.defaults :serving => false options = normalize_options(options.__hash__) options = Jekyll.configuration(options) Jekyll::Commands::Build.process(options) @@ -65,7 +64,7 @@ command :serve do |c| c.syntax = 'jekyll serve [options]' c.description = 'Serve your site locally' - c.option '--config [CONFIG_FILE]', Array,'Custom configuration file' + c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 0dc1b63b..1b7bd4cb 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -106,7 +106,7 @@ module Jekyll # # Returns this configuration, overridden by the values in the file def read_config_file(file) - configuration = dup + configuration = clone next_config = YAML.safe_load_file(file) raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash) Jekyll::Logger.info "Configuration file:", file @@ -120,7 +120,7 @@ module Jekyll # Returns the full configuration, with the defaults overridden by the values in the # configuration files def read_config_files(files) - configuration = dup + configuration = clone begin files.each do |config_file| @@ -143,7 +143,7 @@ module Jekyll # # Returns the backwards-compatible configuration def backwards_compatibilize - config = dup + config = clone # Provide backwards-compatibility if config.has_key? 'auto' Jekyll::Logger.warn "Deprecation:", "'auto' has been changed to " + From 55a964a7dac1a39fb775208dd2340de998b29de1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 23:18:47 +0200 Subject: [PATCH 112/184] Print deprecation warnings for 'server', 'watch' and 'auto' when loaded from files. Fixes #972 --- lib/jekyll/configuration.rb | 17 +++++++++++++---- site/_config.yml | 2 -- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 1b7bd4cb..9433a015 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -145,10 +145,19 @@ module Jekyll def backwards_compatibilize config = clone # Provide backwards-compatibility - if config.has_key? 'auto' - Jekyll::Logger.warn "Deprecation:", "'auto' has been changed to " + - "'watch'. Please update your configuration to use 'watch'." - config['watch'] = config['auto'] + if config.has_key?('auto') || config.has_key?('watch') + Jekyll::Logger.warn "Deprecation:", "Auto-regeneration can no longer" + + " be set from your configuration file(s). Use the"+ + " --watch/-w command-line option instead." + config.delete('auto') + config.delete('watch') + end + + if config.has_key? 'server' + Jekyll::Logger.warn "Deprecation:", "The 'server' configuration option" + + " is no longer accepted. Use the 'jekyll serve'" + + " subcommand to serve your site with WEBrick." + config.delete('server') end config diff --git a/site/_config.yml b/site/_config.yml index 79be19f5..2de2c7ff 100644 --- a/site/_config.yml +++ b/site/_config.yml @@ -1,5 +1,3 @@ -auto: false -server: true permalink: /docs/:categories/:title pygments: true gauges_id: 503c5af6613f5d0f19000027 From f7310f554e45765c9e0076fb864b4907e8d4c9da Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 00:32:04 +0200 Subject: [PATCH 113/184] Whitespace in post.rb --- lib/jekyll/post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 5ea56898..44979309 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -39,7 +39,7 @@ module Jekyll self.categories = dir.downcase.split('/').reject { |x| x.empty? } self.process(name) - begin + begin self.read_yaml(@base, name) rescue Exception => msg raise FatalException.new("#{msg} in #{@base}/#{name}") @@ -246,7 +246,7 @@ module Jekyll do_layout(payload, layouts) end - + # Obtain destination path. # # dest - The String path to the destination dir. From 5bcce7a1f1659870fb44977fad7f4e8afe180377 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 00:41:46 +0200 Subject: [PATCH 114/184] Fix unit tests for Configuration#backwards_compatibilize --- test/test_configuration.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 6e4675c6..f94b159a 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -50,11 +50,21 @@ class TestConfiguration < Test::Unit::TestCase end context "#backwards_compatibilize" do setup do - @config = Configuration[{"auto" => true}] + @config = Configuration[{ + "auto" => true, + "watch" => true, + "server" => true + }] end - should "create 'watch' key for 'auto'" do - assert @config.backwards_compatibilize.has_key? "watch" - assert_equal true, @config.backwards_compatibilize["watch"] + should "unset 'auto' and 'watch'" do + assert @config.has_key?("auto") + assert @config.has_key?("watch") + assert !@config.backwards_compatibilize.has_key?("auto") + assert !@config.backwards_compatibilize.has_key?("watch") + end + should "unset 'server'" do + assert @config.has_key?("server") + assert !@config.backwards_compatibilize.has_key?("server") end end context "loading configuration" do From b249289b9d01091d0423f869a4fc9d07ebf0c283 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 16:40:05 +0200 Subject: [PATCH 115/184] Set the timezone for the process --- lib/jekyll.rb | 16 +++++++++++++++- lib/jekyll/configuration.rb | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index d8eb7a54..f4bea173 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -73,6 +73,20 @@ module Jekyll config = config.read_config_files(config.config_files(override)) # Merge DEFAULTS < _config.yml < override - config.deep_merge(override).stringify_keys + config = config.deep_merge(override).stringify_keys + set_timezone(config) + + config + end + + # Static: Set the TZ environment variable to use the timezone specified + # + # config - the Jekyll::Configuration generated by Jekyll.configuration + # + # Returns nothing + def self.set_timezone(config) + if config['timezone'] + ENV['TZ'] = config['timezone'] + end end end diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 9433a015..7d676bfd 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -10,6 +10,8 @@ module Jekyll 'layouts' => '_layouts', 'keep_files' => ['.git','.svn'], + 'timezone' => nil # use the local timezone + 'safe' => false, 'show_drafts' => nil, 'limit_posts' => nil, From c0a2d0f88835629a1bb3f8aae164a44fed6a3b52 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Apr 2013 16:45:42 +0200 Subject: [PATCH 116/184] Fixed syntax error --- lib/jekyll/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 7d676bfd..3544b98b 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -10,7 +10,7 @@ module Jekyll 'layouts' => '_layouts', 'keep_files' => ['.git','.svn'], - 'timezone' => nil # use the local timezone + 'timezone' => nil, # use the local timezone 'safe' => false, 'show_drafts' => nil, From d6a08b093ac1f4e96f2b84dca7b10fc97c426944 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:20:56 +0200 Subject: [PATCH 117/184] Add docs for timezone setting. --- site/_posts/2012-07-01-configuration.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index 30e20f8d..bca5dc69 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -81,6 +81,21 @@ class="flag">flags (specified on the command-line) that control them.

include: [DIR, FILE, ...]

+ + +

Time Zone

+

+ Set the time zone for site generation. This sets the TZ + shell environment variable, which Ruby uses to handle time and date + creation and manipulation. Any entry from the + IANA Time Zone + Database is valid. +

+ + +

timezone: TIMEZONE

+ + From fbf818b6181044ab751a66121120f9ae82c97022 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:23:20 +0200 Subject: [PATCH 118/184] Add example TZ and default value note. --- site/_posts/2012-07-01-configuration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index bca5dc69..11cb9dd5 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -89,7 +89,8 @@ class="flag">flags (specified on the command-line) that control them. shell environment variable, which Ruby uses to handle time and date creation and manipulation. Any entry from the IANA Time Zone - Database is valid. + Database is valid, e.g. America/New_York. The default + is the local time zone, as set by your operating system.

From b51b796a1e558e384e71b3da9cd3556c38cc468a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:59:31 +0200 Subject: [PATCH 119/184] Feature for timezone switching --- features/site_configuration.feature | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index c07a3c73..f5974d0b 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -116,6 +116,34 @@ Feature: Site configuration 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 + 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 }} 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 | + | time | 2013-04-10 | + | 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 + Then the _site directory should exist + And I should see "Page Layout: 2 on 2013-04-10" in "_site/index.html" + And I should see "Post Layout:

content for entry1.

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.

built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" + And I have a configuration file with: + | key | value | + | timezone | Australia/Melbourne | + When I run jekyll + Then the _site directory should exist + And I should see "Page Layout: 2 on 2013-04-10" in "_site/index.html" + And I should see "Post Layout:

content for entry1.

built at 2013-04-10T13:14:00+10:00" in "_site/2013/04/10/entry1.html" + And I should see "Post Layout:

content for entry2.

built at 2013-04-10T17:14:00+10:00" in "_site/2013/04/10/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: From 48795462c2896f68ddd2a69e1c63fb4ea29b541b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 20:59:40 +0200 Subject: [PATCH 120/184] Cucumber: remove test dir if it's there --- features/step_definitions/jekyll_steps.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index fd58679d..65556d37 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -1,4 +1,7 @@ Before do + if File.directory?(TEST_DIR) + FileUtils.rm_rf(TEST_DIR) + end FileUtils.mkdir(TEST_DIR) Dir.chdir(TEST_DIR) end From df868b308a624ecd7b87eee1c42977ab6aec08f6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 14 Apr 2013 21:00:03 +0200 Subject: [PATCH 121/184] Set Jekyll path relative to the env file, not to CWD --- features/support/env.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/support/env.rb b/features/support/env.rb index 7e550c6c..8522fa7d 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -7,7 +7,7 @@ World do end TEST_DIR = File.join('/', 'tmp', 'jekyll') -JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll') +JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll') def run_jekyll(opts = {}) command = JEKYLL_PATH.clone From 9c57fad430d5a7a08923da49b35710962ae95cc0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 00:31:40 +0200 Subject: [PATCH 122/184] Finished feature for timezone shifting. --- features/site_configuration.feature | 32 ++++++++++++++++------- features/step_definitions/jekyll_steps.rb | 19 ++++++++++++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index f5974d0b..90afd919 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -116,33 +116,45 @@ Feature: Site configuration 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 + Scenario: Generate proper dates with explicitly set timezone (which is the same) 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 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 | - | time | 2013-04-10 | | 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. | + | 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 Then the _site directory should exist - And I should see "Page Layout: 2 on 2013-04-10" in "_site/index.html" + And I should see "Page Layout: 2" in "_site/index.html" And I should see "Post Layout:

content for entry1.

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.

built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" + + Scenario: Generate proper dates with explicitly set timezone, which is very different + 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 | Australia/Melbourne | + 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 Then the _site directory should exist - And I should see "Page Layout: 2 on 2013-04-10" in "_site/index.html" - And I should see "Post Layout:

content for entry1.

built at 2013-04-10T13:14:00+10:00" in "_site/2013/04/10/entry1.html" - And I should see "Post Layout:

content for entry2.

built at 2013-04-10T17:14:00+10:00" in "_site/2013/04/10/entry2.html" + And I should see "Page Layout: 2" in "_site/index.html" + And the "_site/2013/04/10/entry1.html" file should exist + And the "_site/2013/04/10/entry2.html" file should exist + And I should see escaped "Post Layout:

content for entry1.

built at 2013-04-10T13:22:00+10:00" in "_site/2013/04/10/entry1.html" + And I should see escaped "Post Layout:

content for entry2.

built at 2013-04-10T17:14:00+10:00" in "_site/2013/04/10/entry2.html" Scenario: Limit the number of posts generated by most recent date Given I have a _posts directory diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 65556d37..c56ec42e 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -64,7 +64,15 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire if "draft" == status path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}") else - date = Date.strptime(post['date'], '%m/%d/%Y').strftime('%Y-%m-%d') + date = if post['date'].split.size > 1 + parsed_date = DateTime.strptime(post['date'], '%Y-%m-%d %H:%M %z') + post['date'] = parsed_date.to_s + parsed_date.strftime('%Y-%m-%d') + else + parsed_date = Date.strptime(post['date'], '%m/%d/%Y') # WHY WOULD YOU EVER DO THIS + post['date'] = parsed_date.to_s + parsed_date.strftime('%Y-%m-%d') + end path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}") end @@ -72,6 +80,9 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire %w(title layout tag tags category categories published author path).each do |key| matter_hash[key] = post[key] if post[key] end + if "post" == status + matter_hash["date"] = post["date"] if post["date"] + end matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp content = post['content'] @@ -137,7 +148,11 @@ Then /^the (.*) directory should exist$/ do |dir| end Then /^I should see "(.*)" in "(.*)"$/ do |text, file| - assert_match Regexp.new(text), File.open(file).readlines.join + assert Regexp.new(text).match(File.open(file).readlines.join) +end + +Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file| + assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join) end Then /^the "(.*)" file should exist$/ do |file| From 88e68e038a34896331661918aa723784f570bfa0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 14:32:14 +0200 Subject: [PATCH 123/184] Extract out date parsing in feature steps --- features/step_definitions/jekyll_steps.rb | 13 ++++++------- features/support/env.rb | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index c56ec42e..6dc88f14 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -64,15 +64,14 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire if "draft" == status path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}") else - date = if post['date'].split.size > 1 - parsed_date = DateTime.strptime(post['date'], '%Y-%m-%d %H:%M %z') - post['date'] = parsed_date.to_s - parsed_date.strftime('%Y-%m-%d') + format = if has_time_component?(post['date']) + '%Y-%m-%d %H:%M %z' else - parsed_date = Date.strptime(post['date'], '%m/%d/%Y') # WHY WOULD YOU EVER DO THIS - post['date'] = parsed_date.to_s - parsed_date.strftime('%Y-%m-%d') + '%m/%d/%Y' # why even end + parsed_date = DateTime.strptime(post['date'], format) + post['date'] = parsed_date.to_s + date = parsed_date.strftime('%Y-%m-%d') path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}") end diff --git a/features/support/env.rb b/features/support/env.rb index 8522fa7d..38bab950 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -17,5 +17,9 @@ def run_jekyll(opts = {}) system command end +def has_time_component?(date_string) + date_string.split(" ").size > 1 +end + # work around "invalid option: --format" cucumber bug (see #296) Test::Unit.run = true if RUBY_VERSION < '1.9' From 83cb01dd596efa600b6bc400f156596cc1fc8b31 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 14:33:52 +0200 Subject: [PATCH 124/184] Using File.exists? more generally instead of File.directory? so /tmp/jekyll is always removed before running tests --- features/step_definitions/jekyll_steps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 6dc88f14..ab0fed53 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -1,5 +1,5 @@ Before do - if File.directory?(TEST_DIR) + if File.exists?(TEST_DIR) FileUtils.rm_rf(TEST_DIR) end FileUtils.mkdir(TEST_DIR) From aa1f52fce82537ccacff17271dec992f240602bb Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 14:35:28 +0200 Subject: [PATCH 125/184] Renamed timezone feature scenarios --- features/site_configuration.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 90afd919..14f29be7 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -116,7 +116,7 @@ Feature: Site configuration 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 (which is the same) + 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 }}" @@ -135,7 +135,7 @@ Feature: Site configuration And I should see "Post Layout:

content for entry1.

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.

built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" - Scenario: Generate proper dates with explicitly set timezone, which is very different + 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 }}" From b68d33ed8bf865621e68cfb8b61614caaae579fe Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 14:37:37 +0200 Subject: [PATCH 126/184] Remove 'shell' from description of changing TZ --- site/_posts/2012-07-01-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index 11cb9dd5..1556d449 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -86,7 +86,7 @@ class="flag">flags (specified on the command-line) that control them.

Time Zone

Set the time zone for site generation. This sets the TZ - shell environment variable, which Ruby uses to handle time and date + environment variable, which Ruby uses to handle time and date creation and manipulation. Any entry from the IANA Time Zone Database is valid, e.g. America/New_York. The default From b4f68baafb533d49843a39bb1ce34299206f5239 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 15:39:36 +0200 Subject: [PATCH 127/184] Jekyll.set_timezone accepts just the timezone, not the config --- lib/jekyll.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index f4bea173..662a471c 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -74,19 +74,17 @@ module Jekyll # Merge DEFAULTS < _config.yml < override config = config.deep_merge(override).stringify_keys - set_timezone(config) + set_timezone(config['timezone']) if config['timezone'] config end # Static: Set the TZ environment variable to use the timezone specified # - # config - the Jekyll::Configuration generated by Jekyll.configuration + # timezone - the IANA Time Zone # # Returns nothing - def self.set_timezone(config) - if config['timezone'] - ENV['TZ'] = config['timezone'] - end + def self.set_timezone(timezone) + ENV['TZ'] = timezone end end From 457e90fd414cb0107f2cf377e44f9c0e123978cd Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 15:42:21 +0200 Subject: [PATCH 128/184] Just remove the darn TEST_DIR --- features/step_definitions/jekyll_steps.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index ab0fed53..c30b9034 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -1,7 +1,5 @@ Before do - if File.exists?(TEST_DIR) - FileUtils.rm_rf(TEST_DIR) - end + FileUtils.rm_rf(TEST_DIR) FileUtils.mkdir(TEST_DIR) Dir.chdir(TEST_DIR) end From 5a8a04391c954f4b2b77ed4573c84dbcf77fc290 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 16:25:42 +0200 Subject: [PATCH 129/184] Update history to reflect merge of #957. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 90d00fb2..19e961e4 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From b7064a4bc39d2e8095726e1082e62be117d6f1b6 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Mon, 15 Apr 2013 17:24:09 +0200 Subject: [PATCH 130/184] remove 'post' and 'page' default layouts --- lib/jekyll/page.rb | 1 - lib/jekyll/post.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 80f5b884..eed47ac3 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -31,7 +31,6 @@ module Jekyll # Returns nothing. def read_yaml(base, name) super(base, name) - self.data['layout'] = 'page' unless self.data.has_key?('layout') self.data end diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 44979309..c210d235 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -82,7 +82,6 @@ module Jekyll def read_yaml(base, name) super(base, name) self.extracted_excerpt = self.extract_excerpt - self.data['layout'] = 'post' unless self.data.has_key?('layout') end # The post excerpt. This is either a custom excerpt From cc5ce06d78b3a639e4eb620ac66fa5346e18c5e0 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Mon, 15 Apr 2013 17:24:18 +0200 Subject: [PATCH 131/184] remove tests for default layouts --- test/test_page.rb | 10 ---------- test/test_post.rb | 14 +------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/test/test_page.rb b/test/test_page.rb index 58e7b1fa..db822405 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -102,16 +102,6 @@ class TestPage < Test::Unit::TestCase assert_equal "/about/", @page.dir end end - - context "with unspecified layout" do - setup do - @page = setup_page('contacts.html') - end - - should "default to 'post' layout" do - assert_equal "page", @page.data["layout"] - end - end context "with specified layout of nil" do setup do diff --git a/test/test_post.rb b/test/test_post.rb index e57c7c6a..9fe29100 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -95,7 +95,7 @@ class TestPost < Test::Unit::TestCase should "consume the embedded dashes" do @post.read_yaml(@source, @real_file) - assert_equal({"title" => "Foo --- Bar", "layout" => "post"}, @post.data) + assert_equal({"title" => "Foo --- Bar"}, @post.data) assert_equal "Triple the fun!", @post.content end end @@ -139,18 +139,6 @@ class TestPost < Test::Unit::TestCase assert_equal "/2013/2008/09/09/foo-bar.html", @post.url end end - - context "with unspecified layout" do - setup do - file = '2013-01-12-no-layout.textile' - @post = setup_post(file) - @post.process(file) - end - - should "default to 'post' layout" do - assert_equal "post", @post.data["layout"] - end - end context "with specified layout of nil" do setup do From e4b8dbc1124e8f64c1ec74e7d17d7e403e2db444 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 19:15:55 +0200 Subject: [PATCH 132/184] Add files to the manifest in the gemspec --- jekyll.gemspec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jekyll.gemspec b/jekyll.gemspec index 21977b6e..b904d9d6 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -73,18 +73,25 @@ Gem::Specification.new do |s| lib/jekyll/commands/build.rb lib/jekyll/commands/new.rb lib/jekyll/commands/serve.rb + lib/jekyll/configuration.rb lib/jekyll/converter.rb lib/jekyll/converters/identity.rb lib/jekyll/converters/markdown.rb + lib/jekyll/converters/markdown/kramdown_parser.rb + lib/jekyll/converters/markdown/maruku_parser.rb + lib/jekyll/converters/markdown/rdiscount_parser.rb + lib/jekyll/converters/markdown/redcarpet_parser.rb lib/jekyll/converters/textile.rb lib/jekyll/convertible.rb lib/jekyll/core_ext.rb + lib/jekyll/deprecator.rb lib/jekyll/draft.rb lib/jekyll/errors.rb lib/jekyll/filters.rb lib/jekyll/generator.rb lib/jekyll/generators/pagination.rb lib/jekyll/layout.rb + lib/jekyll/logger.rb lib/jekyll/mime.types lib/jekyll/page.rb lib/jekyll/plugin.rb @@ -194,6 +201,7 @@ Gem::Specification.new do |s| test/source/_posts/2013-01-12-nil-layout.textile test/source/_posts/2013-01-12-no-layout.textile test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep + test/source/_posts/2013-04-11-custom-excerpt.markdown test/source/about.html test/source/category/_posts/2008-9-23-categories.textile test/source/contacts.html From f6f3aa6218752ddec9a1745b57e5e814295f4af6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 19:21:15 +0200 Subject: [PATCH 133/184] Update history to reflect merge of #977. Repealed #580. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 19e961e4..893381f3 100644 --- a/History.txt +++ b/History.txt @@ -40,6 +40,7 @@ * 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) From e7546a98f6d5e12e381bd09fd022e2bd256a8fbf Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 15 Apr 2013 19:24:23 +0200 Subject: [PATCH 134/184] Remove unnecessary override of #read_yaml in Page. --- lib/jekyll/page.rb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index eed47ac3..4c434564 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -23,17 +23,6 @@ module Jekyll self.read_yaml(File.join(base, dir), name) end - # Read the YAML frontmatter. - # - # base - The String path to the dir containing the file. - # name - The String filename of the file. - # - # Returns nothing. - def read_yaml(base, name) - super(base, name) - self.data - 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 '/' From 82f32d5c02d2f94c6b30d32c9157e6f792527a29 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 16 Apr 2013 00:41:10 +0200 Subject: [PATCH 135/184] Merge configuration properly. Closes #978. --- lib/jekyll/configuration.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 3544b98b..c166e42e 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -108,11 +108,10 @@ module Jekyll # # Returns this configuration, overridden by the values in the file def read_config_file(file) - configuration = clone next_config = YAML.safe_load_file(file) raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash) Jekyll::Logger.info "Configuration file:", file - configuration.deep_merge(next_config) + next_config end # Public: Read in a list of configuration files and merge with this hash @@ -126,7 +125,8 @@ module Jekyll begin files.each do |config_file| - configuration = read_config_file(config_file) + new_config = read_config_file(config_file) + configuration = configuration.deep_merge(new_config) end rescue SystemCallError # Errno:ENOENT = file not found From c0c0150bb5a3d4252a5acab6896f31d2946c869f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 16 Apr 2013 00:47:31 +0200 Subject: [PATCH 136/184] Release 1.0.0.rc1 --- jekyll.gemspec | 4 ++-- lib/jekyll.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index b904d9d6..b49a5895 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -4,9 +4,9 @@ Gem::Specification.new do |s| s.rubygems_version = '1.3.5' s.name = 'jekyll' - s.version = '1.0.0.beta4' + s.version = '1.0.0.rc1' s.license = 'MIT' - s.date = '2013-04-09' + s.date = '2013-04-16' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 662a471c..3d233517 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -57,7 +57,7 @@ require_all 'jekyll/tags' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '1.0.0.beta4' + VERSION = '1.0.0.rc1' # Public: Generate a Jekyll configuration Hash by merging the default # options with anything in _config.yml, and adding the given options on top. From 6ed41e373c83a1e34e209da6a4bcaecb3c05a17c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 16 Apr 2013 02:55:31 +0200 Subject: [PATCH 138/184] Remove code duplication: #write in Page and Post is the same. --- lib/jekyll/convertible.rb | 13 +++++++++++++ lib/jekyll/page.rb | 13 ------------- lib/jekyll/post.rb | 13 ------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index dad0b163..015f88b3 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -118,5 +118,18 @@ module Jekyll end end 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, 'w') do |f| + f.write(self.output) + end + end end end diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 4c434564..2f7803d5 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -129,19 +129,6 @@ module Jekyll path 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, 'w') do |f| - f.write(self.output) - end - end - # Returns the object as a debug String. def inspect "#" diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index c210d235..a7afa800 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -258,19 +258,6 @@ module Jekyll path end - # Write the generated post 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, 'w') do |f| - f.write(self.output) - end - end - # Convert this post into a Hash for use in Liquid templates. # # Returns the representative Hash. From ba64a9fe306eb629df3765a15bd995444b0ed2c1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 16 Apr 2013 18:24:10 +0200 Subject: [PATCH 139/184] Fail if destination directory for jekyll new exists and is not empty. Fixes #981. --- lib/jekyll/commands/new.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index e650dc52..c5219e13 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -8,6 +8,10 @@ module Jekyll new_blog_path = File.expand_path(args.join(" "), Dir.pwd) FileUtils.mkdir_p new_blog_path + unless Dir["#{new_blog_path}/**/*"].empty? + Jekyll::Logger.error "Conflict:", "#{new_blog_path} exists and is not empty." + exit(1) + end create_sample_files new_blog_path From 8d7be33dfb61bb836da18416943d2640424e04be Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:48:17 -0500 Subject: [PATCH 140/184] Wrap at 80 columns --- site/_posts/2012-07-01-frontmatter.md | 3 +- site/_posts/2012-07-01-migrations.md | 75 +++++++++++++++++++++------ site/_posts/2012-07-01-pages.md | 4 +- site/_posts/2012-07-01-pagination.md | 5 +- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/site/_posts/2012-07-01-frontmatter.md b/site/_posts/2012-07-01-frontmatter.md index 337a7388..b5a05ed9 100644 --- a/site/_posts/2012-07-01-frontmatter.md +++ b/site/_posts/2012-07-01-frontmatter.md @@ -35,7 +35,8 @@ relies on. ## Predefined Global Variables -There are a number of predefined global variables that you can set in the front-matter of a page or post. +There are a number of predefined global variables that you can set in the +front-matter of a page or post. diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index e4d85dea..c79fbabd 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -72,7 +72,11 @@ $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; Jekyll::WordPress.process("database", "user", "pass")' {% endhighlight %} -If you are using Webfaction and have to set up an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on `localhost` and `127.0.0.1` not being equivalent in its authentication system: +If you are using Webfaction and have to set up an [SSH +tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), +be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block +your access based on `localhost` and `127.0.0.1` not being equivalent in its +authentication system: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; @@ -81,15 +85,27 @@ $ ruby -rubygems -e 'require "jekyll/migrators/wordpress"; ### Further Wordpress migration alternatives -While the above methods work, they do not import much of the metadata that is usually stored in Wordpress posts and pages. If you need to export things like pages, tags, custom fields, image attachments and so on, the following resources might be useful to you: +While the above methods work, they do not import much of the metadata that is +usually stored in Wordpress posts and pages. If you need to export things like +pages, tags, custom fields, image attachments and so on, the following resources +might be useful to you: -- [Exitwp](https://github.com/thomasf/exitwp) is a configurable tool written in Python for migrating one or more Wordpress blogs into Jekyll (Markdown) format while keeping as much metadata as possible. Exitwp also downloads attachments and pages. -- [A great article](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/) with a step-by-step guide for migrating a Wordpress blog to Jekyll while keeping most of the structure and metadata. -- [wpXml2Jekyll](https://github.com/theaob/wpXml2Jekyll) is an executable windows application for creating Markdown posts from your Wordpress XML file. +- [Exitwp](https://github.com/thomasf/exitwp) is a configurable tool written in + Python for migrating one or more Wordpress blogs into Jekyll (Markdown) format + while keeping as much metadata as possible. Exitwp also downloads attachments + and pages. +- [A great + article](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/) with a + step-by-step guide for migrating a Wordpress blog to Jekyll while keeping most + of the structure and metadata. +- [wpXml2Jekyll](https://github.com/theaob/wpXml2Jekyll) is an executable + windows application for creating Markdown posts from your Wordpress XML file. ## Drupal -If you’re migrating from [Drupal](http://drupal.org), there is [a migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb) for you too: +If you’re migrating from [Drupal](http://drupal.org), there is [a +migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb) +for you too: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/drupal"; @@ -98,7 +114,9 @@ $ ruby -rubygems -e 'require "jekyll/migrators/drupal";
Warning: Drupal Version Compatibility
-

This migrator was written for Drupal 6.1 and may not work as expected on future versions of Drupal. Please update it and send us a pull request if necessary.

+

This migrator was written for Drupal 6.1 and may not work as expected on + future versions of Drupal. Please update it and send us a pull request if + necessary.

## Movable Type @@ -130,7 +148,12 @@ $ ruby -rubygems -e 'require "jekyll/migrators/textpattern"; Jekyll::TextPattern.process("database_name", "username", "password", "hostname")' {% endhighlight %} -You will need to run the above from the parent directory of your `_import` folder. For example, if `_import` is located in `/path/source/_import`, you will need to run this code from `/path/source`. The hostname defaults to `localhost`, all other variables are required. You may need to adjust the code used to filter entries. Left alone, it will attempt to pull all entries that are live or sticky. +You will need to run the above from the parent directory of your `_import` +folder. For example, if `_import` is located in `/path/source/_import`, you will +need to run this code from `/path/source`. The hostname defaults to `localhost`, +all other variables are required. You may need to adjust the code used to filter +entries. Left alone, it will attempt to pull all entries that are live or +sticky. ## Mephisto @@ -150,11 +173,22 @@ $ ruby -rubygems -e 'require "jekyll/migrators/mephisto"; ## Blogger (Blogspot) -To import posts from Blogger, see [this post about migrating from Blogger to Jekyll](http://coolaj86.info/articles/migrate-from-blogger-to-jekyll.html). If that doesn’t work for you, you might want to try some of the following alternatives: +To import posts from Blogger, see [this post about migrating from Blogger to +Jekyll](http://coolaj86.info/articles/migrate-from-blogger-to-jekyll.html). If +that doesn’t work for you, you might want to try some of the following +alternatives: -- [@kennym](https://github.com/kennym) created a [little migration script](https://gist.github.com/1115810), because the solutions in the previous article didn't work out for him. -- [@ngauthier](https://github.com/ngauthier) created [another importer](https://gist.github.com/1506614) that imports comments, and does so via blogger’s archive instead of the RSS feed. -- [@juniorz](https://github.com/juniorz) created [yet another importer](https://gist.github.com/1564581) that works for [Octopress](http://octopress.org). It is like [@ngauthier’s version](https://gist.github.com/1506614) but separates drafts from posts, as well as importing tags and permalinks. +- [@kennym](https://github.com/kennym) created a [little migration + script](https://gist.github.com/1115810), because the solutions in the + previous article didn't work out for him. +- [@ngauthier](https://github.com/ngauthier) created [another + importer](https://gist.github.com/1506614) that imports comments, and does so + via blogger’s archive instead of the RSS feed. +- [@juniorz](https://github.com/juniorz) created [yet another + importer](https://gist.github.com/1564581) that works for + [Octopress](http://octopress.org). It is like [@ngauthier’s + version](https://gist.github.com/1506614) but separates drafts from posts, as + well as importing tags and permalinks. ## Posterous @@ -165,14 +199,17 @@ $ ruby -rubygems -e 'require "jekyll/migrators/posterous"; Jekyll::Posterous.process("my_email", "my_pass")' {% endhighlight %} -For any other Posterous blog on your account, you will need to specify the `blog_id` for the blog: +For any other Posterous blog on your account, you will need to specify the +`blog_id` for the blog: {% highlight bash %} $ ruby -rubygems -e 'require "jekyll/migrators/posterous"; Jekyll::Posterous.process("my_email", "my_pass", "blog_id")' {% endhighlight %} -There is also an [alternative Posterous migrator](https://github.com/pepijndevos/jekyll/blob/patch-1/lib/jekyll/migrators/posterous.rb) that maintains permalinks and attempts to import images too. +There is also an [alternative Posterous +migrator](https://github.com/pepijndevos/jekyll/blob/patch-1/lib/jekyll/migrators/posterous.rb) +that maintains permalinks and attempts to import images too. ## Tumblr @@ -183,9 +220,12 @@ $ ruby -rubygems -e 'require "jekyll/migrators/tumblr"; Jekyll::Tumblr.process("http://www.your_blog_url.com", true)' {% endhighlight %} -There is also [a modified Tumblr migrator](https://github.com/stephenmcd/jekyll/blob/master/lib/jekyll/migrators/tumblr.rb) that exports posts as Markdown and preserves post tags. +There is also [a modified Tumblr +migrator](https://github.com/stephenmcd/jekyll/blob/master/lib/jekyll/migrators/tumblr.rb) +that exports posts as Markdown and preserves post tags. -The migrator above requires the `json` gem and Python's `html2text` to be installed as follows: +The migrator above requires the `json` gem and Python's `html2text` to be +installed as follows: {% highlight bash %} $ gem install json @@ -201,4 +241,5 @@ $ ruby -rubygems -e 'require "jekyll/migrators/tumblr"; ## Other Systems -If you have a system that there isn’t currently a migrator for, you should consider writing one and sending us a pull request. +If you have a system that there isn’t currently a migrator for, you should +consider writing one and sending us a pull request. diff --git a/site/_posts/2012-07-01-pages.md b/site/_posts/2012-07-01-pages.md index c78d6145..6a51d133 100644 --- a/site/_posts/2012-07-01-pages.md +++ b/site/_posts/2012-07-01-pages.md @@ -35,8 +35,8 @@ There are two main ways of creating pages: - Create a folder in the site's root for each page, and place an index.html file in each page folder. -Both methods work fine (and can be used in conjunction with each other), with the -only real difference being the resulting URLs. +Both methods work fine (and can be used in conjunction with each other), +with the only real difference being the resulting URLs. ### Named HTML files diff --git a/site/_posts/2012-07-01-pagination.md b/site/_posts/2012-07-01-pagination.md index f1710d99..d914279a 100644 --- a/site/_posts/2012-07-01-pagination.md +++ b/site/_posts/2012-07-01-pagination.md @@ -105,7 +105,10 @@ attributes:
Pagination does not support tags or categories
-

Pagination pages through every post in the posts variable regardless of variables defined in the YAML Front Matter of each. It does not currently allow paging over groups of posts linked by a common tag or category.

+

Pagination pages through every post in the posts + variable regardless of variables defined in the YAML Front Matter of + each. It does not currently allow paging over groups of posts linked + by a common tag or category.

## Render the paginated Posts From 2e656589207ddcf8214b51bb175fd9a812c989b0 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 20:57:39 -0500 Subject: [PATCH 141/184] Fix up some verbiage that didn't jive quite right. --- site/_posts/2012-07-01-home.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site/_posts/2012-07-01-home.md b/site/_posts/2012-07-01-home.md index 1f28b9d1..b6aaa048 100644 --- a/site/_posts/2012-07-01-home.md +++ b/site/_posts/2012-07-01-home.md @@ -4,11 +4,11 @@ title: Welcome next_section: installation --- -This site aims to be a comprehensive guide to Jekyll. We’ll cover everything -from getting your site up and running, creating and managing your content, +This site aims to be a comprehensive guide to Jekyll. We’ll cover topics such +as getting your site up and running, creating and managing your content, customizing the way your site works and looks, deploying to various -environments, as well as some advice on participating in the future development -of Jekyll itself. +environments, and give you some advice on participating in the future +development of Jekyll itself. ## So what is Jekyll, exactly? From ef6ae8c07393e5dbbb6c3bc890250b09352274f0 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:01:10 -0500 Subject: [PATCH 142/184] Add a word that was missing --- site/_posts/2012-07-01-installation.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/site/_posts/2012-07-01-installation.md b/site/_posts/2012-07-01-installation.md index 33f111be..646b6c5c 100644 --- a/site/_posts/2012-07-01-installation.md +++ b/site/_posts/2012-07-01-installation.md @@ -8,7 +8,7 @@ next_section: usage Getting Jekyll installed and ready-to-go should only take a few minutes. If it ever becomes a pain in the ass, please [file an issue](https://github.com/mojombo/jekyll/issues/new) (or submit a pull request) -describing the issue you encountered, and how we might make the process easier. +describing the issue you encountered and how we might make the process easier. ### Requirements @@ -39,11 +39,11 @@ simply run the following command to install Jekyll: $ gem install jekyll {% endhighlight %} -All Jekyll’s gem dependencies are automatically installed by the above command, -so you won’t have to worry about them at all. If you have problems installing -Jekyll, check out the [troubleshooting](../troubleshooting) page or [report an -issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll community can -improve the experience for everyone. +All of Jekyll’s gem dependencies are automatically installed by the above +command, so you won’t have to worry about them at all. If you have problems +installing Jekyll, check out the [troubleshooting](../troubleshooting) page or +[report an issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll +community can improve the experience for everyone. ## Optional Extras From c06bb76610c01e0e2bd94bbb87c9a95b6a22ec07 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:04:40 -0500 Subject: [PATCH 143/184] Fix a verb tense mismatch --- site/_posts/2012-07-01-usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-usage.md b/site/_posts/2012-07-01-usage.md index 7088f8c3..10f8104d 100644 --- a/site/_posts/2012-07-01-usage.md +++ b/site/_posts/2012-07-01-usage.md @@ -20,7 +20,7 @@ $ jekyll build --source --destination $ jekyll build --watch # => The current folder will be generated into ./_site, -# and watch for changes and regenerate automatically. +# watched for changes, and regenerated automatically. {% endhighlight %} Jekyll also comes with a built-in development server that will allow you to From f5a4d36efcb185c0c8126151851dab8bc398b42d Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:18:14 -0500 Subject: [PATCH 144/184] Add a missing comma We have three or more terms with a single conjunction. According to Strunk and White, we need a comma. --- site/_posts/2012-07-01-structure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-structure.md b/site/_posts/2012-07-01-structure.md index 4401373d..e536bd04 100644 --- a/site/_posts/2012-07-01-structure.md +++ b/site/_posts/2012-07-01-structure.md @@ -9,7 +9,7 @@ Jekyll is, at its core, a text transformation engine. The concept behind the system is this: you give it text written in your favorite markup language, be that Markdown, Textile, or just plain HTML, and it churns that through a layout or series of layout files. Throughout that process you can tweak how you want -the site URLs to look, what data gets displayed in the layout and more. This is +the site URLs to look, what data gets displayed in the layout, and more. This is all done through editing text files, and the static web site is the final product. From a8361315ed13869f4dc50dbabbbaaf7ef040127b Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:32:26 -0500 Subject: [PATCH 145/184] Add a missing 'the' We're serving the website. There can be only one. --- site/_posts/2012-07-01-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index 1556d449..cd85baa3 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -207,7 +207,7 @@ before your site is served.

Base URL

-

Serve website with the given base URL

+

Serve the website at the given base URL

baseurl: URL

From 96fa05ac3d7afafab14c06ec1f0962beca629916 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 21:47:45 -0500 Subject: [PATCH 146/184] Make the text clearer for the layout option --- site/_posts/2012-07-01-frontmatter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-frontmatter.md b/site/_posts/2012-07-01-frontmatter.md index b5a05ed9..60127c07 100644 --- a/site/_posts/2012-07-01-frontmatter.md +++ b/site/_posts/2012-07-01-frontmatter.md @@ -54,7 +54,7 @@ front-matter of a page or post.

If set, this specifies the layout file to use. Use the layout file - name without file extension. Layout files must be placed in the + name without a file extension. Layout files must be placed in the _layouts directory.

From 205e65d017a01d1c5a61afbdfa1c8e647108e82b Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 22:02:33 -0500 Subject: [PATCH 147/184] Be explicit about what we require when migrating systems We require access to the database from the old system and we're generating posts for Jekyll. --- site/_posts/2012-07-01-migrations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index c79fbabd..cad0964f 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -7,9 +7,9 @@ next_section: templates If you’re switching to Jekyll from another blogging system, Jekyll’s importers can help you with the move. Most methods listed on this page require read access -to the database to generate posts from your old system. Each method generates -`.markdown` posts in the `_posts` directory based on the entries in the foreign -system. +to the database from your old system to generate posts for Jekyll. Each method +generates `.markdown` posts in the `_posts` directory based on the entries in +the foreign system. ## Preparing for migrations From 35a59ab766c23800afd77a3bae31f483ecd675a1 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 22:15:07 -0500 Subject: [PATCH 148/184] Use 'newer' instead of 'future' When talking about versions of Drupal greater than 6.1, use the word newer to indicate that those versions have already been released. The word future implies that those versions haven't been released yet. --- site/_posts/2012-07-01-migrations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index cad0964f..ac9f7aa4 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -114,8 +114,8 @@ $ ruby -rubygems -e 'require "jekyll/migrators/drupal";
Warning: Drupal Version Compatibility
-

This migrator was written for Drupal 6.1 and may not work as expected on - future versions of Drupal. Please update it and send us a pull request if +

This migrator was written for Drupal 6.1 and may not work as expected with + newer versions of Drupal. Please update it and send us a pull request if necessary.

From 898d9d13a8ccfe2b457dd1daccdd80e94151e29c Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 22:17:11 -0500 Subject: [PATCH 149/184] Remove the word 'also' when describing Typo migrations. The use of the 'also' is out of place here. We're only talking about one thing. --- site/_posts/2012-07-01-migrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index ac9f7aa4..fab1afa1 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -137,7 +137,7 @@ $ ruby -rubygems -e 'require "jekyll/migrators/typo"; Jekyll::Typo.process("database", "user", "pass")' {% endhighlight %} -This code also has only been tested with Typo version 4+. +This code has only been tested with Typo version 4+. ## TextPattern From 7d3dcc0116be456dea89f6d2a773094a01e0c328 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 22:54:33 -0500 Subject: [PATCH 150/184] Fix the link to the Homebrew wiki --- site/_posts/2012-07-01-extras.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/site/_posts/2012-07-01-extras.md b/site/_posts/2012-07-01-extras.md index 2ac89e32..594f8acb 100644 --- a/site/_posts/2012-07-01-extras.md +++ b/site/_posts/2012-07-01-extras.md @@ -41,8 +41,9 @@ $ pip install pygments

Homebrew doesn’t symlink the executables for you. For the Homebrew default Cellar location and Python 2.7, be sure to add `/usr/local/share/python` to - your `PATH`. For more information, check out [the Homebrew - wiki](https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python). + your `PATH`. For more information, check out + the + Homebrew wiki.

From 94449c40880a1e9358f0c1d92aaa0e41ae221f48 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 18 Apr 2013 23:01:39 -0500 Subject: [PATCH 151/184] Tell people to update the site not the wiki. We want to kill the wiki with fire. --- site/_posts/2012-07-01-contributing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/_posts/2012-07-01-contributing.md b/site/_posts/2012-07-01-contributing.md index dcab4ffa..473fcf32 100644 --- a/site/_posts/2012-07-01-contributing.md +++ b/site/_posts/2012-07-01-contributing.md @@ -14,9 +14,9 @@ following in mind: [RR](http://github.com/btakita/rr/tree/master). * 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 wiki - would be appreciated, and once merged it will be transferred over to the main - wiki. + where appropriate. Also, whipping up some documentation in your fork's `site` + directory would be appreciated, and once merged it will also appear in + the next update of the main site. * If your contribution adds or changes any Jekyll behavior, make sure to update the documentation. It lives in `site/_posts`. If the docs are missing information, please feel free to add it in. Great docs make a great project! From 7d59df92b3585bb00388fbbf55f12799d0d6a4ca Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 19 Apr 2013 22:50:45 -0500 Subject: [PATCH 152/184] Use 'from' instead of 'at' --- site/_posts/2012-07-01-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index cd85baa3..d5002d94 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -207,7 +207,7 @@ before your site is served.

Base URL

-

Serve the website at the given base URL

+

Serve the website from the given base URL

baseurl: URL

From b05afb022f6c20ec5c8cf53615b2a9447a0b2401 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 19 Apr 2013 22:51:18 -0500 Subject: [PATCH 153/184] Use 'the' instead of 'a' --- site/_posts/2012-07-01-frontmatter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_posts/2012-07-01-frontmatter.md b/site/_posts/2012-07-01-frontmatter.md index 60127c07..b5ea7258 100644 --- a/site/_posts/2012-07-01-frontmatter.md +++ b/site/_posts/2012-07-01-frontmatter.md @@ -54,7 +54,7 @@ front-matter of a page or post.

If set, this specifies the layout file to use. Use the layout file - name without a file extension. Layout files must be placed in the + name without the file extension. Layout files must be placed in the _layouts directory.

From 47f8fb50914e51d7c671db50f20c4883374bf336 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 19 Apr 2013 22:56:19 -0500 Subject: [PATCH 154/184] Don't end an independent thought with a preposition. --- site/_posts/2012-07-01-migrations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/_posts/2012-07-01-migrations.md b/site/_posts/2012-07-01-migrations.md index fab1afa1..255fb1bf 100644 --- a/site/_posts/2012-07-01-migrations.md +++ b/site/_posts/2012-07-01-migrations.md @@ -241,5 +241,5 @@ $ ruby -rubygems -e 'require "jekyll/migrators/tumblr"; ## Other Systems -If you have a system that there isn’t currently a migrator for, you should -consider writing one and sending us a pull request. +If you have a system for which there is currently no migrator, consider writing +one and sending us a pull request. From 24aabbe05f0ceb97a9fc496f843a640f4c8b3e9b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 22 Apr 2013 12:57:52 +0200 Subject: [PATCH 155/184] Moving comparison for PostUrl tag to the PostComparer class --- lib/jekyll/tags/post_url.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 6dbec9be..dd02d3bf 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -10,6 +10,13 @@ module Jekyll @slug = slug @date = Time.parse(date) end + + def ==(other) + slug == other.slug && + date.year == other.date.year && + date.month == other.date.month && + date.day == other.date.day + end end class PostUrl < Liquid::Tag @@ -23,11 +30,7 @@ module Jekyll site = context.registers[:site] site.posts.each do |p| - if p.slug == @post.slug \ - and p.date.year == @post.date.year \ - and p.date.month == @post.date.month \ - and p.date.day == @post.date.day - + if @post == p return p.url end end From 5a20fa4382aa30a03d96bb9383580e1075ab800f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 23 Apr 2013 01:50:57 +0200 Subject: [PATCH 156/184] --plugins can now accept plugin directories. Fixes #993. --- bin/jekyll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/jekyll b/bin/jekyll index db912011..0eea75e0 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -17,7 +17,7 @@ default_command :help global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)' global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)' global_option '--safe', 'Safe mode (defaults to false)' -global_option '--plugins', 'Plugins directory (defaults to ./_plugins)' +global_option '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)' global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' # Option names don't always directly match the configuration value we'd like. From 61c24c601adcbe501046f32ce59227c1ae194a7d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 25 Apr 2013 02:15:25 +0200 Subject: [PATCH 157/184] Add UTF-8 encoding where we read in YAML so it reads in UTF-8 characters properly. Fixes #836. --- lib/jekyll/configuration.rb | 2 ++ lib/jekyll/convertible.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index c166e42e..24c96e0f 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + module Jekyll class Configuration < Hash diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 015f88b3..22e076f1 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + require 'set' # Convertible provides methods for converting a pagelike item From 9a5a702e4723399683dae3fdad10b0d66688e561 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:09:11 +0200 Subject: [PATCH 158/184] When one clones one's fork of Jekyll, one should not use the readonly git:// protocol. Instead, use SSH. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3c3e07d..e3a5961b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ 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//jekyll.git` ). +* Clone down your fork ( `git clone git@github.com:/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 `rake`. From 6bb8b82a1edb08a27b5e58cb2c661d980469b230 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:10:53 +0200 Subject: [PATCH 159/184] Update history to reflect merge of #989 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 893381f3..178e8c96 100644 --- a/History.txt +++ b/History.txt @@ -67,6 +67,7 @@ * Add SVG support to Jekyll/WEBrick. (#407, #406) * Prevent custom destination from causing continuous regen on watch (#528, #820, #862) * Site Enhancements + * 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) From 6923865091b291182026f4fd5b032479eb2b58c6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:12:32 +0200 Subject: [PATCH 160/184] Update history to reflect fixing of #993 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 178e8c96..69e4e9d9 100644 --- a/History.txt +++ b/History.txt @@ -46,6 +46,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From 217b2298d1b294699f123786c103c7ecd33854c9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:13:21 +0200 Subject: [PATCH 161/184] Update history to reflect fixing of #836 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 69e4e9d9..42949172 100644 --- a/History.txt +++ b/History.txt @@ -46,6 +46,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From fe36b0f479dafa46607ce32cfbea8cf18452efb1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:16:23 +0200 Subject: [PATCH 162/184] Update history to reflect fixing of #981 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 42949172..042d0e63 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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) From 29a1c18300da8458dec87bab9878a0b4ff1e62a1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 19:36:52 +0200 Subject: [PATCH 163/184] Refactoring Jekyll::Convertible --- lib/jekyll/convertible.rb | 78 +++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 22e076f1..60d5b9c4 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -66,6 +66,45 @@ module Jekyll @converter ||= self.site.converters.find { |c| c.matches(self.ext) } end + # Render Liquid in the content + # + # content - + # payload - + # info - + # + # Returns the converted content + def render_liquid(content, payload, info) + Liquid::Template.parse(content).render!(payload, info) + rescue => e + Jekyll::Logger.error "Liquid Exception:", "#{e.message} in #{payload[:file]}" + e.backtrace.each do |backtrace| + puts backtrace + end + abort("Build Failed") + end + + def render_all_layouts(layouts, payload, info) + # recursively render layouts + layout = layouts[self.data["layout"]] + used = Set.new([layout]) + + while layout + payload = payload.deep_merge({"content" => self.output, "page" => layout.data}) + + self.output = self.render_liquid(layout.content, + payload.merge({:file => self.data["layout"]}), + info) + + 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 Hash. @@ -79,46 +118,15 @@ module Jekyll payload["pygments_prefix"] = converter.pygments_prefix payload["pygments_suffix"] = converter.pygments_suffix - begin - self.content = Liquid::Template.parse(self.content).render!(payload, info) - rescue => e - puts "Liquid Exception: #{e.message} in #{self.name}" - e.backtrace.each do |backtrace| - puts backtrace - end - abort("Build Failed") - end - + self.content = self.render_liquid(self.content, + payload.merge({:file => self.name}), + info) self.transform # output keeps track of what will finally be written self.output = self.content - # recursively render layouts - layout = layouts[self.data["layout"]] - used = Set.new([layout]) - - while layout - payload = payload.deep_merge({"content" => self.output, "page" => layout.data}) - - begin - self.output = Liquid::Template.parse(layout.content).render!(payload, info) - rescue => e - puts "Liquid Exception: #{e.message} in #{self.data["layout"]}" - e.backtrace.each do |backtrace| - puts backtrace - end - abort("Build Failed") - end - - if layout = layouts[layout.data["layout"]] - if used.include?(layout) - layout = nil # avoid recursive chain - else - used << layout - end - end - end + self.render_all_layouts(layouts, payload, info) end # Write the generated page file to the destination directory. From ffa93c22f193cc42978e4d2db73ffee573b417b7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:03:57 +0200 Subject: [PATCH 164/184] Refactor Post#to_liquid --- lib/jekyll/post.rb | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index a7afa800..75e8dbee 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -96,6 +96,23 @@ module Jekyll end end + # Public: the Post title, from the YAML Front-Matter or from the slug + # + # Returns the post title + def title + self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' ') + end + + # Public: the path to the post relative to the site source, + # from the YAML Front-Matter or from a combination of + # the directory it's in, "_posts", and the name of the + # post file + # + # Returns the path to the file relative to the site source + def path + self.data['path'] || File.join(@dir, '_posts', @name).sub(/\A\//, '') + end + # Compares Post objects. First compares the Post date. If the dates are # equal, it compares the Post slugs. # @@ -262,18 +279,7 @@ module Jekyll # # Returns the representative Hash. def to_liquid - self.data.deep_merge({ - "title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '), - "url" => self.url, - "date" => self.date, - "id" => self.id, - "categories" => self.categories, - "next" => self.next, - "previous" => self.previous, - "tags" => self.tags, - "content" => self.content, - "excerpt" => self.excerpt, - "path" => self.data['path'] || File.join(@dir, '_posts', @name).sub(/\A\//, '') }) + self.data.deep_merge(methods_as_hash_for_liquid) end # Returns the shorthand String identifier of this Post. @@ -302,6 +308,17 @@ module Jekyll protected + # Protected: Fetch a Hash of specified attributes which has a corresponding + # method: title, url, date, id, categories, next, previous, tags, + # content, excerpt, and path + # + # Returns a hash of the attributes and their values + def methods_as_hash_for_liquid + Hash[%w[title url date id categories next previous tags content excerpt path].map { |attribute| + [attribute, send(attribute.to_sym)] + }] + end + # Internal: Extract excerpt from the content # # By default excerpt is your first paragraph of a post: everything before From 09c1c01d073744f549ee1f806e379faf14a5b805 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:05:52 +0200 Subject: [PATCH 165/184] Refactor Post#related_posts to build the index in a different method --- lib/jekyll/post.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 75e8dbee..3eab2b04 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -229,16 +229,7 @@ module Jekyll return [] unless posts.size > 1 if self.site.lsi - self.class.lsi ||= begin - puts "Starting the classifier..." - lsi = Classifier::LSI.new(:auto_rebuild => false) - $stdout.print(" Populating LSI... ");$stdout.flush - posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) } - $stdout.print("\n Rebuilding LSI index... ") - lsi.build_index - puts "" - lsi - end + build_index related = self.class.lsi.find_related(self.content, 11) related - [self] @@ -247,6 +238,19 @@ module Jekyll end end + def build_index + self.class.lsi ||= begin + puts "Starting the classifier..." + lsi = Classifier::LSI.new(:auto_rebuild => false) + $stdout.print(" Populating LSI... "); $stdout.flush + posts.each { |x| $stdout.print("."); $stdout.flush; lsi.add_item(x) } + $stdout.print("\n Rebuilding LSI index... ") + lsi.build_index + puts "" + lsi + end + end + # Add any necessary layouts to this post. # # layouts - A Hash of {"name" => "layout"}. From 266a52b161f358715706d46094893f90a333e9f8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:09:18 +0200 Subject: [PATCH 166/184] The call to Post#read_yaml was in an unnecessary begin...rescue block. --- lib/jekyll/post.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 3eab2b04..1ebb7f94 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -39,11 +39,7 @@ module Jekyll self.categories = dir.downcase.split('/').reject { |x| x.empty? } self.process(name) - begin - self.read_yaml(@base, name) - rescue Exception => msg - raise FatalException.new("#{msg} in #{@base}/#{name}") - end + self.read_yaml(@base, name) # If we've added a date and time to the YAML, use that instead of the # filename date. Means we'll sort correctly. From 482986e3467457ced56c814ce91fd04f387551ac Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:21:17 +0200 Subject: [PATCH 167/184] Refactored setting of Post.published flag --- lib/jekyll/post.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 1ebb7f94..4e337e96 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -41,18 +41,11 @@ module Jekyll self.process(name) self.read_yaml(@base, name) - # If we've added a date and time to the YAML, use that instead of the - # filename date. Means we'll sort correctly. if self.data.has_key?('date') - # ensure Time via to_s and reparse self.date = Time.parse(self.data["date"].to_s) end - if self.data.has_key?('published') && self.data['published'] == false - self.published = false - else - self.published = true - end + self.published = self.is_published self.tags = self.data.pluralized_array("tag", "tags") @@ -64,6 +57,14 @@ module Jekyll self.categories.flatten! end + def is_published + if self.data.has_key?('published') && self.data['published'] == false + false + else + true + end + end + # Get the full path to the directory containing the post files def containing_dir(source, dir) return File.join(source, dir, '_posts') From 6d9845a58b14a0dfba1120193bcd86ec9aaa8f97 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:23:58 +0200 Subject: [PATCH 168/184] Refactor Post category instantiation --- lib/jekyll/post.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 4e337e96..46d64d3a 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -47,14 +47,8 @@ module Jekyll self.published = self.is_published - self.tags = self.data.pluralized_array("tag", "tags") - - if self.categories.empty? - self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase} - end - - self.tags.flatten! - self.categories.flatten! + self.setup_categories + self.setup_tags end def is_published @@ -65,6 +59,18 @@ module Jekyll end end + def setup_categories + if self.categories.empty? + self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase} + end + self.categories.flatten! + end + + def setup_tags + self.tags = self.data.pluralized_array("tag", "tags") + self.tags.flatten! + end + # Get the full path to the directory containing the post files def containing_dir(source, dir) return File.join(source, dir, '_posts') From 422a4bd5cdd4b1932c963600fe960d9ae3491113 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:25:07 +0200 Subject: [PATCH 169/184] Renamed tag- and category-instantiation methods --- lib/jekyll/post.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 46d64d3a..d62c8e51 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -47,8 +47,8 @@ module Jekyll self.published = self.is_published - self.setup_categories - self.setup_tags + self.populate_categories + self.populate_tags end def is_published @@ -59,14 +59,14 @@ module Jekyll end end - def setup_categories + def populate_categories if self.categories.empty? self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase} end self.categories.flatten! end - def setup_tags + def populate_tags self.tags = self.data.pluralized_array("tag", "tags") self.tags.flatten! end From f7841d17139738627ea7f08575def787e2856d48 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 20:59:54 +0200 Subject: [PATCH 170/184] Remove unnecessary self.tags.flatten! in favour of a one-line sol'n. --- lib/jekyll/post.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index d62c8e51..f75c6186 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -67,8 +67,7 @@ module Jekyll end def populate_tags - self.tags = self.data.pluralized_array("tag", "tags") - self.tags.flatten! + self.tags = self.data.pluralized_array("tag", "tags").flatten end # Get the full path to the directory containing the post files From fcbab9a3ca8c8bfd5b381806dc856b955e6c50e6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 21:00:47 +0200 Subject: [PATCH 171/184] Post#is_published ~> Post#published? --- lib/jekyll/post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index f75c6186..0b2d6330 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -45,13 +45,13 @@ module Jekyll self.date = Time.parse(self.data["date"].to_s) end - self.published = self.is_published + self.published = self.published? self.populate_categories self.populate_tags end - def is_published + def published? if self.data.has_key?('published') && self.data['published'] == false false else From 5f13e007917f5415319dad3f7d68ad67204da663 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 21:09:02 +0200 Subject: [PATCH 172/184] Comments for Convertible.render_all_layouts and Convertible.render_liquid --- lib/jekyll/convertible.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 60d5b9c4..f4b7e8df 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -68,9 +68,9 @@ module Jekyll # Render Liquid in the content # - # content - - # payload - - # info - + # 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) @@ -83,6 +83,13 @@ module Jekyll abort("Build Failed") 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[self.data["layout"]] From 46ce757b71ac89006d9ffc045cd86edbe1560d43 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 26 Apr 2013 21:20:48 +0200 Subject: [PATCH 173/184] Compliant with Ruby 2.0.0 --- .travis.yml | 3 +++ test/test_convertible.rb | 2 +- test/test_kramdown.rb | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 67260650..a59b1054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: ruby +before_install: + - gem install bundler rvm: + - 2.0.0 - 1.9.3 - 1.9.2 - 1.8.7 diff --git a/test/test_convertible.rb b/test/test_convertible.rb index 3940f030..ee7fc8e3 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -25,7 +25,7 @@ class TestConvertible < Test::Unit::TestCase ret = @convertible.read_yaml(@base, name) assert_equal({}, ret) end - assert_match(/YAML Exception|syntax error/, out) + assert_match(/YAML Exception|syntax error|Error reading file/, out) assert_match(/#{File.join(@base, name)}/, out) end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index 981cdaf3..eed8b97f 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + require 'helper' class TestKramdown < Test::Unit::TestCase @@ -23,11 +25,11 @@ class TestKramdown < Test::Unit::TestCase should "convert quotes to smart quotes" do markdown = Converters::Markdown.new(@config) - assert_equal "

“Pit’hy”

", markdown.convert(%{"Pit'hy"}).strip + assert_match /

(“|“)Pit(’|’)hy(”|”)<\/p>/, markdown.convert(%{"Pit'hy"}).strip override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } } markdown = Converters::Markdown.new(@config.deep_merge(override)) - assert_equal "

«Pit›hy»

", markdown.convert(%{"Pit'hy"}).strip + assert_match /

(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip end end end From ad2c706a34bbfab4803be6db33d574cbf44bc4fa Mon Sep 17 00:00:00 2001 From: uu59 Date: Sun, 28 Apr 2013 02:03:08 +0900 Subject: [PATCH 174/184] Fix `jekyll serve --limit_posts n` failed --- lib/jekyll/site.rb | 3 ++- test/test_generated_site.rb | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 1354cb67..7a4e15f0 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -27,7 +27,8 @@ module Jekyll self.include = config['include'] self.future = config['future'] self.show_drafts = config['show_drafts'] - self.limit_posts = config['limit_posts'] + # given as String if it is came from CLI option + self.limit_posts = config['limit_posts'].nil? ? nil : config["limit_posts"].to_i self.keep_files = config['keep_files'] self.reset diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index ca676861..bb6a6eb0 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -68,5 +68,15 @@ class TestGeneratedSite < Test::Unit::TestCase @site = Site.new(Jekyll.configuration) end end + + should "ensure if limit_posts is a String (from CLI option)" do + clear_dest + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'limit_posts' => "3"}) + end + @site = Site.new(Jekyll.configuration) + + assert_equal 3, @site.limit_posts + end end end From f7fde70f5f1c31c7c115a8d6183e02a5ed32c4fd Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 28 Apr 2013 15:21:17 +0200 Subject: [PATCH 175/184] =?UTF-8?q?'The=20Best=20of=20Both=20Worlds,'=20?= =?UTF-8?q?=C3=A0=20la=20@chad's=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/jekyll/post.rb | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 0b2d6330..9824ef02 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -10,6 +10,21 @@ module Jekyll # Valid post name regex. MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/ + # Attributes for Liquid templates + ATTRIBUTES_FOR_LIQUID = %w[ + title + url + date + id + categories + next + previous + tags + content + excerpt + path + ] + # Post name validator. Post filenames must be like: # 2008-11-05-my-awesome-post.textile # @@ -285,7 +300,10 @@ module Jekyll # # Returns the representative Hash. def to_liquid - self.data.deep_merge(methods_as_hash_for_liquid) + further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute| + [attribute, send(attribute)] + }] + data.deep_merge(further_data) end # Returns the shorthand String identifier of this Post. @@ -314,17 +332,6 @@ module Jekyll protected - # Protected: Fetch a Hash of specified attributes which has a corresponding - # method: title, url, date, id, categories, next, previous, tags, - # content, excerpt, and path - # - # Returns a hash of the attributes and their values - def methods_as_hash_for_liquid - Hash[%w[title url date id categories next previous tags content excerpt path].map { |attribute| - [attribute, send(attribute.to_sym)] - }] - end - # Internal: Extract excerpt from the content # # By default excerpt is your first paragraph of a post: everything before From 20a837d15cf63172d22312fefdd0d5ce65867349 Mon Sep 17 00:00:00 2001 From: uu59 Date: Mon, 29 Apr 2013 01:41:22 +0900 Subject: [PATCH 176/184] Change default value of limit_posts from nil to 0 (see #1004) Before this commit meaning of limit_posts: nil: no limit. generate all posts 0: raise error n ( > 0): generate n posts only n ( < 0): raise error else: raise error After this commit: nil: same as 0 0: no limit. generate all posts n ( > 0): generate n posts only n ( < 0): raise error else: almost same as 0 (depend on `to_i` result) --- lib/jekyll/configuration.rb | 2 +- lib/jekyll/site.rb | 8 ++++---- test/test_generated_site.rb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 24c96e0f..4bc41682 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -16,7 +16,7 @@ module Jekyll 'safe' => false, 'show_drafts' => nil, - 'limit_posts' => nil, + 'limit_posts' => 0, 'lsi' => false, 'future' => true, # remove and make true just default 'pygments' => true, # remove and make true just default diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7a4e15f0..107b0951 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -28,7 +28,7 @@ module Jekyll self.future = config['future'] self.show_drafts = config['show_drafts'] # given as String if it is came from CLI option - self.limit_posts = config['limit_posts'].nil? ? nil : config["limit_posts"].to_i + self.limit_posts = config['limit_posts'].to_i self.keep_files = config['keep_files'] self.reset @@ -63,8 +63,8 @@ module Jekyll self.categories = Hash.new { |hash, key| hash[key] = [] } self.tags = Hash.new { |hash, key| hash[key] = [] } - if !self.limit_posts.nil? && self.limit_posts < 1 - raise ArgumentError, "Limit posts must be nil or >= 1" + if self.limit_posts < 0 + raise ArgumentError, "Limit posts must be nil or >= 0" end end @@ -149,7 +149,7 @@ module Jekyll self.posts.sort! # limit the posts if :limit_posts option is set - if limit_posts + unless limit_posts.zero? limit = self.posts.length < limit_posts ? self.posts.length : limit_posts self.posts = self.posts[-limit, limit] end diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index bb6a6eb0..4d12867f 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -58,11 +58,11 @@ class TestGeneratedSite < Test::Unit::TestCase assert_equal 5, @site.posts.size end - should "ensure limit posts is 1 or more" do + should "ensure limit posts is 0 or more" do assert_raise ArgumentError do clear_dest stub(Jekyll).configuration do - Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1}) end @site = Site.new(Jekyll.configuration) From 94756340cd2149cc042c746d31baacbe9bc57bee Mon Sep 17 00:00:00 2001 From: uu59 Date: Mon, 29 Apr 2013 15:51:37 +0900 Subject: [PATCH 177/184] Remove to_i. Let commander gem do it #1004 --- bin/jekyll | 4 ++-- lib/jekyll/site.rb | 3 +-- test/test_generated_site.rb | 10 ---------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 0eea75e0..6d3767e6 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -48,7 +48,7 @@ command :build do |c| c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' - c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' + c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' c.option '--drafts', 'Render posts in the _drafts folder' @@ -66,7 +66,7 @@ command :serve do |c| c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' - c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' + c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' c.option '--drafts', 'Render posts in the _drafts folder' diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 107b0951..227f5312 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -27,8 +27,7 @@ module Jekyll self.include = config['include'] self.future = config['future'] self.show_drafts = config['show_drafts'] - # given as String if it is came from CLI option - self.limit_posts = config['limit_posts'].to_i + self.limit_posts = config['limit_posts'] self.keep_files = config['keep_files'] self.reset diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 4d12867f..09532226 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -68,15 +68,5 @@ class TestGeneratedSite < Test::Unit::TestCase @site = Site.new(Jekyll.configuration) end end - - should "ensure if limit_posts is a String (from CLI option)" do - clear_dest - stub(Jekyll).configuration do - Jekyll::Configuration::DEFAULTS.merge({'limit_posts' => "3"}) - end - @site = Site.new(Jekyll.configuration) - - assert_equal 3, @site.limit_posts - end end end From 0f52f15cc29f63ef1488e9228115b1e1ec9d3341 Mon Sep 17 00:00:00 2001 From: uu59 Date: Mon, 29 Apr 2013 21:07:46 +0900 Subject: [PATCH 178/184] Clean up code #1104 --- lib/jekyll/site.rb | 4 ++-- test/test_generated_site.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 227f5312..f64d874d 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -63,7 +63,7 @@ module Jekyll self.tags = Hash.new { |hash, key| hash[key] = [] } if self.limit_posts < 0 - raise ArgumentError, "Limit posts must be nil or >= 0" + raise ArgumentError, "limit_posts must not be a negative number" end end @@ -148,7 +148,7 @@ module Jekyll self.posts.sort! # limit the posts if :limit_posts option is set - unless limit_posts.zero? + if limit_posts > 0 limit = self.posts.length < limit_posts ? self.posts.length : limit_posts self.posts = self.posts[-limit, limit] end diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 09532226..0861ee93 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -68,5 +68,16 @@ class TestGeneratedSite < Test::Unit::TestCase @site = Site.new(Jekyll.configuration) end end + + should "acceptable limit post is 0" do + assert_nothing_raised ArgumentError do + clear_dest + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0}) + end + + @site = Site.new(Jekyll.configuration) + end + end end end From 0b1bc0c24d8e64a1056b060e99543e9507692bf3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 30 Apr 2013 15:54:58 +0200 Subject: [PATCH 179/184] Update history to reflect merge of #1004 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 042d0e63..2c98a9d0 100644 --- a/History.txt +++ b/History.txt @@ -47,6 +47,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From 48fe514c546c858b79db2c792b716db3a116df86 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 30 Apr 2013 16:08:21 +0200 Subject: [PATCH 180/184] Updating Configuration page in docs with the defaults --- site/_posts/2012-07-01-configuration.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/site/_posts/2012-07-01-configuration.md b/site/_posts/2012-07-01-configuration.md index d5002d94..fa6d856f 100644 --- a/site/_posts/2012-07-01-configuration.md +++ b/site/_posts/2012-07-01-configuration.md @@ -236,24 +236,28 @@ source: . destination: ./_site plugins: ./_plugins layouts: ./_layouts +include: ['.htaccess'] +exclude: [] keep_files: ['.git','.svn'] +timezone: nil future: true -pygments: false +show_drafts: nil +limit_posts: 0 +pygments: true -markdown: maruku permalink: date -include: ['.htaccess'] paginate_path: 'page:num' -markdown_ext: markdown,mkd,mkdn,md -textile_ext: textile +markdown: maruku +markdown_ext: markdown,mkd,mkdn,md +textile_ext: textile excerpt_separator: "\n\n" safe: false -watch: false -server: false +watch: false # deprecated +server: false # deprecated host: 0.0.0.0 port: 4000 baseurl: / From 82ec02905e22cca63eba7fe13aa5fc6e320633cd Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Tue, 30 Apr 2013 23:33:08 +0400 Subject: [PATCH 181/184] Catch all exceptions, not just StandardError descendents We've hit a few edge cases in Liquid/Markdown rendering with http://clojurewerkz.org documentation sites. They resulted in exceptions Jekyll silently swallowed because they were not StandardException subclasses. --- lib/jekyll/convertible.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index f4b7e8df..acdb0be0 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -34,10 +34,10 @@ module Jekyll self.content = $POSTMATCH self.data = YAML.safe_load($1) end - rescue => e - puts "Error reading file #{File.join(base, name)}: #{e.message}" rescue SyntaxError => e - puts "YAML Exception reading #{File.join(base, name)}: #{e.message}" + puts "YAML Exception reading #{File.join(base, name)}: #{e.message}" + rescue Exception => e + puts "Error reading file #{File.join(base, name)}: #{e.message}" end self.data ||= {} @@ -75,7 +75,7 @@ module Jekyll # Returns the converted content def render_liquid(content, payload, info) Liquid::Template.parse(content).render!(payload, info) - rescue => e + rescue Exception => e Jekyll::Logger.error "Liquid Exception:", "#{e.message} in #{payload[:file]}" e.backtrace.each do |backtrace| puts backtrace From 463ea15a3e1198d84817d08ebb35bcb894a541c3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 30 Apr 2013 22:02:36 +0200 Subject: [PATCH 182/184] Update history to reflect merge of #1007 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 2c98a9d0..e75ae94b 100644 --- a/History.txt +++ b/History.txt @@ -47,6 +47,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * 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) From c32b57011419938766f1eabbc9c89eadcb4ff525 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 30 Apr 2013 22:17:15 +0200 Subject: [PATCH 183/184] Checking the arguments to ensure we have a subcommand before proceeding. (#1008) --- lib/jekyll/deprecator.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jekyll/deprecator.rb b/lib/jekyll/deprecator.rb index 88e959b7..ae074f33 100644 --- a/lib/jekyll/deprecator.rb +++ b/lib/jekyll/deprecator.rb @@ -1,6 +1,7 @@ module Jekyll class Deprecator def self.process(args) + no_subcommand(args) deprecation_message args, "--server", "The --server command has been replaced by the \ 'serve' subcommand." deprecation_message args, "--no-server", "To build Jekyll without launching a server, \ @@ -15,6 +16,14 @@ module Jekyll deprecation_message args, "--url", "The 'url' setting can only be set in your config files." end + def self.no_subcommand(args) + if args.size == 0 || args.first =~ /^--/ + Jekyll::Logger.error "Deprecation:", "Jekyll now uses subcommands instead of just \ + switches. Run `jekyll help' to find out more." + exit(1) + end + end + def self.deprecation_message(args, deprecated_argument, message) if args.include?(deprecated_argument) Jekyll::Logger.error "Deprecation:", message From 40b587c46c254db68e5885069c8926641befcdcb Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 30 Apr 2013 22:18:58 +0200 Subject: [PATCH 184/184] Update history to reflect change to solve #1008 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index e75ae94b..116a7800 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * 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 + * 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)