From 4bf716c2ad36d955a27250e12509ae9e4eb8b940 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 22 Dec 2013 16:50:13 +0100 Subject: [PATCH] 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. --- lib/jekyll/configuration.rb | 5 ++++- test/test_configuration.rb | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 46c3365c..53e0bf4f 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -212,8 +212,11 @@ module Jekyll if config.has_key? 'pygments' Jekyll.logger.warn "Deprecation:", "The 'pygments' configuration option" + " 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" + + config['highlighter'] = 'pygments' if config['pygments'] + config.delete('pygments') end %w[include exclude].each do |option| diff --git a/test/test_configuration.rb b/test/test_configuration.rb index d911b779..36e6cb1d 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -51,11 +51,12 @@ class TestConfiguration < Test::Unit::TestCase context "#backwards_compatibilize" do setup do @config = Configuration[{ - "auto" => true, - "watch" => true, - "server" => true, - "exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown", - "include" => "STOP_THE_PRESSES.txt,.heloses, .git" + "auto" => true, + "watch" => true, + "server" => true, + "exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown", + "include" => "STOP_THE_PRESSES.txt,.heloses, .git", + "pygments" => true, }] end should "unset 'auto' and 'watch'" do @@ -78,6 +79,11 @@ class TestConfiguration < Test::Unit::TestCase assert @config.backwards_compatibilize.has_key?("include") assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git] 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 context "#fix_common_issues" do setup do