<% processed_pages = pages.select{|p| !p.exception} %>
<% if processed_pages.size > 0 %>
<% processed_pages.each do |page| %>
<%= page.url %>
<%= "#{page.errors.length} ERRORS" %>
<%= "#{page.warnings.length} WARNINGS" %>
<% page.errors.sort_by {|e| e.line.to_i}.each do |error| %>
ERROR
<%= CGI::escapeHTML(error.text.capitalize) %>
<% if error.line && error.col %>
LINE <%= error.line %>, COL <%= error.col %>
<% end %>
<% if error.source && error.source.strip.length > 0 %>
<%= error.source.strip %>
<% end %>
<% if error.explanation && error.explanation.strip.length > 0 %>
<%= error.explanation.strip %>
<% end %>
<% end %>
<% page.warnings.sort_by {|w| w.line.to_i}.each do |warning| %>
WARNING
<%= CGI::escapeHTML(warning.text.capitalize) %>
<% if warning.line && warning.col %>
LINE <%= warning.line %>, COL <%= warning.col %>
<% end %>
<% if warning.source && warning.source.strip.length > 0 %>
<%= warning.source.strip %>
<% end %>
<% if warning.explanation && warning.explanation.strip.length > 0 %>
<%= warning.explanation.strip %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if errors.length > 0 %>
<% errors.group_by {|e| e.text}.sort_by {|t, e| e.length}.reverse.each do |text, errors| %>
<%= errors.length %> <%= CGI::escapeHTML(text.capitalize) %>
<% if errors.first.explanation && errors.first.explanation.strip.length > 0 %>
<%= errors.first.explanation.strip %>
<% end %>
<% end %>
<% end %>
<% if warnings.length > 0 %>
<% warnings.group_by {|w| w.text}.sort_by {|t, w| w.length}.reverse.each do |text, warnings| %>
<%= warnings.length %> <%= CGI::escapeHTML(text.capitalize) %>
<% if warnings.first.explanation && warnings.first.explanation.strip.length > 0 %>
<%= warnings.first.explanation.strip %>
<% end %>
<% end %>
<% end %>