Last active
December 15, 2015 01:59
-
-
Save wejrowski/5183874 to your computer and use it in GitHub Desktop.
CSS image parser
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
urls = "" | |
DATA.each do |l| | |
img = l[/url\([^)]*\)/] | |
urls << "<img src=#{img.gsub(/url\(([^)]*)\)/, '\1')} /><hr />\n" if img | |
end | |
f = File.open("urltest.html", "w") {|file| file.truncate(0) } # Clear file contents | |
f = File.open("urltest.html", "w") | |
f.write urls | |
f.close | |
__END__ | |
body{ | |
color: #333333; | |
font-family: 'Yanone Kaffeesatz', 'Lucida Grande', sans-serif; | |
font-size: 18px; | |
background: #ffffff; | |
} | |
#header { | |
background: url('http://img.png'); | |
} | |
#account-bar{ | |
background: #ff7c00 url("http://img.gif") top left repeat-x; | |
font-family: "Myriad Pro", Helvetica, sans-serif; | |
font-size: 13px; | |
width: 122px; | |
padding-top: 10px; | |
position: absolute; | |
} | |
#notice .error{ | |
background: #f3d0c2 url("http://img.jpeg") 7px 6px no-repeat; | |
border: 1px solid #9a1f06; | |
} | |
#notice .success{ | |
background: #dff3c2 url("http://image.jpg") 7px 6px no-repeat; | |
border: 1px solid #3b9905; | |
} | |
#notice .warning{ | |
background: #fef5bf url("http://image.gif") 7px 6px no-repeat; | |
border: 1px solid #d48200; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment