From b4e26c879e405b41fac01bbd55df38c4ab932f62 Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Wed, 24 Feb 2010 12:10:41 -0300 Subject: 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. --- dpi/vsource.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'dpi/vsource.c') 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, - "\n\n"); + "\n
\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, - "
%d ", - (line & 1) ? "#B87333" : "#DD7F32", line); + "%s
%d%s
",
+                     (line > 1) ? "
" : "", + (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, "
"); + a_Dpip_dsh_printf(sh, 1, ""); } /* -- cgit v1.2.3