diff options
-rw-r--r-- | lib/redmine/wiki_formatting/textile/formatter.rb | 2 | ||||
-rw-r--r-- | test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index a698cad45..4d4e4b240 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -120,7 +120,7 @@ module Redmine ## replace <pre> content text.gsub!(/<redpre#(\d+)>/) do content = @pre_list[$1.to_i] - if content.match(/<code\s+class="(\w+)">\s?(.+)/m) + if content.match(/<code\s+class=["'](\w+)["']>\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 7e5ef8cb2..8920a6ae9 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -542,7 +542,10 @@ STR end def test_should_allow_valid_language_class_attribute_on_code_tags + # language name is double-quoted assert_html_output({"<code class=\"ruby\">test</code>" => "<code class=\"ruby syntaxhl\"><span class=\"CodeRay\">test</span></code>"}, false) + # language name is single-quoted + assert_html_output({"<code class='ruby'>test</code>" => "<code class=\"ruby syntaxhl\"><span class=\"CodeRay\">test</span></code>"}, false) end def test_should_not_allow_valid_language_class_attribute_on_non_code_offtags |