public
Description: Rails plugin to validate XHTML and CSS
Homepage: http://www.realityforge.org/articles/2006/03/15/rails-plugin-to-validate-x-html-and-css
Clone URL: git://github.com/CodeMonkeySteve/assert-valid-asset.git
Fixed CSS validation (sync from official SVN).
Sun May 11 21:58:01 -0700 2008
commit  398d0f85fb423c55f61edd450b4d1d8ce884a4f5
tree    8d2c6c56a4c2a7c81b5da6d4a99917622aac50bb
parent  52d33dbe4f5f129d8d9bb45c91f3d2e2e5ce8c68
0
...
114
115
116
117
118
 
 
 
...
114
115
116
 
117
118
119
120
0
@@ -114,4 +114,6 @@ Peter Donald <peter at realityforge dot org> to add validation of CSS files and
0
 Simon Stapleton for inspiration to add who added support display_invalid_content.
0
 Clifford T. Matthews fix for ruby 1.8.5 and configuration of server endpoints.
0
 Tomasz Wegrzanowski for replacing class variables with class_inheritable_accessor.
0
-Cédric Deltheil for ensuring process_with_auto_validate returns the response.
0
\ No newline at end of file
0
+Cédric Deltheil for ensuring process_with_auto_validate returns the response.
0
+Nick Plante for fixing css validation.
0
+
...
120
121
122
123
 
124
125
126
127
128
129
130
 
 
 
 
 
131
132
133
...
120
121
122
 
123
124
125
126
127
128
 
 
129
130
131
132
133
134
135
136
0
@@ -120,14 +120,17 @@ class Test::Unit::TestCase
0
         text_to_multipart('usermedium','all') ]
0
       
0
       boundary = '-----------------------------24464570528145'
0
- query = params.collect { |p| '--' + boundary + "\r\n" + p }.join('') + boundary + "--\r\n"
0
+ query = params.collect { |p| '--' + boundary + "\r\n" + p }.join('') + '--' + boundary + "--\r\n"
0
 
0
       response = http.start(CSS_VALIDATOR_HOST).post2(CSS_VALIDATOR_PATH,query,"Content-type" => "multipart/form-data; boundary=" + boundary)
0
       File.open(results_filename, 'w+') do |f| Marshal.dump(response, f) end
0
     end
0
     messages = []
0
- REXML::XPath.each( REXML::Document.new(response.body).root, "//div[@id='errors']//tr[@class='error']") do |element|
0
- messages << element.to_s.gsub(/<[^>]+>/,' ').gsub(/\n/,' ').gsub(/\s+/, ' ')
0
+ begin
0
+ REXML::XPath.each( REXML::Document.new(response.body).root, "//x:tr[@class='error']", { "x"=>"http://www.w3.org/1999/xhtml" }) do |element|
0
+ messages << "Invalid CSS: line" + element.to_s.gsub(/<[^>]+>/,' ').gsub(/\n/,' ').gsub(/\s+/, ' ')
0
+ end
0
+ rescue REXML::ParseException
0
     end
0
     if messages.length > 0
0
       message = messages.join("\n")

Comments

    No one has commented yet.