Prevent result of SyntaxHighlightFilter being sanitized

This commit is contained in:
Robert Speicher 2015-09-05 17:50:47 -04:00
parent b2f3d024c3
commit 7cbf5e4d18

View file

@ -67,12 +67,16 @@ module Gitlab
def clean_spans
lambda do |env|
return unless env[:node_name] == 'span'
return unless env[:node].has_attribute?('class')
node = env[:node]
unless has_ancestor?(env[:node], 'pre')
env[:node].remove_attribute('class')
return unless node.name == 'span'
return unless node.has_attribute?('class')
unless has_ancestor?(node, 'pre')
node.remove_attribute('class')
end
{node_whitelist: [node]}
end
end
end