summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar Uko Kokņevičs2025-04-24 22:27:35 +0000
committerGravatar Uko Kokņevičs2025-05-23 21:27:03 +0000
commit14a4c9a5257f17dac6a2d099d46225e885aa2c6e (patch)
tree7daa698dfccf35c314357aec205a1e64bbfddcb0 /html.c
parentDon't remove image attachments from posts that have MRFs adding links to images (diff)
downloadpenes-snac2-14a4c9a5257f17dac6a2d099d46225e885aa2c6e.tar.gz
penes-snac2-14a4c9a5257f17dac6a2d099d46225e885aa2c6e.tar.xz
penes-snac2-14a4c9a5257f17dac6a2d099d46225e885aa2c6e.zip
Normalise CWs and summaries to fit more *oma usage rather than friendica
Diffstat (limited to 'html.c')
-rw-r--r--html.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/html.c b/html.c
index a1bb6e1..2b9b07b 100644
--- a/html.c
+++ b/html.c
@@ -2148,11 +2148,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2148 2148
2149 v = xs_dict_get(msg, "summary"); 2149 v = xs_dict_get(msg, "summary");
2150 2150
2151 /* is it sensitive? */ 2151 if (!xs_is_null(v) && *v) {
2152 if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) {
2153 if (xs_is_null(v) || *v == '\0')
2154 v = "...";
2155
2156 const char *cw = ""; 2152 const char *cw = "";
2157 2153
2158 if (user) { 2154 if (user) {
@@ -2162,23 +2158,16 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2162 cw = ""; 2158 cw = "";
2163 } 2159 }
2164 2160
2161 xs_html *summary_tag = xs_html_tag("summary", xs_html_text(v));
2162 if (xs_type(xs_dict_get(msg, "sensitive")) == XSTYPE_TRUE) {
2163 xs_html_add(summary_tag, xs_html_text(L(" [SENSITIVE CONTENT]")));
2164 }
2165
2165 snac_content = xs_html_tag("details", 2166 snac_content = xs_html_tag("details",
2166 xs_html_attr(cw, NULL), 2167 xs_html_attr(cw, NULL),
2167 xs_html_tag("summary", 2168 summary_tag);
2168 xs_html_text(v),
2169 xs_html_text(L(" [SENSITIVE CONTENT]"))));
2170 } 2169 }
2171 else { 2170 else {
2172 /* print the summary as a header (sites like e.g. Friendica can contain one) */
2173 if (!has_title && !xs_is_null(v) && *v) {
2174 xs_html_add(snac_content_wrap,
2175 xs_html_tag("h3",
2176 xs_html_attr("class", "snac-entry-title"),
2177 xs_html_text(v)));
2178
2179 has_title = 1;
2180 }
2181
2182 snac_content = xs_html_tag("div", NULL); 2171 snac_content = xs_html_tag("div", NULL);
2183 } 2172 }
2184 2173