@@ -95,7 +95,7 @@ public String updateSummary() {
9595 text += lines .get (i ) + "\n " ;
9696
9797 mDB .executeUpdate ("UPDATE info SET summary = \" " + text + "\" " );
98- writeOverview (text );
98+ writeHTML (text );
9999 Out .PrtSpMsg (0 , "Complete overview" );
100100 }
101101 catch (Exception e ) {ErrorReport .die (e , "create/get summary" );}
@@ -632,26 +632,44 @@ private void makeProcessing() {
632632 catch (Exception e ) {ErrorReport .prtReport (e , "processing" );}
633633 }
634634
635- public void writeOverview (String text ) {
635+ // HTML CAS404 make html pass BBEdit test
636+ public void writeHTML (String text ) {
636637 String projDir = Globals .PROJECTDIR ;
637638 String sumDir = Globals .summaryPath ;
638639 String overFilePath = sumDir + "/" + dbName + ".html" ;
639640 try {
640641 if (!new File (projDir ).exists ()) return ; // should exist
641642
643+ String [] lines = text .split ("\n " );
644+ for (int i =0 ; i <lines .length ; i ++) {
645+ lines [i ] = lines [i ].replaceAll ("&" , "&" );
646+ lines [i ] = lines [i ].replaceAll (">" , ">" );
647+ lines [i ] = lines [i ].replaceAll ("<" , "<" );
648+ }
649+
642650 File h = new File (sumDir );
643651 if (!h .exists ()) {
644652 System .out .println ("Creating directory " + sumDir );
645653 h .mkdir ();
646654 }
647655 FileOutputStream out = new FileOutputStream (overFilePath );
648656 PrintWriter fileObj = new PrintWriter (out );
649- // CAS310 make centered table
650- String head = "<html><title>mTCW_" + dbName + " overview</title><body><center>"
651- + "\n <h2>mTCW overview for " + dbName + "</h2>"
652- + "\n <table width=600 border=1><tr><td><pre>" ;
653- String foot = "\n </pre></table></body></html>" ;
654- fileObj .println (head + text + foot );
657+
658+ Out .prtSp (1 , "Writing overview HTML file: " + overFilePath );
659+
660+ fileObj .println ("<!DOCTYPE html>" ); // CAS404 html5
661+ fileObj .println ("<html>" );
662+ fileObj .println ("<head><title>Overview mTCW_" + dbName + "</title></head>" );
663+ fileObj .println ("<body>" );
664+ fileObj .println ("<center>" );
665+ fileObj .println ("<h2>Overview for mTCW_" + dbName + " </h2>" );
666+ fileObj .println ("<table style=\" width: 800px; border: 2px solid #999999;\" ><tr><td>" );
667+ fileObj .println ("<pre>" );
668+ for (int i =0 ; i <lines .length ; i ++) fileObj .println (lines [i ]);
669+ fileObj .println ("</pre>" );
670+
671+ fileObj .println ("</table></center></body>" );
672+ fileObj .println ("</html>" );
655673 fileObj .close ();
656674 }
657675 catch (Exception e ){ErrorReport .prtReport (e , "Error writing to " + overFilePath );}
0 commit comments