aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2015-05-27 11:07:04 -0300
committerJorge Arellano Cid <jcid@dillo.org>2015-05-27 11:07:04 -0300
commit468bea9977fabc5ca544bb3f668b74a97e20ae28 (patch)
treedb0f202b085e396300a9df56918ffbd94eb3891f
parent24cff71d47c8b5cd15129a53295a4a27b93f89c0 (diff)
Made view-source dpi use CSS formatting (it's shorter and cleaner)
BTW, is there a point in using a monospaced font? Besides it looks like code printing (which is good), a proportional-spaced font may be easier to read.
-rw-r--r--dpi/vsource.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/dpi/vsource.c b/dpi/vsource.c
index c28e7b49..9d5694b5 100644
--- a/dpi/vsource.c
+++ b/dpi/vsource.c
@@ -118,7 +118,10 @@ void send_html_text(Dsh *sh, const char *url, int data_size)
"\n"
"<html><head>\n"
"<title>Source for %s</title>\n"
- "<style type=\"text/css\">PRE {white-space: pre-wrap}\n"
+ "<style type=\"text/css\">\n"
+ " body {white-space: pre-wrap; font-family: monospace}\n"
+ " td.r1 {background-color:#B87333}\n"
+ " td.r2 {background-color:#DD7F32}\n"
"</style>\n"
"</head>\n"
"<body id=\"dillo_vs\">\n<table cellpadding='0'>\n", url);
@@ -131,10 +134,9 @@ void send_html_text(Dsh *sh, const char *url, int data_size)
while (*p) {
if (line > old_line) {
snprintf(line_str, 128,
- "%s<tr><td bgcolor='%s'>%d%s<td><pre>",
- (line > 1) ? "</pre>" : "",
- (line & 1) ? "#B87333" : "#DD7F32", line,
- (line == 1 || (line % 10) == 0) ? "&nbsp;&nbsp;" : "");
+ "<tr><td class='%s'>%d%s<td>",
+ (line & 1) ? "r1" : "r2", line,
+ (line == 1 || (line % 10) == 0) ? "&nbsp;" : "");
a_Dpip_dsh_write_str(sh, 0, line_str);
old_line = line;
}
@@ -158,8 +160,6 @@ void send_html_text(Dsh *sh, const char *url, int data_size)
dFree(token);
}
- if (data_size > 0)
- a_Dpip_dsh_write_str(sh, 0, "</pre>");
a_Dpip_dsh_write_str(sh, 1, "</table></body></html>");
}