Permalink
Browse files

Merge branch 'custom-layout-directory' of https://github.com/tombell/…

…jekyll into tombell-custom-layout-directory

Conflicts:
	lib/jekyll/site.rb
  • Loading branch information...
2 parents 47090ff + df2ad2a commit 202894c19686121ed63a832c550586b970d5a402 @mojombo mojombo committed Jun 11, 2012
Showing with 31 additions and 2 deletions.
  1. +21 −0 features/site_configuration.feature
  2. +7 −0 features/step_definitions/jekyll_steps.rb
  3. +1 −0 lib/jekyll.rb
  4. +2 −2 lib/jekyll/site.rb
@@ -143,3 +143,24 @@ Feature: Site configuration
Then the _site directory should exist
And I should see ".DS_Store" in "_site/.gitignore"
And the "_site/.htaccess" file should not exist
+
+ Scenario: Using a different layouts directory
+ Given I have a _theme directory
+ And I have a page theme that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
+ And I have a post theme that contains "Post Layout: {{ content }}"
+ And I have an "index.html" page with layout "page" that contains "site index page"
+ And I have a configuration file with:
+ | key | value |
+ | time | 2010-01-01 |
+ | future | true |
+ | layouts | _theme |
+ And I have a _posts directory
+ And I have the following posts:
+ | title | date | layout | content |
+ | entry1 | 12/31/2007 | post | content for entry1. |
+ | entry2 | 01/31/2020 | post | content for entry2. |
+ When I run jekyll
+ Then the _site directory should exist
+ And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
+ And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
+ And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
@@ -39,6 +39,13 @@
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
+
Given /^I have an? (.*) directory$/ do |dir|
FileUtils.mkdir_p(dir)
end
View
@@ -59,6 +59,7 @@ module Jekyll
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => File.join(Dir.pwd, '_plugins'),
+ 'layouts' => '_layouts',
'future' => true,
'lsi' => false,
View
@@ -101,12 +101,12 @@ def read
self.read_directories
end
- # Read all the files in <source>/_layouts and create a new Layout object
+ # Read all the files in <source>/<layouts> and create a new Layout object
# with each one.
#
# Returns nothing.
def read_layouts
- base = File.join(self.source, "_layouts")
+ base = File.join(self.source, self.config['layouts'])
return unless File.exists?(base)
entries = []
Dir.chdir(base) { entries = filter_entries(Dir['*.*']) }

0 comments on commit 202894c

Please sign in to comment.