summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-05-05 11:27:24 +0200
committerGravatar default2024-05-05 11:27:24 +0200
commitc31a4ae73e9759cebda2a9cf8a34b352dc246314 (patch)
tree2d1c2c0c59523c50d7814b583946165b580f6aa2
parentSearch by tag returns RSS if the appropriate header is defined. (diff)
downloadsnac2-c31a4ae73e9759cebda2a9cf8a34b352dc246314.tar.gz
snac2-c31a4ae73e9759cebda2a9cf8a34b352dc246314.tar.xz
snac2-c31a4ae73e9759cebda2a9cf8a34b352dc246314.zip
Minor RSS title beautifying.
-rw-r--r--html.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/html.c b/html.c
index fe070c1..ee5c2cd 100644
--- a/html.c
+++ b/html.c
@@ -3330,12 +3330,19 @@ xs_str *timeline_to_rss(snac *user, const xs_list *timeline, char *title, char *
3330 continue; 3330 continue;
3331 3331
3332 /* create a title with the first line of the content */ 3332 /* create a title with the first line of the content */
3333 xs *es_title = xs_replace(content, "<br>", "\n"); 3333 xs *title = xs_replace(content, "<br>", "\n");
3334 xs *title = xs_str_new(NULL); 3334 title = xs_regex_replace_i(title, "<[^>]+>", " ");
3335 title = xs_regex_replace_i(title, "&[^;]+;", " ");
3335 int i; 3336 int i;
3336 3337
3337 for (i = 0; es_title[i] && es_title[i] != '\n' && es_title[i] != '&' && i < 50; i++) 3338 for (i = 0; title[i] && title[i] != '\n' && i < 50; i++);
3338 title = xs_append_m(title, &es_title[i], 1); 3339
3340 if (title[i] != '\0') {
3341 title[i] = '\0';
3342 title = xs_str_cat(title, "...");
3343 }
3344
3345 title = xs_strip_i(title);
3339 3346
3340 xs_html_add(channel, 3347 xs_html_add(channel,
3341 xs_html_tag("item", 3348 xs_html_tag("item",