Merge branch 'master' of git://github.com/mojombo/jekyll
This commit is contained in:
		
						commit
						12a19eaf3a
					
				|  | @ -1,4 +1,4 @@ | ||||||
| == HEAD | == 0.12.0 / 2012-12-22 | ||||||
|   * Minor Enhancements |   * Minor Enhancements | ||||||
|     * Add ability to explicitly specify included files (#261) |     * Add ability to explicitly specify included files (#261) | ||||||
|     * Add --default-mimetype option (#279) |     * Add --default-mimetype option (#279) | ||||||
|  | @ -7,12 +7,15 @@ | ||||||
|     * Allow multiple plugin dirs to be specified (#438) |     * Allow multiple plugin dirs to be specified (#438) | ||||||
|     * Inline TOC token support for RDiscount (#333) |     * Inline TOC token support for RDiscount (#333) | ||||||
|     * Add the option to specify the paginated url format (#342) |     * Add the option to specify the paginated url format (#342) | ||||||
|  |     * Support Redcarpet 2 and fenced code blocks (#619) | ||||||
|  |     * Better reporting of Liquid errors (#624) | ||||||
|   * Bug Fixes |   * Bug Fixes | ||||||
|     * Allow some special characters in highlight names |     * Allow some special characters in highlight names | ||||||
|     * URL escape category names in URL generation (#360) |     * URL escape category names in URL generation (#360) | ||||||
|     * Fix error with limit_posts (#442) |     * Fix error with limit_posts (#442) | ||||||
|     * Properly select dotfile during directory scan (#363, #431, #377) |     * Properly select dotfile during directory scan (#363, #431, #377) | ||||||
|     * Allow setting of Kramdown smart_quotes (#482) |     * Allow setting of Kramdown smart_quotes (#482) | ||||||
|  |     * Ensure front-matter is at start of file (#562) | ||||||
| 
 | 
 | ||||||
| == 0.11.2 / 2011-12-27 | == 0.11.2 / 2011-12-27 | ||||||
|   * Bug Fixes |   * Bug Fixes | ||||||
|  |  | ||||||
|  | @ -4,8 +4,9 @@ Gem::Specification.new do |s| | ||||||
|   s.rubygems_version = '1.3.5' |   s.rubygems_version = '1.3.5' | ||||||
| 
 | 
 | ||||||
|   s.name              = 'jekyll' |   s.name              = 'jekyll' | ||||||
|   s.version           = '0.11.2' |   s.version           = '0.12.0' | ||||||
|   s.date              = '2011-12-27' |   s.license           = 'MIT' | ||||||
|  |   s.date              = '2012-12-22' | ||||||
|   s.rubyforge_project = 'jekyll' |   s.rubyforge_project = 'jekyll' | ||||||
| 
 | 
 | ||||||
|   s.summary     = "A simple, blog aware, static site generator." |   s.summary     = "A simple, blog aware, static site generator." | ||||||
|  | @ -27,7 +28,7 @@ Gem::Specification.new do |s| | ||||||
|   s.add_runtime_dependency('directory_watcher', "~> 1.1") |   s.add_runtime_dependency('directory_watcher', "~> 1.1") | ||||||
|   s.add_runtime_dependency('maruku', "~> 0.5") |   s.add_runtime_dependency('maruku', "~> 0.5") | ||||||
|   s.add_runtime_dependency('kramdown', "~> 0.13.4") |   s.add_runtime_dependency('kramdown', "~> 0.13.4") | ||||||
|   s.add_runtime_dependency('pygments.rb', "~> 0.2.12") |   s.add_runtime_dependency('pygments.rb', "~> 0.3.2") | ||||||
| 
 | 
 | ||||||
|   s.add_development_dependency('rake', "~> 0.9") |   s.add_development_dependency('rake', "~> 0.9") | ||||||
|   s.add_development_dependency('rdoc', "~> 3.11") |   s.add_development_dependency('rdoc', "~> 3.11") | ||||||
|  | @ -37,7 +38,7 @@ Gem::Specification.new do |s| | ||||||
|   s.add_development_dependency('cucumber', "1.1") |   s.add_development_dependency('cucumber', "1.1") | ||||||
|   s.add_development_dependency('RedCloth', "~> 4.2") |   s.add_development_dependency('RedCloth', "~> 4.2") | ||||||
|   s.add_development_dependency('rdiscount', "~> 1.6") |   s.add_development_dependency('rdiscount', "~> 1.6") | ||||||
|   s.add_development_dependency('redcarpet', "~> 1.9") |   s.add_development_dependency('redcarpet', "~> 2.1.1") | ||||||
|    |    | ||||||
|   # = MANIFEST = |   # = MANIFEST = | ||||||
|   s.files = %w[ |   s.files = %w[ | ||||||
|  | @ -74,10 +75,12 @@ Gem::Specification.new do |s| | ||||||
|     lib/jekyll/migrators/csv.rb |     lib/jekyll/migrators/csv.rb | ||||||
|     lib/jekyll/migrators/drupal.rb |     lib/jekyll/migrators/drupal.rb | ||||||
|     lib/jekyll/migrators/enki.rb |     lib/jekyll/migrators/enki.rb | ||||||
|  |     lib/jekyll/migrators/joomla.rb | ||||||
|     lib/jekyll/migrators/marley.rb |     lib/jekyll/migrators/marley.rb | ||||||
|     lib/jekyll/migrators/mephisto.rb |     lib/jekyll/migrators/mephisto.rb | ||||||
|     lib/jekyll/migrators/mt.rb |     lib/jekyll/migrators/mt.rb | ||||||
|     lib/jekyll/migrators/posterous.rb |     lib/jekyll/migrators/posterous.rb | ||||||
|  |     lib/jekyll/migrators/rss.rb | ||||||
|     lib/jekyll/migrators/textpattern.rb |     lib/jekyll/migrators/textpattern.rb | ||||||
|     lib/jekyll/migrators/tumblr.rb |     lib/jekyll/migrators/tumblr.rb | ||||||
|     lib/jekyll/migrators/typo.rb |     lib/jekyll/migrators/typo.rb | ||||||
|  | @ -90,6 +93,9 @@ Gem::Specification.new do |s| | ||||||
|     lib/jekyll/static_file.rb |     lib/jekyll/static_file.rb | ||||||
|     lib/jekyll/tags/highlight.rb |     lib/jekyll/tags/highlight.rb | ||||||
|     lib/jekyll/tags/include.rb |     lib/jekyll/tags/include.rb | ||||||
|  |     lib/jekyll/tags/post_url.rb | ||||||
|  |     test/fixtures/broken_front_matter1.erb | ||||||
|  |     test/fixtures/front_matter.erb | ||||||
|     test/helper.rb |     test/helper.rb | ||||||
|     test/source/.htaccess |     test/source/.htaccess | ||||||
|     test/source/_includes/sig.markdown |     test/source/_includes/sig.markdown | ||||||
|  | @ -132,6 +138,7 @@ Gem::Specification.new do |s| | ||||||
|     test/source/z_category/_posts/2008-9-23-categories.textile |     test/source/z_category/_posts/2008-9-23-categories.textile | ||||||
|     test/suite.rb |     test/suite.rb | ||||||
|     test/test_configuration.rb |     test/test_configuration.rb | ||||||
|  |     test/test_convertible.rb | ||||||
|     test/test_core_ext.rb |     test/test_core_ext.rb | ||||||
|     test/test_filters.rb |     test/test_filters.rb | ||||||
|     test/test_generated_site.rb |     test/test_generated_site.rb | ||||||
|  | @ -141,9 +148,9 @@ Gem::Specification.new do |s| | ||||||
|     test/test_post.rb |     test/test_post.rb | ||||||
|     test/test_rdiscount.rb |     test/test_rdiscount.rb | ||||||
|     test/test_redcarpet.rb |     test/test_redcarpet.rb | ||||||
|  |     test/test_redcloth.rb | ||||||
|     test/test_site.rb |     test/test_site.rb | ||||||
|     test/test_tags.rb |     test/test_tags.rb | ||||||
|     test/test_redcloth.rb |  | ||||||
|   ] |   ] | ||||||
|   # = MANIFEST = |   # = MANIFEST = | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -46,10 +46,10 @@ require_all 'jekyll/generators' | ||||||
| require_all 'jekyll/tags' | require_all 'jekyll/tags' | ||||||
| 
 | 
 | ||||||
| module Jekyll | module Jekyll | ||||||
|   VERSION = '0.11.2' |   VERSION = '0.12.0' | ||||||
| 
 | 
 | ||||||
|   # Default options. Overriden by values in _config.yml or command-line opts. |   # Default options. Overriden by values in _config.yml or command-line opts. | ||||||
|   # (Strings rather symbols used for compatability with YAML). |   # Strings rather than symbols are used for compatability with YAML. | ||||||
|   DEFAULTS = { |   DEFAULTS = { | ||||||
|     'safe'          => false, |     'safe'          => false, | ||||||
|     'auto'          => false, |     'auto'          => false, | ||||||
|  | @ -79,12 +79,15 @@ module Jekyll | ||||||
|       'png_dir'    => 'images/latex', |       'png_dir'    => 'images/latex', | ||||||
|       'png_url'    => '/images/latex' |       'png_url'    => '/images/latex' | ||||||
|     }, |     }, | ||||||
|  | 
 | ||||||
|     'rdiscount' => { |     'rdiscount' => { | ||||||
|       'extensions' => [] |       'extensions' => [] | ||||||
|     }, |     }, | ||||||
|  | 
 | ||||||
|     'redcarpet' => { |     'redcarpet' => { | ||||||
|       'extensions' => [] |       'extensions' => [] | ||||||
|     }, |     }, | ||||||
|  | 
 | ||||||
|     'kramdown' => { |     'kramdown' => { | ||||||
|       'auto_ids'      => true, |       'auto_ids'      => true, | ||||||
|       'footnote_nr'   => 1, |       'footnote_nr'   => 1, | ||||||
|  | @ -102,6 +105,7 @@ module Jekyll | ||||||
|         'coderay_css'               => 'style' |         'coderay_css'               => 'style' | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  | 
 | ||||||
|     'redcloth' => { |     'redcloth' => { | ||||||
|       'hard_breaks' => true |       'hard_breaks' => true | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -8,12 +8,28 @@ module Jekyll | ||||||
| 
 | 
 | ||||||
|     def setup |     def setup | ||||||
|       return if @setup |       return if @setup | ||||||
|       # Set the Markdown interpreter (and Maruku self.config, if necessary) |  | ||||||
|       case @config['markdown'] |       case @config['markdown'] | ||||||
|         when 'redcarpet' |         when 'redcarpet' | ||||||
|           begin |           begin | ||||||
|             require 'redcarpet' |             require 'redcarpet' | ||||||
|             @redcarpet_extensions = @config['redcarpet']['extensions'].map { |e| e.to_sym } | 
 | ||||||
|  |             @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(/<pre>/,'<pre><code class="' + lang + '">') | ||||||
|  |                 code = code.sub(/<\/pre>/,"</code></pre>") | ||||||
|  |               end | ||||||
|  |             end | ||||||
|  | 
 | ||||||
|  |             @redcarpet_extensions = {} | ||||||
|  |             @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true } | ||||||
|           rescue LoadError |           rescue LoadError | ||||||
|             STDERR.puts 'You are missing a library required for Markdown. Please run:' |             STDERR.puts 'You are missing a library required for Markdown. Please run:' | ||||||
|             STDERR.puts '  $ [sudo] gem install redcarpet' |             STDERR.puts '  $ [sudo] gem install redcarpet' | ||||||
|  | @ -30,8 +46,6 @@ module Jekyll | ||||||
|         when 'rdiscount' |         when 'rdiscount' | ||||||
|           begin |           begin | ||||||
|             require 'rdiscount' |             require 'rdiscount' | ||||||
| 
 |  | ||||||
|             # Load rdiscount extensions |  | ||||||
|             @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym } |             @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym } | ||||||
|           rescue LoadError |           rescue LoadError | ||||||
|             STDERR.puts 'You are missing a library required for Markdown. Please run:' |             STDERR.puts 'You are missing a library required for Markdown. Please run:' | ||||||
|  | @ -88,7 +102,10 @@ module Jekyll | ||||||
|       setup |       setup | ||||||
|       case @config['markdown'] |       case @config['markdown'] | ||||||
|         when 'redcarpet' |         when 'redcarpet' | ||||||
|           Redcarpet.new(content, *@redcarpet_extensions).to_html |           @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' |         when 'kramdown' | ||||||
|           # Check for use of coderay |           # Check for use of coderay | ||||||
|           if @config['kramdown']['use_coderay'] |           if @config['kramdown']['use_coderay'] | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ module Jekyll | ||||||
|       self.content = File.read(File.join(base, name)) |       self.content = File.read(File.join(base, name)) | ||||||
| 
 | 
 | ||||||
|       begin |       begin | ||||||
|         if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m |         if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m | ||||||
|           self.content = $POSTMATCH |           self.content = $POSTMATCH | ||||||
|           self.data = YAML.load($1) |           self.data = YAML.load($1) | ||||||
|         end |         end | ||||||
|  | @ -76,9 +76,13 @@ module Jekyll | ||||||
|       payload["pygments_suffix"] = converter.pygments_suffix |       payload["pygments_suffix"] = converter.pygments_suffix | ||||||
| 
 | 
 | ||||||
|       begin |       begin | ||||||
|         self.content = Liquid::Template.parse(self.content).render(payload, info) |         self.content = Liquid::Template.parse(self.content).render!(payload, info) | ||||||
|       rescue => e |       rescue => e | ||||||
|         puts "Liquid Exception: #{e.message} in #{self.name}" |         puts "Liquid Exception: #{e.message} in #{self.name}" | ||||||
|  |         e.backtrace.each do |backtrace| | ||||||
|  |           puts backtrace | ||||||
|  |         end | ||||||
|  |         abort("Build Failed") | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       self.transform |       self.transform | ||||||
|  | @ -94,9 +98,13 @@ module Jekyll | ||||||
|         payload = payload.deep_merge({"content" => self.output, "page" => layout.data}) |         payload = payload.deep_merge({"content" => self.output, "page" => layout.data}) | ||||||
| 
 | 
 | ||||||
|         begin |         begin | ||||||
|           self.output = Liquid::Template.parse(layout.content).render(payload, info) |           self.output = Liquid::Template.parse(layout.content).render!(payload, info) | ||||||
|         rescue => e |         rescue => e | ||||||
|           puts "Liquid Exception: #{e.message} in #{self.data["layout"]}" |           puts "Liquid Exception: #{e.message} in #{self.data["layout"]}" | ||||||
|  |           e.backtrace.each do |backtrace| | ||||||
|  |             puts backtrace | ||||||
|  |           end | ||||||
|  |           abort("Build Failed") | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         if layout = layouts[layout.data["layout"]] |         if layout = layouts[layout.data["layout"]] | ||||||
|  |  | ||||||
|  | @ -38,7 +38,11 @@ module Jekyll | ||||||
| 
 | 
 | ||||||
|       self.categories = dir.split('/').reject { |x| x.empty? } |       self.categories = dir.split('/').reject { |x| x.empty? } | ||||||
|       self.process(name) |       self.process(name) | ||||||
|  |       begin  | ||||||
|         self.read_yaml(@base, name) |         self.read_yaml(@base, name) | ||||||
|  |       rescue Exception => msg | ||||||
|  |         raise FatalException.new("#{msg} in #{@base}/#{name}")         | ||||||
|  |       end | ||||||
| 
 | 
 | ||||||
|       #If we've added a date and time to the yaml, use that instead of the filename date |       #If we've added a date and time to the yaml, use that instead of the filename date | ||||||
|       #Means we'll sort correctly. |       #Means we'll sort correctly. | ||||||
|  |  | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | # Some stuff on the first line | ||||||
|  | --- | ||||||
|  | test: good | ||||||
|  | --- | ||||||
|  | Real content starts here | ||||||
|  | @ -0,0 +1,4 @@ | ||||||
|  | --- | ||||||
|  | test: good | ||||||
|  | --- | ||||||
|  | Real content starts here | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | require 'helper' | ||||||
|  | require 'ostruct' | ||||||
|  | 
 | ||||||
|  | class TestConvertible < Test::Unit::TestCase | ||||||
|  |   context "yaml front-matter" do | ||||||
|  |     setup do | ||||||
|  |       @convertible = OpenStruct.new | ||||||
|  |       @convertible.extend Jekyll::Convertible | ||||||
|  |       @base = File.expand_path('../fixtures', __FILE__) | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     should "parse the front-matter correctly" do | ||||||
|  |       ret = @convertible.read_yaml(@base, 'front_matter.erb') | ||||||
|  |       assert_equal({'test' => 'good'}, ret) | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     should "not parse if the front-matter is not at the start of the file" do | ||||||
|  |       ret = @convertible.read_yaml(@base, 'broken_front_matter1.erb') | ||||||
|  |       assert_equal({}, ret) | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
|  | @ -4,7 +4,7 @@ class TestRedcarpet < Test::Unit::TestCase | ||||||
|   context "redcarpet" do |   context "redcarpet" do | ||||||
|     setup do |     setup do | ||||||
|       config = { |       config = { | ||||||
|         'redcarpet' => { 'extensions' => ['smart'] }, |         'redcarpet' => { 'extensions' => ['smart', 'strikethrough', 'filter_html'] }, | ||||||
|         'markdown' => 'redcarpet' |         'markdown' => 'redcarpet' | ||||||
|       } |       } | ||||||
|       @markdown = MarkdownConverter.new config |       @markdown = MarkdownConverter.new config | ||||||
|  | @ -14,8 +14,26 @@ class TestRedcarpet < Test::Unit::TestCase | ||||||
|       assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip |       assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip | ||||||
|     end |     end | ||||||
|      |      | ||||||
|     should "pass redcarpet extensions" do |     should "pass redcarpet SmartyPants options" do | ||||||
|       assert_equal "<p>“smart”</p>", @markdown.convert('"smart"').strip |       assert_equal "<p>“smart”</p>", @markdown.convert('"smart"').strip | ||||||
|     end |     end | ||||||
|  | 
 | ||||||
|  |     should "pass redcarpet extensions" do | ||||||
|  |       assert_equal "<p><del>deleted</del></p>", @markdown.convert('~~deleted~~').strip | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     should "pass redcarpet render options" do | ||||||
|  |       assert_equal "<p><strong>bad code not here</strong>: i am bad</p>", @markdown.convert('**bad code not here**: <script>i am bad</script>').strip | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     should "render fenced code blocks" do | ||||||
|  |       assert_equal "<div class=\"highlight\"><pre><code class=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">"Hello world"</span>\n</code></pre></div>", @markdown.convert( | ||||||
|  |         <<-EOS | ||||||
|  | ```ruby | ||||||
|  | puts "Hello world" | ||||||
|  | ``` | ||||||
|  | EOS | ||||||
|  |       ).strip   | ||||||
|  |     end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue