Deleting content at the top of prettypatch emails destroys HTML formatting
[WebKit-https.git] / Websites / bugs.webkit.org / PrettyPatch / PrettyPatch.rb
index 4e43690d84e72247dfa198ba202a13d9cc3ec505..60cd762488aa83e0f8f03848899be81fc1d9883a 100644 (file)
@@ -16,7 +16,7 @@ public
         $last_prettify_file_count = -1
         $last_prettify_part_count = { "remove" => 0, "add" => 0, "shared" => 0, "binary" => 0, "extract-error" => 0 }
         string = normalize_line_ending(string)
-        str = HEADER + "\n"
+        str = "#{HEADER}<body>\n"
 
         # Just look at the first line to see if it is an SVN revision number as added
         # by webkit-patch for git checkouts.
@@ -24,7 +24,7 @@ public
         string.each_line do |line|
             match = /^Subversion\ Revision: (\d*)$/.match(line)
             unless match.nil?
-                str += "<span class='revision'>" + match[1] + "</span>\n"
+                str << "<span class='revision'>#{match[1]}</span>\n"
                 $svn_revision = match[1].to_i;
             end
             break
@@ -33,7 +33,8 @@ public
         fileDiffs = FileDiff.parse(string)
 
         $last_prettify_file_count = fileDiffs.length
-        str += fileDiffs.collect{ |diff| diff.to_html }.join
+        str << fileDiffs.collect{ |diff| diff.to_html }.join
+        str << "</body></html>"
     end
 
     def self.filename_from_diff_header(line)
@@ -128,6 +129,8 @@ private
 
 
     HEADER =<<EOF
+<html>
+<head>
 <style>
 :link, :visited {
     text-decoration: none;
@@ -483,6 +486,7 @@ div:focus {
 </style>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
 <script src="code-review.js?version=43"></script>
+</head>
 EOF
 
     def self.revisionOrDescription(string)