Cleanup for RDiscount TOC support. Closes #333.

This commit is contained in:
Tom Preston-Werner 2012-04-23 16:15:44 -07:00
parent 6471ebf0ef
commit 8a0fbf02f5
3 changed files with 5 additions and 4 deletions

View File

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

@ -119,8 +119,8 @@ module Jekyll
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 File

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