1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

NNTP: Improve listing of articles for groups

It now uses ordered list with the message number as the list item
number. Only the message subject and from field are shown.
This commit is contained in:
Jonas Fonseca 2007-09-11 17:01:06 +02:00
parent 0b0222d64f
commit 8dbd38eded

View File

@ -373,7 +373,7 @@ add_nntp_html_start(struct string *html, struct connection *conn)
add_format_to_string(html, add_format_to_string(html,
"<h2>%s</h2>\n" "<h2>%s</h2>\n"
"<hr />\n" "<hr />\n"
"<dl>", "<ol>",
empty_string_or_(title)); empty_string_or_(title));
break; break;
@ -399,7 +399,7 @@ add_nntp_html_end(struct string *html, struct connection *conn)
case NNTP_TARGET_ARTICLE_RANGE: case NNTP_TARGET_ARTICLE_RANGE:
case NNTP_TARGET_GROUP: case NNTP_TARGET_GROUP:
case NNTP_TARGET_GROUPS: case NNTP_TARGET_GROUPS:
add_to_string(html, "</dl>"); add_to_string(html, "</ol>");
break; break;
case NNTP_TARGET_QUIT: case NNTP_TARGET_QUIT:
@ -426,16 +426,33 @@ add_nntp_html_line(struct string *html, struct connection *conn,
case NNTP_TARGET_GROUP: case NNTP_TARGET_GROUP:
case NNTP_TARGET_GROUPS: case NNTP_TARGET_GROUPS:
{ {
unsigned char *desc = strchr(line, '\t'); unsigned char *field = line;
if (desc) { line = strchr(line, '\t');
*desc++ = 0; if (!line)
} else { field = "";
desc = ""; else
*line++ = 0;
add_format_to_string(html, "<li value=\"%s\"><a href=\"%s/%s\">",
field, struri(conn->uri), field);
field = line;
line = strchr(line, '\t');
if (line)
*line++ = 0;
add_header_to_string(html, field);
add_to_string(html, "</a> ");
if (line) {
field = line;
line = strchr(line, '\t');
if (line)
*line++ = 0;
add_header_to_string(html, field);
} }
add_to_string(html, "</li>");
add_format_to_string(html, "<dt><a href=\"%s%s\">%s</a></dt><dd>%s</dd>\n",
struri(conn->uri), line, line, desc);
break; break;
} }
case NNTP_TARGET_QUIT: case NNTP_TARGET_QUIT: