Merge remote-tracking branch 'derekprior/configurable_coverter_file_extensions'
This commit is contained in:
commit
da9930657e
|
@ -66,6 +66,9 @@ module Jekyll
|
|||
'markdown' => 'maruku',
|
||||
'permalink' => 'date',
|
||||
|
||||
'markdown_ext' => 'markdown,mkd,mkdn,md',
|
||||
'textile_ext' => 'textile',
|
||||
|
||||
'maruku' => {
|
||||
'use_tex' => false,
|
||||
'use_divs' => false,
|
||||
|
|
|
@ -76,7 +76,8 @@ module Jekyll
|
|||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -397,6 +397,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,mkd,mkdn,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
|
||||
|
|
Loading…
Reference in New Issue