mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
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
This commit is contained in:
@@ -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\">" +
|
||||
|
||||
Reference in New Issue
Block a user