Sanitizer Fix
Whoops! Looks like Ryan changed the API for the HTML5 sanitizer. Bad, bad, bad. Fixed now.
This commit is contained in:
parent
81d3cdc8e4
commit
6fd6be8fea
|
@ -52,12 +52,12 @@ module Sanitize
|
||||||
options.each do |name, value|
|
options.each do |name, value|
|
||||||
next unless %w(encoding treebuilder to_tree).include? name.to_s
|
next unless %w(encoding treebuilder to_tree).include? name.to_s
|
||||||
if name.to_s == 'treebuilder'
|
if name.to_s == 'treebuilder'
|
||||||
@treebuilder = HTML5lib::TreeBuilders.getTreeBuilder(value)
|
@treebuilder = HTML5lib::TreeBuilders.get_tree_builder(value)
|
||||||
else
|
else
|
||||||
instance_variable_set("@#{name}", value)
|
instance_variable_set("@#{name}", value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
parsed = XHTMLParser.parseFragment(html.to_ncr, {:tokenizer => HTMLSanitizer,
|
parsed = XHTMLParser.parse_fragment(html.to_ncr, {:tokenizer => HTMLSanitizer,
|
||||||
:encoding => @encoding, :tree => @treebuilder })
|
:encoding => @encoding, :tree => @treebuilder })
|
||||||
return parsed if @to_tree
|
return parsed if @to_tree
|
||||||
return parsed.to_s
|
return parsed.to_s
|
||||||
|
@ -81,12 +81,12 @@ module Sanitize
|
||||||
options.each do |name, value|
|
options.each do |name, value|
|
||||||
next unless %w(encoding treebuilder to_tree).include? name.to_s
|
next unless %w(encoding treebuilder to_tree).include? name.to_s
|
||||||
if name.to_s == 'treebuilder'
|
if name.to_s == 'treebuilder'
|
||||||
@treebuilder = HTML5lib::TreeBuilders.getTreeBuilder(value)
|
@treebuilder = HTML5lib::TreeBuilders.get_tree_builder(value)
|
||||||
else
|
else
|
||||||
instance_variable_set("@#{name}", value)
|
instance_variable_set("@#{name}", value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
parsed = HTMLParser.parseFragment(html.to_ncr, {:tokenizer => HTMLSanitizer,
|
parsed = HTMLParser.parse_fragment(html.to_ncr, {:tokenizer => HTMLSanitizer,
|
||||||
:encoding => @encoding, :tree => @treebuilder })
|
:encoding => @encoding, :tree => @treebuilder })
|
||||||
return parsed if @to_tree
|
return parsed if @to_tree
|
||||||
return parsed.to_s
|
return parsed.to_s
|
||||||
|
@ -98,7 +98,7 @@ module Sanitize
|
||||||
# sanitize_rexml(tree) -> string
|
# sanitize_rexml(tree) -> string
|
||||||
#
|
#
|
||||||
def sanitize_rexml(tree)
|
def sanitize_rexml(tree)
|
||||||
tokens = TreeWalkers.getTreeWalker('rexml').new(tree.to_ncr)
|
tokens = TreeWalkers.get_tree_walker('rexml').new(tree.to_ncr)
|
||||||
XHTMLSerializer.serialize(tokens, {:encoding=>'utf-8',
|
XHTMLSerializer.serialize(tokens, {:encoding=>'utf-8',
|
||||||
:space_before_trailing_solidus => true,
|
:space_before_trailing_solidus => true,
|
||||||
:inject_meta_charset => false,
|
:inject_meta_charset => false,
|
||||||
|
|
Loading…
Reference in a new issue