diff --git a/features/site_configuration.feature b/features/site_configuration.feature index e0a50136..f42f3833 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -105,6 +105,15 @@ Feature: Site configuration And I should see "Hello world!" in "_site/index.html" And I should see "class=\"highlight\"" in "_site/index.html" + Scenario: Rouge renders code block once + Given I have a configuration file with "highlighter" set to "rouge" + And I have a _posts directory + And I have the following post: + | title | date | layout | content | + | foo | 2014-04-27 11:34 | default | {% highlight text %} test {% endhighlight %} | + When I run jekyll build + Then I should not see "highlight(.*)highlight" in "_site/2014/04/27/foo.html" + Scenario: Set time and no future dated posts Given I have a _layouts directory And I have a page layout that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 7dbf45e1..4fe7edd2 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -165,7 +165,7 @@ Then /^the (.*) directory should not exist$/ do |dir| end Then /^I should see "(.*)" in "(.*)"$/ do |text, file| - assert_match Regexp.new(text), file_contents(file) + assert_match Regexp.new(text, Regexp::MULTILINE), file_contents(file) end Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file| @@ -173,7 +173,7 @@ Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file| end Then /^I should not see "(.*)" in "(.*)"$/ do |text, file| - assert_no_match Regexp.new(text), file_contents(file) + assert_no_match Regexp.new(text, Regexp::MULTILINE), file_contents(file) end Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file| diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 36c2211a..d9e471ac 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -86,8 +86,9 @@ eos formatter = Rouge::Formatters::HTML.new(line_numbers: linenos, wrap: false) pre = "
#{formatter.format(lexer.lex(code))}
" + output = "" - output = context["highlighter_prefix"] || "" + output << context["highlighter_prefix"] if context["highlighter_prefix"] output << "
" output << add_code_tags(pre, @lang) output << "
"