mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
More RSS tweaks.
This commit is contained in:
parent
3d6654143e
commit
ecff88922f
1 changed files with 5 additions and 14 deletions
19
html.c
19
html.c
|
@ -1129,8 +1129,8 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
xs *content = sanitize(xs_dict_get(msg, "content"));
|
xs *content = sanitize(xs_dict_get(msg, "content"));
|
||||||
xs *title = xs_dup(content);
|
xs *title = xs_str_new(NULL);
|
||||||
int i = -1;
|
int i;
|
||||||
|
|
||||||
/* add the post link */
|
/* add the post link */
|
||||||
xs *l = xs_fmt("<p><a href=\"%s\">%s</a><p>", id, id);
|
xs *l = xs_fmt("<p><a href=\"%s\">%s</a><p>", id, id);
|
||||||
|
@ -1140,21 +1140,12 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
|
||||||
content = xs_replace_i(content, "<", "<");
|
content = xs_replace_i(content, "<", "<");
|
||||||
content = xs_replace_i(content, ">", ">");
|
content = xs_replace_i(content, ">", ">");
|
||||||
|
|
||||||
if (strlen(title) > 40)
|
for (i = 0; content[i] && content[i] != '<' && content[i] != '&' && i < 40; i++)
|
||||||
title = xs_crop(title, 0, i = 40);
|
title = xs_append_m(title, &content[i], 1);
|
||||||
|
|
||||||
if ((v = strchr(title, '<')))
|
|
||||||
title = xs_crop(title, 0, i = (v - title));
|
|
||||||
|
|
||||||
if ((v = strchr(title, '&')))
|
|
||||||
title = xs_crop(title, 0, i = (v - title));
|
|
||||||
|
|
||||||
if (i != -1)
|
|
||||||
title = xs_str_cat(xs_strip(title), "...");
|
|
||||||
|
|
||||||
xs *s = xs_fmt(
|
xs *s = xs_fmt(
|
||||||
"<item>\n"
|
"<item>\n"
|
||||||
"<title>%s</title>\n"
|
"<title>%s...</title>\n"
|
||||||
"<link>%s</link>\n"
|
"<link>%s</link>\n"
|
||||||
"<description>%s</description>\n"
|
"<description>%s</description>\n"
|
||||||
"</item>\n",
|
"</item>\n",
|
||||||
|
|
Loading…
Reference in a new issue