summaryrefslogtreecommitdiff
path: root/dpi/vsource.c
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-07-10 21:53:49 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-07-18 22:29:50 +0200
commit8f67d6e0cea4629ae2e1ca6962224aae0be15092 (patch)
tree54927afbab41fe5d874d214ea04632212264a5dd /dpi/vsource.c
parent748def5467674c0652f222830358211b2799839e (diff)
Improve line number style for HTML source
Make the background of line numbers appear as a single color and increase the contrast to improve readability. Also add a bit of space and a separator line between the numbers and the code itself.
Diffstat (limited to 'dpi/vsource.c')
-rw-r--r--dpi/vsource.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/dpi/vsource.c b/dpi/vsource.c
index 3446be63..58f89f96 100644
--- a/dpi/vsource.c
+++ b/dpi/vsource.c
@@ -120,12 +120,27 @@ void send_html_text(Dsh *sh, const char *url, int data_size)
"<html><head>\n"
"<title>Source for %s</title>\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"
+ " body {\n"
+ " white-space: pre-wrap;\n"
+ " font-family: monospace;\n"
+ " margin: 0;\n"
+ " width: 100%;\n"
+ " }\n"
+ " table { border:0 }\n"
+ " td.num {\n"
+ " padding-top: 1px;\n"
+ " padding-bottom: 1px;\n"
+ " padding-left: 0.5em;\n"
+ " padding-right: 0.5em;\n"
+ " text-align: right;\n"
+ " border-right: 1px solid #999999;\n"
+ " background-color: #c6c6c6;\n"
+ " }"
+ " td.src { padding-left:0.25em; }\n"
+ " a { color: black; text-decoration:none; }\n"
"</style>\n"
"</head>\n"
- "<body id=\"dillo_vs\">\n<table cellpadding='0'>\n", url);
+ "<body id=\"dillo_vs\">\n<table cellspacing='0' cellpadding='0'>\n", url);
while (bytes_read < data_size &&
(token = a_Dpip_dsh_read_token2(sh, 1, &token_size))) {
@@ -135,9 +150,8 @@ void send_html_text(Dsh *sh, const char *url, int data_size)
while (*p) {
if (line > old_line) {
snprintf(line_str, 128,
- "<tr><td class='%s' id='L%d'><a href='#L%d'>%d%s</a><td>",
- (line & 1) ? "r1" : "r2", line, line, line,
- (line == 1 || (line % 10) == 0) ? "&nbsp;" : "");
+ "<tr><td class='num' id='L%d'><a href='#L%d'>%d</a><td class='src'>",
+ line, line, line);
a_Dpip_dsh_write_str(sh, 0, line_str);
old_line = line;
}