summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-12-05 12:07:15 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-12-05 12:07:15 +0000
commit4c435dba1a4e642f2276c2d750e32e8bbef4efb8 (patch)
tree3dbcf5522b364715c0c0b4f140e7ee519ac3189e /lib/redmine
parent32f4002a5f75bba2981049b84ea3f0baefbdb7f9 (diff)
downloadredmine-3.3-stable.tar.gz
redmine-3.3-stable.zip
Merged r19333 from trunk to 3.3-stable (#25742)3.3-stable
Filter all possibly class values on code tags in Textile. Contributed by Holger Just from Planio. git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@19337 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/wiki_formatting/textile/formatter.rb7
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)