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.
This commit is contained in:
duritong 2009-04-24 00:13:08 +02:00
parent dd268fae95
commit 5b540cf744
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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