Set highlighter to pygments when upgrading

In case you are upgrading from 1.4.2 to 2.0 and the pygments option is
set to true, then the highlighter option will be set to pygments
automatically.
This commit is contained in:
Robin Dupret 2013-12-22 16:50:13 +01:00
parent 0831d2b0f8
commit 4bf716c2ad
2 changed files with 15 additions and 6 deletions

View File

@ -212,8 +212,11 @@ module Jekyll
if config.has_key? 'pygments' if config.has_key? 'pygments'
Jekyll.logger.warn "Deprecation:", "The 'pygments' configuration option" + Jekyll.logger.warn "Deprecation:", "The 'pygments' configuration option" +
" has been renamed to 'highlighter'. Please update your" + " has been renamed to 'highlighter'. Please update your" +
" config file accordingly. The allowed values are 'rouge"+ " config file accordingly. The allowed values are 'rouge', " +
"'pygments' or null" "'pygments' or null"
config['highlighter'] = 'pygments' if config['pygments']
config.delete('pygments')
end end
%w[include exclude].each do |option| %w[include exclude].each do |option|

View File

@ -55,7 +55,8 @@ class TestConfiguration < Test::Unit::TestCase
"watch" => true, "watch" => true,
"server" => true, "server" => true,
"exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown", "exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown",
"include" => "STOP_THE_PRESSES.txt,.heloses, .git" "include" => "STOP_THE_PRESSES.txt,.heloses, .git",
"pygments" => true,
}] }]
end end
should "unset 'auto' and 'watch'" do should "unset 'auto' and 'watch'" do
@ -78,6 +79,11 @@ class TestConfiguration < Test::Unit::TestCase
assert @config.backwards_compatibilize.has_key?("include") assert @config.backwards_compatibilize.has_key?("include")
assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git] assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git]
end end
should "set highlighter to pygments" do
assert @config.has_key?("pygments")
assert !@config.backwards_compatibilize.has_key?("pygments")
assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
end
end end
context "#fix_common_issues" do context "#fix_common_issues" do
setup do setup do