Browse files

Cleanup for RDiscount TOC support. Closes #333.

  • Loading branch information...
1 parent 6471ebf commit 8a0fbf02f5430a0ca53cf6399b6b9bfbf2e8fbc0 @mojombo mojombo committed Apr 23, 2012
Showing with 5 additions and 4 deletions.
  1. +1 −0 History.txt
  2. +2 −2 lib/jekyll/converters/markdown.rb
  3. +2 −2 test/test_rdiscount.rb
View
1 History.txt
@@ -5,6 +5,7 @@
* Allow setting of RedCloth options (#284)
* Add post_url Liquid tag for internal post linking (#369)
* Allow multiple plugin dirs to be specified (#438)
+ * Inline TOC token support for RDiscount (#333)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
View
4 lib/jekyll/converters/markdown.rb
@@ -119,8 +119,8 @@ def convert(content)
when 'rdiscount'
rd = RDiscount.new(content, *@rdiscount_extensions)
html = rd.to_html
- if rd.generate_toc and html.include? @config['rdiscount']['toc_token']
- html.gsub! @config['rdiscount']['toc_token'], rd.toc_content
+ if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
+ html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
end
html
when 'maruku'
View
4 test/test_rdiscount.rb
@@ -5,8 +5,8 @@ class TestRdiscount < Test::Unit::TestCase
context "rdiscount" do
setup do
config = {
- 'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' },
- 'markdown' => 'rdiscount'
+ 'markdown' => 'rdiscount',
+ 'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' }
}
@markdown = MarkdownConverter.new config
end

0 comments on commit 8a0fbf0

Please sign in to comment.