Merge branch 'jamie/master'
This commit is contained in:
		
						commit
						b8c04dfb6d
					
				| 
						 | 
				
			
			@ -62,6 +62,14 @@ opts = OptionParser.new do |opts|
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  opts.on("--extensions", "Load Jekyll extensions from _lib directory") do
 | 
			
		||||
    options['extensions'] = true
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  opts.on("--no-extensions", "Do not load Jekyll extensions") do
 | 
			
		||||
    options['extensions'] = false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  opts.on("--version", "Display current version") do
 | 
			
		||||
    puts "Jekyll " + Jekyll.version
 | 
			
		||||
    exit 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,3 +61,21 @@ Feature: Site configuration
 | 
			
		|||
    When I run jekyll
 | 
			
		||||
    Then the _site directory should exist
 | 
			
		||||
    And I should see "puts 'Hello world!'" in "_site/index.html"
 | 
			
		||||
 | 
			
		||||
  Scenario: Load an extension from _lib
 | 
			
		||||
    Given I have an "index.html" page that contains "{{ 'extension' | hello }}"
 | 
			
		||||
    And I have a _lib directory
 | 
			
		||||
    And I have a "_lib/hello.rb" file that contains "module Jekyll::Filters ; def hello(input) ; "hello #{input}" ; end ; end"
 | 
			
		||||
    And I have a configuration file with "extensions" set to "true"
 | 
			
		||||
    When I run jekyll
 | 
			
		||||
    Then the _site directory should exist
 | 
			
		||||
    And I should see "hello extension" in "_site/index.html"
 | 
			
		||||
 | 
			
		||||
  Scenario: Skip loading extensions from _lib
 | 
			
		||||
    Given I have an "index.html" page that contains "{{ 'extension' | hello }}"
 | 
			
		||||
    And I have a _lib directory
 | 
			
		||||
    And I have a "_lib/hello.rb" file that contains "module Jekyll::Filters ; def hello(input) ; "hello #{input}" ; end ; end"
 | 
			
		||||
    And I have a configuration file with "extensions" set to "false"
 | 
			
		||||
    When I run jekyll
 | 
			
		||||
    Then the _site directory should exist
 | 
			
		||||
    And I should not see "hello extension" in "_site/index.html"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -119,6 +119,10 @@ Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
 | 
			
		|||
  assert_match Regexp.new(text), File.open(file).readlines.join
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
 | 
			
		||||
  assert_no_match Regexp.new(text), File.open(file).readlines.join
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Then /^the "(.*)" file should exist$/ do |file|
 | 
			
		||||
  assert File.file?(file)
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,7 @@ module Jekyll
 | 
			
		|||
    'pygments'     => false,
 | 
			
		||||
    'markdown'     => 'maruku',
 | 
			
		||||
    'permalink'    => 'date',
 | 
			
		||||
    'extensions'   => false,
 | 
			
		||||
 | 
			
		||||
    'maruku'       => {
 | 
			
		||||
      'use_tex'    => false,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,8 @@ module Jekyll
 | 
			
		|||
 | 
			
		||||
  class Site
 | 
			
		||||
    attr_accessor :config, :layouts, :posts, :pages, :static_files, :categories, :exclude,
 | 
			
		||||
                  :source, :dest, :lsi, :pygments, :permalink_style, :tags
 | 
			
		||||
                  :source, :dest, :lsi, :pygments, :permalink_style, :tags,
 | 
			
		||||
                  :extensions
 | 
			
		||||
 | 
			
		||||
    # Initialize the site
 | 
			
		||||
    #   +config+ is a Hash containing site configurations details
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,7 @@ module Jekyll
 | 
			
		|||
      self.pygments        = config['pygments']
 | 
			
		||||
      self.permalink_style = config['permalink'].to_sym
 | 
			
		||||
      self.exclude         = config['exclude'] || []
 | 
			
		||||
      self.extensions      = config['extensions']
 | 
			
		||||
 | 
			
		||||
      self.reset
 | 
			
		||||
      self.setup
 | 
			
		||||
| 
						 | 
				
			
			@ -82,6 +84,12 @@ module Jekyll
 | 
			
		|||
        else
 | 
			
		||||
          raise "Invalid Markdown processor: '#{self.config['markdown']}' -- did you mean 'maruku' or 'rdiscount'?"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Load extensions from _lib folder
 | 
			
		||||
      if self.extensions
 | 
			
		||||
        # load instead of require so that jekyll --auto reloads changes
 | 
			
		||||
        Dir["#{source}/_lib/*.rb"].each {|f| load f}
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def textile(content)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue