From: Go MAEDA Date: Wed, 2 May 2018 02:27:10 +0000 (+0000) Subject: Fix: Syntax highlighter does not work if language name is single-quoted (#28469). X-Git-Tag: 4.0.0~311 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=00b85dc8d9a5102c494e32739abac0a836ca125a;p=redmine.git Fix: Syntax highlighter does not work if language name is single-quoted (#28469). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@17322 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 63851a21a..6e7f28e62 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -120,7 +120,7 @@ module Redmine ## replace
 content
             text.gsub!(//) do
               content = @pre_list[$1.to_i]
-              if content.match(/\s?(.+)/m)
+              if content.match(/\s?(.+)/m)
                 language = $1
                 text = $2
                 if Redmine::SyntaxHighlighting.language_supported?(language)
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
index 059f0b83a..712bc5000 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -546,7 +546,10 @@ STR
   end
 
   def test_should_allow_valid_language_class_attribute_on_code_tags
+    # language name is double-quoted
     assert_html_output({"test" => "test"}, false)
+    # language name is single-quoted
+    assert_html_output({"test" => "test"}, false)
   end
 
   def test_should_not_allow_valid_language_class_attribute_on_non_code_offtags