From 9e3ad69922ccf088f42b4cc5df5bb73d09f98722 Mon Sep 17 00:00:00 2001 From: Michael J Schultz Date: Thu, 3 Mar 2011 08:14:52 -0600 Subject: [PATCH 01/14] - added rdiscount filter for templating system (like the textilize filter, but for markdown) --- lib/jekyll/filters.rb | 4 ++++ test/test_filters.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 3356eadf..26ee3d5d 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -7,6 +7,10 @@ module Jekyll TextileConverter.new.convert(input) end + def rdiscount(input) + RDiscount.new(input).to_html + end + def date_to_string(date) date.strftime("%d %b %Y") end diff --git a/test/test_filters.rb b/test/test_filters.rb index 0897fbc2..7071c15a 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -14,6 +14,10 @@ class TestFilters < Test::Unit::TestCase assert_equal "

something really simple

", @filter.textilize("something *really* simple") end + should "rdiscount with simple string" do + assert_equal "

something really simple

\n", @filter.rdiscount("something **really** simple") + end + should "convert array to sentence string with no args" do assert_equal "", @filter.array_to_sentence_string([]) end From 5801220a9887194a052bec2ce0493096ee505e98 Mon Sep 17 00:00:00 2001 From: Derek Prior Date: Tue, 12 Apr 2011 17:03:28 -0400 Subject: [PATCH 02/14] Added the ability to configure the file extensions to be processed by each converter. Test cases included. --- lib/jekyll.rb | 3 ++ lib/jekyll/converters/markdown.rb | 5 ++- lib/jekyll/converters/textile.rb | 3 +- test/source/_posts/2011-04-12-md-extension.md | 7 +++ .../_posts/2011-04-12-text-extension.text | 0 test/test_generated_site.rb | 2 +- test/test_post.rb | 43 ++++++++++++++++++- 7 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 test/source/_posts/2011-04-12-md-extension.md create mode 100644 test/source/_posts/2011-04-12-text-extension.text diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 7928850c..62b00132 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -64,6 +64,9 @@ module Jekyll 'pygments' => false, 'markdown' => 'maruku', 'permalink' => 'date', + + 'markdown_ext' => 'markdown,mdw,mdwn,md', + 'textile_ext' => 'textile', 'maruku' => { 'use_tex' => false, diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 00c56d7c..b98bcd07 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -65,9 +65,10 @@ module Jekyll end @setup = true end - + def matches(ext) - ext =~ /(markdown|mkdn?|md)/i + rgx = '(' + @config['markdown_ext'].gsub(',','|') +')' + ext =~ Regexp.new(rgx, Regexp::IGNORECASE) end def output_ext(ext) diff --git a/lib/jekyll/converters/textile.rb b/lib/jekyll/converters/textile.rb index 072e393a..da823d35 100644 --- a/lib/jekyll/converters/textile.rb +++ b/lib/jekyll/converters/textile.rb @@ -17,7 +17,8 @@ module Jekyll end def matches(ext) - ext =~ /textile/i + rgx = '(' + @config['textile_ext'].gsub(',','|') +')' + ext =~ Regexp.new(rgx, Regexp::IGNORECASE) end def output_ext(ext) diff --git a/test/source/_posts/2011-04-12-md-extension.md b/test/source/_posts/2011-04-12-md-extension.md new file mode 100644 index 00000000..163e9133 --- /dev/null +++ b/test/source/_posts/2011-04-12-md-extension.md @@ -0,0 +1,7 @@ +--- +date: 2011-04-12 13:07:09 +--- + +under default configuration, this post should get processed by the identity converter. By changing +textile extension or markdown extension configuration parameters, you should be able to associate +it with either of those converters \ No newline at end of file diff --git a/test/source/_posts/2011-04-12-text-extension.text b/test/source/_posts/2011-04-12-text-extension.text new file mode 100644 index 00000000..e69de29b diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index cba75649..af9fee9f 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase end should "ensure post count is as expected" do - assert_equal 26, @site.posts.size + assert_equal 28, @site.posts.size end should "insert site.posts into the index" do diff --git a/test/test_post.rb b/test/test_post.rb index b93c5873..d63a9f0d 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -391,6 +391,47 @@ class TestPost < Test::Unit::TestCase post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile') assert_equal ['foo'], post.categories end - end + + context "converter file extension settings" do + setup do + stub(Jekyll).configuration { Jekyll::DEFAULTS } + @site = Site.new(Jekyll.configuration) + end + + should "process .md as markdown under default configuration" do + post = setup_post '2011-04-12-md-extension.md' + conv = post.converter + assert conv.kind_of? Jekyll::MarkdownConverter + end + + should "process .text as indentity under default configuration" do + post = setup_post '2011-04-12-text-extension.text' + conv = post.converter + assert conv.kind_of? Jekyll::IdentityConverter + end + + should "process .text as markdown under alternate configuration" do + @site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text' + post = setup_post '2011-04-12-text-extension.text' + conv = post.converter + assert conv.kind_of? Jekyll::MarkdownConverter + end + + should "process .md as markdown under alternate configuration" do + @site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text' + post = setup_post '2011-04-12-text-extension.text' + conv = post.converter + assert conv.kind_of? Jekyll::MarkdownConverter + end + + should "process .text as textile under alternate configuration" do + @site.config['textile_ext'] = 'textile,text' + post = setup_post '2011-04-12-text-extension.text' + conv = post.converter + assert conv.kind_of? Jekyll::TextileConverter + end + + end + end From d2377b2581808317afa3d759952638810628e8dd Mon Sep 17 00:00:00 2001 From: Derek Prior Date: Tue, 12 Apr 2011 17:30:56 -0400 Subject: [PATCH 03/14] Fixed mistake in default markdown extensions --- lib/jekyll.rb | 2 +- test/test_post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 62b00132..24b9f9c7 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -65,7 +65,7 @@ module Jekyll 'markdown' => 'maruku', 'permalink' => 'date', - 'markdown_ext' => 'markdown,mdw,mdwn,md', + 'markdown_ext' => 'markdown,mkd,mkdn,md', 'textile_ext' => 'textile', 'maruku' => { diff --git a/test/test_post.rb b/test/test_post.rb index d63a9f0d..d0fbdf85 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -419,7 +419,7 @@ class TestPost < Test::Unit::TestCase end should "process .md as markdown under alternate configuration" do - @site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text' + @site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text' post = setup_post '2011-04-12-text-extension.text' conv = post.converter assert conv.kind_of? Jekyll::MarkdownConverter From cf779b27604f70b485e82d691733be6c3ec45733 Mon Sep 17 00:00:00 2001 From: MattHall Date: Wed, 20 Apr 2011 09:33:47 +0100 Subject: [PATCH 04/14] Added Redcarpet for MD conversion --- bin/jekyll | 4 ++++ features/site_configuration.feature | 7 +++++++ jekyll.gemspec | 3 ++- lib/jekyll.rb | 3 +++ lib/jekyll/converters/markdown.rb | 11 +++++++++++ test/helper.rb | 1 + test/test_redcarpet.rb | 21 +++++++++++++++++++++ test/test_tags.rb | 11 +++++++++++ 8 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 test/test_redcarpet.rb diff --git a/bin/jekyll b/bin/jekyll index c025a623..b81ba73e 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -82,6 +82,10 @@ opts = OptionParser.new do |opts| opts.on("--rdiscount", "Use rdiscount gem for Markdown") do options['markdown'] = 'rdiscount' end + + opts.on("--redcarpet", "Use redcarpet gem for Markdown") do + options['markdown'] = 'redcarpet' + end opts.on("--kramdown", "Use kramdown gem for Markdown") do options['markdown'] = 'kramdown' diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 0681c2f5..8d3bee5d 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -55,6 +55,13 @@ Feature: Site configuration Then the _site directory should exist And I should see "Google" in "_site/index.html" + Scenario: Use Redcarpet 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 "redcarpet" + When I run jekyll + Then the _site directory should exist + And I should see "Google" in "_site/index.html" + Scenario: Use Maruku 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 "maruku" diff --git a/jekyll.gemspec b/jekyll.gemspec index 2bb856f0..66dd8c2f 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -36,7 +36,8 @@ Gem::Specification.new do |s| s.add_development_dependency('cucumber', ">= 0.10.0") s.add_development_dependency('RedCloth', ">= 4.2.1") s.add_development_dependency('rdiscount', ">= 1.6.5") - + s.add_development_dependency('redcarpet', ">= 1.9.0") + # = MANIFEST = s.files = %w[ History.txt diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 65bdd7fe..7b1964fb 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -76,6 +76,9 @@ module Jekyll 'rdiscount' => { 'extensions' => [] }, + 'redcarpet' => { + 'extensions' => [] + }, 'kramdown' => { 'auto_ids' => true, 'footnote_nr' => 1, diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 00c56d7c..2721f02c 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -10,6 +10,15 @@ module Jekyll return if @setup # Set the Markdown interpreter (and Maruku self.config, if necessary) case @config['markdown'] + when 'redcarpet' + begin + require 'redcarpet' + @redcarpet_extensions = @config['redcarpet']['extensions'].map { |e| e.to_sym } + rescue LoadError + STDERR.puts 'You are missing a library required for Markdown. Please run:' + STDERR.puts ' $ [sudo] gem install redcarpet' + raise FatalException.new("Missing dependency: redcarpet") + end when 'kramdown' begin require 'kramdown' @@ -77,6 +86,8 @@ module Jekyll def convert(content) setup case @config['markdown'] + when 'redcarpet' + Redcarpet.new(content, *@redcarpet_extensions).to_html when 'kramdown' # Check for use of coderay if @config['kramdown']['use_coderay'] diff --git a/test/helper.rb b/test/helper.rb index c426b2a0..80825c07 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -6,6 +6,7 @@ require File.join(File.dirname(__FILE__), *%w[.. lib jekyll]) require 'RedCloth' require 'rdiscount' require 'kramdown' +require 'redcarpet' require 'test/unit' require 'redgreen' diff --git a/test/test_redcarpet.rb b/test/test_redcarpet.rb new file mode 100644 index 00000000..1359c449 --- /dev/null +++ b/test/test_redcarpet.rb @@ -0,0 +1,21 @@ +require File.dirname(__FILE__) + '/helper' + +class TestRedcarpet < Test::Unit::TestCase + context "redcarpet" do + setup do + config = { + 'redcarpet' => { 'extensions' => ['smart'] }, + 'markdown' => 'redcarpet' + } + @markdown = MarkdownConverter.new config + end + + should "pass redcarpet options" do + assert_equal "

Some Header

", @markdown.convert('# Some Header #').strip + end + + should "pass redcarpet extensions" do + assert_equal "

“smart”

", @markdown.convert('"smart"').strip + end + end +end diff --git a/test/test_tags.rb b/test/test_tags.rb index 3f25e5c2..c3c19a83 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -123,5 +123,16 @@ CONTENT assert_match %r{FINISH HIM}, @result end end + + context "using Redcarpet" do + setup do + create_post(@content, 'markdown' => 'redcarpet') + end + + should "parse correctly" do + assert_match %r{FIGHT!}, @result + assert_match %r{FINISH HIM}, @result + end + end end end From 1f4dd4ed6139a57024ae247208b2480592ec7dbd Mon Sep 17 00:00:00 2001 From: shoaibkamil Date: Wed, 11 May 2011 22:06:53 -0700 Subject: [PATCH 05/14] Fixed bug in "conversation" importing where
and tags were not being closed. --- lib/jekyll/migrators/tumblr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/migrators/tumblr.rb b/lib/jekyll/migrators/tumblr.rb index 0345b4a9..d7cb3969 100644 --- a/lib/jekyll/migrators/tumblr.rb +++ b/lib/jekyll/migrators/tumblr.rb @@ -65,7 +65,7 @@ module Jekyll content << "
" + line['label'] + "
" + line.inner_html + "
" unless line['label'] == nil || line == nil end - content << "
" + content << "
" elsif post['type'] == "video" title = post.at("video-title").inner_html unless post.at("video-title") == nil content = CGI::unescapeHTML(post.at("video-player").inner_html) From 5788ca88f816f9c1f258f7ee9ae24ad81895a0b9 Mon Sep 17 00:00:00 2001 From: Nicholas Chen Date: Sat, 14 May 2011 10:09:59 -0700 Subject: [PATCH 06/14] Changed [:state] check RE and required YAML 1) The published state is actually stored as "published" in the database but the regular expression checks for "Published" and thus will actually skip all published posts. 2) The to_yaml method is not immediately available without the "require 'yaml'" directive. This caused the migration script to fail while executing it following the instructions. Tested with Typo 5.3 --- lib/jekyll/migrators/typo.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/migrators/typo.rb b/lib/jekyll/migrators/typo.rb index 3de5130a..adb8be96 100644 --- a/lib/jekyll/migrators/typo.rb +++ b/lib/jekyll/migrators/typo.rb @@ -2,6 +2,7 @@ require 'fileutils' require 'rubygems' require 'sequel' +require 'yaml' module Jekyll module Typo @@ -24,7 +25,7 @@ module Jekyll FileUtils.mkdir_p '_posts' db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') db[SQL].each do |post| - next unless post[:state] =~ /Published/ + next unless post[:state] =~ /published/ name = [ sprintf("%.04d", post[:date].year), sprintf("%.02d", post[:date].month), From 22585d4b7ff1f6daa01f53dde5dc5994b562ae1f Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Mon, 23 May 2011 17:23:21 -0400 Subject: [PATCH 07/14] avoid infinite recursion while rendering layouts --- lib/jekyll/convertible.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 1723fa0d..46dbfea1 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -1,3 +1,5 @@ +require 'set' + # Convertible provides methods for converting a pagelike item # from a certain type of markup into actual content # @@ -86,6 +88,8 @@ module Jekyll # recursively render layouts layout = layouts[self.data["layout"]] + used = Set.new([layout]) + while layout payload = payload.deep_merge({"content" => self.output, "page" => layout.data}) @@ -95,7 +99,13 @@ module Jekyll puts "Liquid Exception: #{e.message} in #{self.data["layout"]}" end - layout = layouts[layout.data["layout"]] + if layout = layouts[layout.data["layout"]] + if used.include?(layout) + layout = nil # avoid recursive chain + else + used << layout + end + end end end end From e7135a669fa9527c7df142fcf5c8db9de04667b6 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 29 May 2011 22:43:36 -0700 Subject: [PATCH 08/14] Require cucumber 0.10.3 to fix tests with Ruby 1.9.2. --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 3f22a214..04d60e4d 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_development_dependency('redgreen', ">= 1.2.2") s.add_development_dependency('shoulda', ">= 2.11.3") s.add_development_dependency('rr', ">= 1.0.2") - s.add_development_dependency('cucumber', ">= 0.10.0") + s.add_development_dependency('cucumber', ">= 0.10.3") s.add_development_dependency('RedCloth', ">= 4.2.1") s.add_development_dependency('rdiscount', ">= 1.6.5") s.add_development_dependency('redcarpet', ">= 1.9.0") From 897d3e4e309ba60cf0412a6dee2617d7108e17dd Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 29 May 2011 22:44:04 -0700 Subject: [PATCH 09/14] Update history. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index ef9a75ee..d9756cac 100644 --- a/History.txt +++ b/History.txt @@ -1,6 +1,7 @@ == HEAD * Major Enhancements * Add command line importer functionality (#253) + * Add Recarpet Markdown support (#318) * Minor Enhancements * Switch to Albino gem * Bundler support From 14f371c792bf69be752fb7c01cb4860ebdefaf43 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Mon, 30 May 2011 11:18:15 -0700 Subject: [PATCH 10/14] Update gemspec so bundler installs work. --- jekyll.gemspec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 04d60e4d..7e45db2e 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = 'jekyll' s.version = '0.10.0' - s.date = '2010-12-16' + s.date = '2011-05-30' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -39,6 +39,7 @@ Gem::Specification.new do |s| # = MANIFEST = s.files = %w[ + Gemfile History.txt LICENSE README.textile @@ -57,7 +58,6 @@ Gem::Specification.new do |s| features/support/env.rb jekyll.gemspec lib/jekyll.rb - lib/jekyll/albino.rb lib/jekyll/converter.rb lib/jekyll/converters/identity.rb lib/jekyll/converters/markdown.rb @@ -71,13 +71,16 @@ Gem::Specification.new do |s| lib/jekyll/layout.rb lib/jekyll/migrators/csv.rb lib/jekyll/migrators/drupal.rb + lib/jekyll/migrators/enki.rb lib/jekyll/migrators/marley.rb lib/jekyll/migrators/mephisto.rb lib/jekyll/migrators/mt.rb + lib/jekyll/migrators/posterous.rb lib/jekyll/migrators/textpattern.rb + lib/jekyll/migrators/tumblr.rb lib/jekyll/migrators/typo.rb - lib/jekyll/migrators/wordpress.com.rb lib/jekyll/migrators/wordpress.rb + lib/jekyll/migrators/wordpressdotcom.rb lib/jekyll/page.rb lib/jekyll/plugin.rb lib/jekyll/post.rb @@ -133,6 +136,7 @@ Gem::Specification.new do |s| test/test_pager.rb test/test_post.rb test/test_rdiscount.rb + test/test_redcarpet.rb test/test_site.rb test/test_tags.rb ] From 70b1112cca2078eeba45435f875a0a4986e31dbc Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Mon, 30 May 2011 11:45:30 -0700 Subject: [PATCH 11/14] Update history. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index d9756cac..042e9074 100644 --- a/History.txt +++ b/History.txt @@ -2,6 +2,7 @@ * Major Enhancements * Add command line importer functionality (#253) * Add Recarpet Markdown support (#318) + * Make markdown/textile extensions configurable (#312) * Minor Enhancements * Switch to Albino gem * Bundler support From 851172b5ef1a7c649296dd00390c067168eebc0f Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Tue, 31 May 2011 14:40:21 -0700 Subject: [PATCH 12/14] Replace rdiscount filter with config-aware markdownify. --- History.txt | 1 + lib/jekyll/filters.rb | 12 ++++++++---- lib/jekyll/site.rb | 13 +++++++++++++ test/helper.rb | 1 - test/test_filters.rb | 9 +++++++-- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/History.txt b/History.txt index 042e9074..326affc1 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Add command line importer functionality (#253) * Add Recarpet Markdown support (#318) * Make markdown/textile extensions configurable (#312) + * Add `markdownify` filter * Minor Enhancements * Switch to Albino gem * Bundler support diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 8fd3f4c0..eb61d84a 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -9,16 +9,20 @@ module Jekyll # # Returns the HTML formatted String. def textilize(input) - TextileConverter.new.convert(input) + site = @context.registers[:site] + converter = site.getConverterImpl(Jekyll::TextileConverter) + converter.convert(input) end - # Convert a Markdown string into HTML output using RDiscount. + # Convert a Markdown string into HTML output. # # input - The Markdown String to convert. # # Returns the HTML formatted String. - def rdiscount(input) - RDiscount.new(input).to_html + def markdownify(input) + site = @context.registers[:site] + converter = site.getConverterImpl(Jekyll::MarkdownConverter) + converter.convert(input) end # Format a date in short format e.g. "27 Jan 2011". diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 41905d65..69ea43e7 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -314,5 +314,18 @@ module Jekyll end end + # Get the implementation class for the given Converter. + # + # klass - The Class of the Converter to fetch. + # + # Returns the Converter instance implementing the given Converter. + def getConverterImpl(klass) + matches = self.converters.select { |c| c.class == klass } + if impl = matches.first + impl + else + raise "Converter implementation not found for #{klass}" + end + end end end diff --git a/test/helper.rb b/test/helper.rb index 2d2e9871..c6a8a763 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -12,7 +12,6 @@ require 'redgreen' if RUBY_VERSION < '1.9' require 'shoulda' require 'rr' - include Jekyll # Send STDERR into the void to suppress program output messages diff --git a/test/test_filters.rb b/test/test_filters.rb index 4b554319..205d4bca 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -3,6 +3,11 @@ require 'helper' class TestFilters < Test::Unit::TestCase class JekyllFilter include Jekyll::Filters + + def initialize + site = Jekyll::Site.new(Jekyll.configuration({})) + @context = Liquid::Context.new({}, {}, { :site => site }) + end end context "filters" do @@ -14,8 +19,8 @@ class TestFilters < Test::Unit::TestCase assert_equal "

something really simple

", @filter.textilize("something *really* simple") end - should "rdiscount with simple string" do - assert_equal "

something really simple

\n", @filter.rdiscount("something **really** simple") + should "markdownify with simple string" do + assert_equal "

something really simple

", @filter.markdownify("something **really** simple") end should "convert array to sentence string with no args" do From 6a756881f920008e40f2894e5044c7a16444e9af Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Fri, 3 Jun 2011 23:38:39 +0100 Subject: [PATCH 13/14] clean up some warnings --- lib/jekyll/page.rb | 3 ++- lib/jekyll/plugin.rb | 1 + lib/jekyll/site.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index a4a0f9f3..82b82048 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -3,8 +3,9 @@ module Jekyll class Page include Convertible + attr_writer :dir attr_accessor :site, :pager - attr_accessor :name, :ext, :basename, :dir + attr_accessor :name, :ext, :basename attr_accessor :data, :content, :output # Initialize a new Page. diff --git a/lib/jekyll/plugin.rb b/lib/jekyll/plugin.rb index 208472f0..600f326d 100644 --- a/lib/jekyll/plugin.rb +++ b/lib/jekyll/plugin.rb @@ -34,6 +34,7 @@ module Jekyll # # Returns the Symbol priority. def self.priority(priority = nil) + @priority ||= nil if priority && PRIORITIES.has_key?(priority) @priority = priority end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 69ea43e7..9c24f8e4 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -266,7 +266,7 @@ module Jekyll def post_attr_hash(post_attr) # Build a hash map based on the specified post attribute ( post attr => # array of posts ) then sort each array in reverse order. - hash = Hash.new { |hash, key| hash[key] = Array.new } + hash = Hash.new { |hsh, key| hsh[key] = Array.new } self.posts.each { |p| p.send(post_attr.to_sym).each { |t| hash[t] << p } } hash.values.map { |sortme| sortme.sort! { |a, b| b <=> a } } hash From 89f48927ad0a9d24f637624e16fcb9182547f7f4 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Sun, 26 Jun 2011 07:09:01 -0700 Subject: [PATCH 14/14] fixed redcarpet typo --- History.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/History.txt b/History.txt index 326affc1..d0091fd0 100644 --- a/History.txt +++ b/History.txt @@ -1,7 +1,7 @@ == HEAD * Major Enhancements * Add command line importer functionality (#253) - * Add Recarpet Markdown support (#318) + * Add Redcarpet Markdown support (#318) * Make markdown/textile extensions configurable (#312) * Add `markdownify` filter * Minor Enhancements