commit c9b8f8c

default  ·  2023-12-08 06:04:10 +0000 UTC
parent 8bdebf2
Show a note's summary as a header.
1 files changed,  +12, -2
M html.c
M html.c
+12, -2
 1@@ -1388,9 +1388,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
 2 
 3     xs_html *snac_content = NULL;
 4 
 5+    v = xs_dict_get(msg, "summary");
 6+
 7     /* is it sensitive? */
 8     if (user && xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) {
 9-        if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0')
10+        if (xs_is_null(v) || *v == '\0')
11             v = "...";
12 
13         /* only show it when not in the public timeline and the config setting is "open" */
14@@ -1404,8 +1406,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
15                 xs_html_text(v),
16                 xs_html_text(L(" [SENSITIVE CONTENT]"))));
17     }
18-    else
19+    else {
20+        /* print the summary as a header (sites like e.g. Friendica can contain one) */
21+        if (!xs_is_null(v) && *v)
22+            xs_html_add(snac_content_wrap,
23+                xs_html_tag("h3",
24+                    xs_html_attr("class", "snac-entry-title"),
25+                    xs_html_text(v)));
26+
27         snac_content = xs_html_tag("div", NULL);
28+    }
29 
30     xs_html_add(snac_content_wrap,
31         snac_content);