diff options
| author | 2023-11-29 09:49:48 +0100 | |
|---|---|---|
| committer | 2023-11-29 09:49:48 +0100 | |
| commit | a6da1fdb64f927943c39f664ff6a982a1f082b06 (patch) | |
| tree | b23447eec1ba596788e8b6f1b2a4f672e9a845af | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-a6da1fdb64f927943c39f664ff6a982a1f082b06.tar.gz snac2-a6da1fdb64f927943c39f664ff6a982a1f082b06.tar.xz snac2-a6da1fdb64f927943c39f664ff6a982a1f082b06.zip | |
History in html_timeline() uses xs_html.
| -rw-r--r-- | html.c | 32 |
1 files changed, 18 insertions, 14 deletions
| @@ -2124,28 +2124,32 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, | |||
| 2124 | s = xs_str_cat(s, "<!-- history disabled -->\n"); | 2124 | s = xs_str_cat(s, "<!-- history disabled -->\n"); |
| 2125 | } | 2125 | } |
| 2126 | else { | 2126 | else { |
| 2127 | xs *s1 = xs_fmt( | 2127 | xs_html *ul = xs_html_tag("ul", NULL); |
| 2128 | "<div class=\"snac-history\">\n" | ||
| 2129 | "<p class=\"snac-history-title\">%s</p><ul>\n", | ||
| 2130 | L("History") | ||
| 2131 | ); | ||
| 2132 | 2128 | ||
| 2133 | s = xs_str_cat(s, s1); | 2129 | xs_html *history = xs_html_tag("div", |
| 2130 | xs_html_attr("class", "snac-history"), | ||
| 2131 | xs_html_tag("p", | ||
| 2132 | xs_html_attr("class", "snac-history-title"), | ||
| 2133 | xs_html_text(L("History"))), | ||
| 2134 | ul); | ||
| 2134 | 2135 | ||
| 2135 | xs *list = history_list(user); | 2136 | xs *list = history_list(user); |
| 2136 | char *p, *v; | 2137 | xs_list *p = list; |
| 2138 | char *v; | ||
| 2137 | 2139 | ||
| 2138 | p = list; | ||
| 2139 | while (xs_list_iter(&p, &v)) { | 2140 | while (xs_list_iter(&p, &v)) { |
| 2140 | xs *fn = xs_replace(v, ".html", ""); | 2141 | xs *fn = xs_replace(v, ".html", ""); |
| 2141 | xs *s1 = xs_fmt( | 2142 | xs *url = xs_fmt("%s/h/%s", user->actor, v); |
| 2142 | "<li><a href=\"%s/h/%s\">%s</a></li>\n", | ||
| 2143 | user->actor, v, fn); | ||
| 2144 | 2143 | ||
| 2145 | s = xs_str_cat(s, s1); | 2144 | xs_html_add(ul, |
| 2145 | xs_html_tag("li", | ||
| 2146 | xs_html_tag("a", | ||
| 2147 | xs_html_attr("href", url), | ||
| 2148 | xs_html_text(fn)))); | ||
| 2146 | } | 2149 | } |
| 2147 | 2150 | ||
| 2148 | s = xs_str_cat(s, "</ul></div>\n"); | 2151 | xs *s1 = xs_html_render(history); |
| 2152 | s = xs_str_cat(s, s1); | ||
| 2149 | } | 2153 | } |
| 2150 | } | 2154 | } |
| 2151 | 2155 | ||