diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2010-02-24 12:10:41 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2010-02-24 12:10:41 -0300 |
commit | b4e26c879e405b41fac01bbd55df38c4ab932f62 (patch) | |
tree | 71ea9f0acaae6c90d83391eb8de659fe29c98650 /dpi/vsource.c | |
parent | b3ebdb3213c020501fd8d3f47151fa5eb6fdb40b (diff) |
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.
Diffstat (limited to 'dpi/vsource.c')
-rw-r--r-- | dpi/vsource.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dpi/vsource.c b/dpi/vsource.c index f1d6384c..d00ae4dc 100644 --- a/dpi/vsource.c +++ b/dpi/vsource.c @@ -106,7 +106,7 @@ void send_html_text(Dsh *sh, int data_size) 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 @@ void send_html_text(Dsh *sh, int data_size) while (*p) { if (line > old_line) { snprintf(line_str, 128, - "<tr><td bgcolor='%s'>%d <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) ? " " : ""); 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, "<"); + a_Dpip_dsh_write_str(sh, 0, (*p == '<') ? "<" : "&"); } } else { a_Dpip_dsh_write_str(sh, 1, q); @@ -140,7 +140,7 @@ void send_html_text(Dsh *sh, int data_size) dFree(src_str); } - a_Dpip_dsh_printf(sh, 1, "</table></body></html>"); + a_Dpip_dsh_printf(sh, 1, "</pre></table></body></html>"); } /* |