Ruby 1.9 Compatibility
Completely removed the html5lib sanitizer. Fixed the string-handling to work in both Ruby 1.8.x and 1.9.2. There are still, inexplicably, two functional tests that fail. But the rest seems to work quite well.
This commit is contained in:
parent
79c8572053
commit
a6429f8c22
142 changed files with 519 additions and 843 deletions
|
@ -19,7 +19,7 @@ class SanitizerTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def check_sanitization(input, htmloutput, xhtmloutput, rexmloutput)
|
||||
assert_equal xhtmloutput, do_sanitize_xhtml(input)
|
||||
assert_equal xhtmloutput.as_bytes, do_sanitize_xhtml(input).as_bytes
|
||||
end
|
||||
|
||||
def test_sanitize_named_entities
|
||||
|
@ -27,12 +27,12 @@ class SanitizerTest < Test::Unit::TestCase
|
|||
output = "<p>Greek \317\225 \317\206, double-struck \360\235\224\270, numeric \360\235\224\270 \342\201\227, uppercase \342\204\242 <</p>"
|
||||
output2 = "<p>Greek \317\225 \317\206, double-struck \360\235\224\270, numeric 𝔸 ⁗, uppercase \342\204\242 <</p>"
|
||||
check_sanitization(input, output, output, output)
|
||||
assert_equal(output2, input.to_utf8)
|
||||
assert_equal(output2, input.to_utf8.as_bytes)
|
||||
end
|
||||
|
||||
def test_sanitize_malformed_utf8
|
||||
input = "<p>\357elephant & \302ivory</p>".purify
|
||||
output = "<p>ephant & vory</p>"
|
||||
output = "".respond_to?(:force_encoding) ? "<p>elephant & ivory</p>" : "<p>ephant & vory</p>"
|
||||
check_sanitization(input, output, output, output)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue