1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-11 11:43:08 +00:00

Merged r17322 from trunk to 3.4-stable (#28469).

git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17323 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2018-05-02 02:29:40 +00:00
parent 20d16fdba0
commit 941eb22e99
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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