|
|
|
@ -36,6 +36,11 @@ class Sanitize
|
|
|
|
|
node['class'] = class_list.join(' ')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
TRANSLATE_TRANSFORMER = lambda do |env|
|
|
|
|
|
node = env[:node]
|
|
|
|
|
node.remove_attribute('translate') unless node['translate'] == 'no'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
UNSUPPORTED_HREF_TRANSFORMER = lambda do |env|
|
|
|
|
|
return unless env[:node_name] == 'a'
|
|
|
|
|
|
|
|
|
@ -63,8 +68,8 @@ class Sanitize
|
|
|
|
|
elements: %w(p br span a del pre blockquote code b strong u i em ul ol li),
|
|
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
|
'a' => %w(href rel class),
|
|
|
|
|
'span' => %w(class),
|
|
|
|
|
'a' => %w(href rel class translate),
|
|
|
|
|
'span' => %w(class translate),
|
|
|
|
|
'ol' => %w(start reversed),
|
|
|
|
|
'li' => %w(value),
|
|
|
|
|
},
|
|
|
|
@ -80,6 +85,7 @@ class Sanitize
|
|
|
|
|
|
|
|
|
|
transformers: [
|
|
|
|
|
CLASS_WHITELIST_TRANSFORMER,
|
|
|
|
|
TRANSLATE_TRANSFORMER,
|
|
|
|
|
UNSUPPORTED_ELEMENTS_TRANSFORMER,
|
|
|
|
|
UNSUPPORTED_HREF_TRANSFORMER,
|
|
|
|
|
]
|
|
|
|
|