##// END OF EJS Templates
Do not html escape code that is going to be highlighted (#2985, #3359)....
Jean-Philippe Lang -
r3468:7621463acb1c
parent child
Show More
@@ -1060,7 +1060,7 class RedCloth3 < String
1060 codepre, used_offtags = 0, {}
1060 codepre, used_offtags = 0, {}
1061 text.gsub!( OFFTAG_MATCH ) do |line|
1061 text.gsub!( OFFTAG_MATCH ) do |line|
1062 if $3
1062 if $3
1063 offtag, aftertag = $4, $5
1063 first, offtag, aftertag = $3, $4, $5
1064 codepre += 1
1064 codepre += 1
1065 used_offtags[offtag] = true
1065 used_offtags[offtag] = true
1066 if codepre - used_offtags.length > 0
1066 if codepre - used_offtags.length > 0
@@ -1068,9 +1068,13 class RedCloth3 < String
1068 @pre_list.last << line
1068 @pre_list.last << line
1069 line = ""
1069 line = ""
1070 else
1070 else
1071 htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag
1071 ### htmlesc is disabled between CODE tags which will be parsed with highlighter
1072 ### Regexp in formatter.rb is : /<code\s+class="(\w+)">\s?(.+)/m
1073 ### NB: some changes were made not to use $N variables, because we use "match"
1074 ### and it breaks following lines
1075 htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag && !first.match(/<code\s+class="(\w+)">/)
1072 line = "<redpre##{ @pre_list.length }>"
1076 line = "<redpre##{ @pre_list.length }>"
1073 $3.match(/<#{ OFFTAGS }([^>]*)>/)
1077 first.match(/<#{ OFFTAGS }([^>]*)>/)
1074 tag = $1
1078 tag = $1
1075 $2.to_s.match(/(class\=\S+)/i)
1079 $2.to_s.match(/(class\=\S+)/i)
1076 tag << " #{$1}" if $1
1080 tag << " #{$1}" if $1
@@ -54,7 +54,7 module Redmine
54 content = @pre_list[$1.to_i]
54 content = @pre_list[$1.to_i]
55 if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
55 if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
56 content = "<code class=\"#{$1} CodeRay\">" +
56 content = "<code class=\"#{$1} CodeRay\">" +
57 CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
57 CodeRay.scan($2, $1.downcase).html(:line_numbers => :inline)
58 end
58 end
59 content
59 content
60 end
60 end
General Comments 0
You need to be logged in to leave comments. Login now