From 5b540cf744bf4994c4c374c792da2d3ab17f9fff Mon Sep 17 00:00:00 2001 From: duritong Date: Fri, 24 Apr 2009 00:13:08 +0200 Subject: [PATCH 1/3] introduce an exclude config option This is a YAML array for files in the root directory, which should be excluded to be processed into '_site'. This can be useful for README, Rakefiles etc. --- README.textile | 4 ++++ lib/jekyll/site.rb | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 5e04f316..168a4b25 100644 --- a/README.textile +++ b/README.textile @@ -191,6 +191,10 @@ additional options: png_dir: [PATH] # Where should the math PNGs be stored? png_url: [URL] # A relative URL for the PNGs + exclude: # This is a YAML array for files in the root directory, + - file1 # which should be excluded to be processed into '_site'. + - file2 # This can be useful for README, Rakefiles etc. + The default configuration is shown below as in YAML format: destination: ./_site diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 622f49ca..71fc811c 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -1,7 +1,7 @@ module Jekyll class Site - attr_accessor :config, :layouts, :posts, :categories + attr_accessor :config, :layouts, :posts, :categories, :exclude attr_accessor :source, :dest, :lsi, :pygments, :permalink_style # Initialize the site @@ -17,6 +17,8 @@ module Jekyll self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym + self.exclude = config['exclude'] + self.reset self.setup end @@ -230,7 +232,7 @@ module Jekyll entries = entries.reject do |e| unless ['_posts', '.htaccess'].include?(e) # Reject backup/hidden - ['.', '_', '#'].include?(e[0..0]) or e[-1..-1] == '~' + ['.', '_', '#'].include?(e[0..0]) or e[-1..-1] == '~' or self.exclude.include?(e) end end end From 9a0485e81265c892734b4199ca3423610eef12f3 Mon Sep 17 00:00:00 2001 From: duritong Date: Fri, 24 Apr 2009 10:04:27 +0200 Subject: [PATCH 2/3] Fix exclude to be an empty array if no exclude is defined in the config file, the exclude should simply be an empty array. --- lib/jekyll/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 71fc811c..da47e940 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -17,7 +17,7 @@ module Jekyll self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym - self.exclude = config['exclude'] + self.exclude = config['exclude'] || [] self.reset self.setup From 1f6940feb2da4f804b7acf0141512d8ad31affa9 Mon Sep 17 00:00:00 2001 From: duritong Date: Fri, 24 Apr 2009 10:06:26 +0200 Subject: [PATCH 3/3] Added cucumber feature for the exclude option this should cover the basic idea behind the exclude feature. --- features/site_configuration.feature | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index e2395b76..a8b11bb7 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -18,6 +18,16 @@ Feature: Site configuration Then the _mysite directory should exist And I should see "Changing destination directory" in "_mysite/index.html" + Scenario: Exclude files + Given I have an "Rakefile" file that contains "I want to be excluded" + And I have an "README" file that contains "I want to be excluded" + And I have an "index.html" file that contains "I want to be included" + And I have a configuration file with "exclude" set to "Rakefile", "README" + When I run jekyll + Then I should see "I want to be included" in "_site/index.html" + And the "_site/Rakefile" file should not exist + And the "_site/README" file should not exist + Scenario: Use RDiscount for markup Given I have an "index.markdown" page that contains "[Google](http://google.com)" And I have a configuration file with "markdown" set to "rdiscount"