diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/wiki_formatting/textile/formatter.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 4d4e4b240..2555479d4 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -120,9 +120,10 @@ 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) - language = $1 - text = $2 + # This regex must match any data produced by RedCloth3#rip_offtags + if content.match(/<code\s+class=(?:"([^"]+)"|'([^']+)')>\s?(.*)/m) + language = $1 || $2 + text = $3 if Redmine::SyntaxHighlighting.language_supported?(language) content = "<code class=\"#{language} syntaxhl\">" + Redmine::SyntaxHighlighting.highlight_by_language(text, language) |