Created
August 28, 2010 06:49
-
-
Save ankopainting/554826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby | |
require 'rubygems' | |
require 'sanitize' | |
require 'cgi' | |
doc = <<-EOS | |
<style>body{scrollbar-face-color:white;scrollbar-shadow-color:#C71585;scrollbar-highlight-color:#C71585;scrollbar-3dlight-color:white;scrollbar-darkshadow-color:white;scrollbar-track-color:white;scrollbar-arrow-color:#4169E1;}</style><P> | |
<P> | |
<STYLE type="text/css">A:hover{COLOR:white;background:url(http://blah.com/rainbow.GIF);}hr{background-image:url(http://blah.com/rainbow.GIF);width:100%;height:4;border:0;}input{background:url(http://blah.com/rainbow.GIF); border: 1pt solid mediumpurple; font-family: verdana; color: mediumpurple; font-size: 10px;letter-spacing:0pt} --> </STYLE>This is a test <P> | |
<P> | |
<p> | |
</p> | |
EOS | |
unescaped = CGI.unescapeHTML(doc) | |
puts Sanitize.clean(unescaped, :elements => %w!a b i strong img br p!) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment