mirror of
https://github.com/redmine/redmine.git
synced 2025-12-23 17:00:29 +01:00
Remove style tags from html body (#15716).
git-svn-id: http://svn.redmine.org/redmine/trunk@14315 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -23,7 +23,8 @@ module Redmine
|
||||
|
||||
class_attribute :tags
|
||||
self.tags = {
|
||||
'br' => {:post => "\n"}
|
||||
'br' => {:post => "\n"},
|
||||
'style' => ''
|
||||
}
|
||||
|
||||
def self.to_text(html)
|
||||
@@ -44,9 +45,16 @@ module Redmine
|
||||
|
||||
def scrub(node)
|
||||
formatting = @tags_to_text[node.name]
|
||||
return CONTINUE unless formatting
|
||||
node.add_next_sibling Nokogiri::XML::Text.new("#{formatting[:pre]}#{node.content}#{formatting[:post]}", node.document)
|
||||
node.remove
|
||||
case formatting
|
||||
when Hash
|
||||
node.add_next_sibling Nokogiri::XML::Text.new("#{formatting[:pre]}#{node.content}#{formatting[:post]}", node.document)
|
||||
node.remove
|
||||
when String
|
||||
node.add_next_sibling Nokogiri::XML::Text.new(formatting, node.document)
|
||||
node.remove
|
||||
else
|
||||
CONTINUE
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user