chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / html.c
index b1d6ce953da599b0b9d83e92ab2cf3609c5bfde6..cc10a58ffa061ed16fcb5a8f4f649d7d6fa27e6d 100644 (file)
@@ -10,6 +10,12 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.6  2008/02/20 23:42:05  staffcvs
+ * *** empty log message ***
+ *
+ * Revision 1.5  2008/02/20 23:31:48  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/20 22:54:22  staffcvs
  * *** empty log message ***
  *
@@ -89,8 +95,14 @@ html_render (FILE * f, CRT_CA c)
       if (c.attr & CRT_ATTR_BOLD)
         fg |= CRT_COLOR_INTENSITY;
     }
+#ifdef CSS
+  fprintf (f, "<span style='color: #%06x; background-color: #%06x'>",
+           colormap[fg], colormap[bg]);
+#else
   fprintf (f, "<td bgcolor='#%06x'><font color='#%06x'>", colormap[bg],
            colormap[fg]);
+  fprintf (f, "<tt>");
+#endif
 
   if (c.attr & CRT_ATTR_UNDERLINE)
     fprintf (f, "<ul>");
@@ -112,7 +124,12 @@ html_render (FILE * f, CRT_CA c)
     {
       fprintf (f, "</font>");
     }
+#ifdef CSS
+  fprintf (f, "</span>");
+#else
+  fprintf (f, "</tt>");
   fprintf (f, "</td>");
+#endif
 }
 
 static void
@@ -121,18 +138,32 @@ html_draw (FILE * f, CRT * c)
   CRT_Pos p;
   int o;
 
+#ifdef CSS
+  fprintf (f, "<pre>");
+#else
   fprintf (f, "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
+#endif
   for (p.y = 0; p.y < CRT_ROWS; ++p.y)
     {
       o = CRT_ADDR (p.y, 0);
+#ifndef CSS
       fprintf (f, "<tr>");
+#endif
       for (p.x = 0; p.x < CRT_COLS; ++p.x, ++o)
         {
           html_render (f, c->screen[o]);
         }
+#ifdef CSS
+      fprintf (f, "\n");
+#else
       fprintf (f, "</tr>\n");
+#endif
     }
-  fprintf (f, "</table>\n");
+#ifdef CSS
+  fprintf (f, "</pre>\n");
+#else
+  fprintf (f, "</table>");
+#endif
 }