diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-12-05 11:25:24 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-12-05 11:25:24 +0000 |
commit | 58763243727e1aef9b2a8f0535c6b46792243565 (patch) | |
tree | 2e998bc55f6101d1bff634e02bfa8d031b6a94dd /lib | |
parent | 62e626e6801e3b4fe9ef55565f4f6065325f608e (diff) | |
download | redmine-58763243727e1aef9b2a8f0535c6b46792243565.tar.gz redmine-58763243727e1aef9b2a8f0535c6b46792243565.zip |
filter all possibly class values on code tags in Textile (#25742)
Contributed by Holger Just from Planio.
git-svn-id: http://svn.redmine.org/redmine/trunk@19333 e93f8b46-1217-0410-a6f0-8f06a7374b81
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 47ddfbb0f..2858e9805 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -123,9 +123,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\">" + |