summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-12-05 12:05:12 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-12-05 12:05:12 +0000
commit0e321e6a86635f09cb1d53e022c88c8804c79272 (patch)
tree86081cfdef0b47515f34169408e6ed064964021f /lib
parent70d4865b1c39b2010c37949cbb75c7b2b8ebf546 (diff)
downloadredmine-0e321e6a86635f09cb1d53e022c88c8804c79272.tar.gz
redmine-0e321e6a86635f09cb1d53e022c88c8804c79272.zip
Merged r19333 from trunk to 4.0-stable (#25742)
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/4.0-stable@19335 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-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 89e6105a8..a79b9e1a4 100644
--- a/lib/redmine/wiki_formatting/textile/formatter.rb
+++ b/lib/redmine/wiki_formatting/textile/formatter.rb
@@ -121,9 +121,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)
text.gsub!(/x%x%/, '&')
content = "<code class=\"#{language} syntaxhl\">" +