changeset 1578:31b53c47cf74

Fix: vsource html, fix entities display, indentation and removed \r check. Now long lines don't wrap (a side effect of PRE). If a wrapping version is preferred, it can be achieved by stuffing NBSP at the beginning of the line.
author Jorge Arellano Cid <jcid@dillo.org>
date Wed, 24 Feb 2010 12:10:41 -0300
parents 404899a37226
children 1d38bc37ae03
files dpi/vsource.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dpi/vsource.c	Tue Feb 23 15:03:10 2010 -0300
+++ b/dpi/vsource.c	Wed Feb 24 12:10:41 2010 -0300
@@ -106,7 +106,7 @@
 
    a_Dpip_dsh_printf(sh, 0, DOCTYPE);
    a_Dpip_dsh_printf(sh, 0, 
-                     "<html><body>\n<table width='100%%' cellpadding='0'>\n");
+                     "<html><body>\n<table cellpadding='0'>\n");
 
    while (bytes_read < data_size &&
           (src_str = a_Dpip_dsh_read_token(sh, 1))) {
@@ -116,20 +116,20 @@
       while (*p) {
          if (line > old_line) {
             snprintf(line_str, 128, 
-                     "<tr><td bgcolor='%s'>%d&nbsp;<td>",
-                     (line & 1) ? "#B87333" : "#DD7F32", line);
+                     "%s<tr><td bgcolor='%s'>%d%s<td><pre>",
+                     (line > 1) ? "</pre>" : "",
+                     (line & 1) ? "#B87333" : "#DD7F32", line,
+                     (line == 1 || (line % 10) == 0) ? "&nbsp;&nbsp;" : "");
             a_Dpip_dsh_write_str(sh, 0, line_str);
             old_line = line;
          }
-         if ((p = strpbrk(q, "\n<"))) {
+         if ((p = strpbrk(q, "\n<&"))) {
             if (*p == '\n') {
                a_Dpip_dsh_write(sh, 0, q, p - q + 1);
-               if (p[1] == '\r')
-                  ++p;
                ++line;
             } else {
                a_Dpip_dsh_write(sh, 0, q, p - q);
-               a_Dpip_dsh_write_str(sh, 0, "&lt;");
+               a_Dpip_dsh_write_str(sh, 0, (*p == '<') ? "&lt;" : "&amp;");
             }
          } else {
             a_Dpip_dsh_write_str(sh, 1, q);
@@ -140,7 +140,7 @@
       dFree(src_str);
    }
 
-   a_Dpip_dsh_printf(sh, 1, "</table></body></html>");
+   a_Dpip_dsh_printf(sh, 1, "</pre></table></body></html>");
 }
 
 /*