summaryrefslogtreecommitdiffstats
path: root/lib/redmine/wiki_formatting/html_parser.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-16 18:23:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-06-16 18:23:25 +0000
commite911ce7cb41c3fce7d78f7032f2772b7061446bf (patch)
tree5752ae89cf3e82f8824b97fca1b92ca216515233 /lib/redmine/wiki_formatting/html_parser.rb
parent95f7471e9c786a7cf5700f6b078ed62ca0cf264e (diff)
downloadredmine-e911ce7cb41c3fce7d78f7032f2772b7061446bf.tar.gz
redmine-e911ce7cb41c3fce7d78f7032f2772b7061446bf.zip
Remove style tags from html body (#15716).
git-svn-id: http://svn.redmine.org/redmine/trunk@14315 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting/html_parser.rb')
-rw-r--r--lib/redmine/wiki_formatting/html_parser.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/redmine/wiki_formatting/html_parser.rb b/lib/redmine/wiki_formatting/html_parser.rb
index 9d83497bd..a81d9d9e7 100644
--- a/lib/redmine/wiki_formatting/html_parser.rb
+++ b/lib/redmine/wiki_formatting/html_parser.rb
@@ -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