commit 43812a3
Merge pull request 'Add short_description_raw option' (#266) from ltning/snac2:master into master Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/266
3 files changed,
+23,
-10
+2,
-0
1@@ -205,6 +205,8 @@ The email address of the instance administrator (optional).
2 The user name of the instance administrator (optional).
3 .It Ic short_description
4 A textual short description about the instance (optional).
5+.It Ic short_description_raw
6+Whether to interpret short_descript as raw string or convert to HTML (optional).
7 .It Ic fastcgi
8 If set to true,
9 .Nm
M
html.c
+20,
-10
1@@ -553,10 +553,11 @@ xs_html *html_instance_head(void)
2
3 static xs_html *html_instance_body(void)
4 {
5- const char *host = xs_dict_get(srv_config, "host");
6- const char *sdesc = xs_dict_get(srv_config, "short_description");
7- const char *email = xs_dict_get(srv_config, "admin_email");
8- const char *acct = xs_dict_get(srv_config, "admin_account");
9+ const char *host = xs_dict_get(srv_config, "host");
10+ const char *sdesc = xs_dict_get(srv_config, "short_description");
11+ const char *sdescraw = xs_dict_get(srv_config, "short_description_raw");
12+ const char *email = xs_dict_get(srv_config, "admin_email");
13+ const char *acct = xs_dict_get(srv_config, "admin_account");
14
15 xs *blurb = xs_replace(snac_blurb, "%host%", host);
16
17@@ -569,12 +570,21 @@ static xs_html *html_instance_body(void)
18 dl = xs_html_tag("dl", NULL)));
19
20 if (sdesc && *sdesc) {
21- xs_html_add(dl,
22- xs_html_tag("di",
23- xs_html_tag("dt",
24- xs_html_text(L("Site description"))),
25- xs_html_tag("dd",
26- xs_html_text(sdesc))));
27+ if (!xs_is_null(sdescraw) && xs_type(sdescraw) == XSTYPE_TRUE) {
28+ xs_html_add(dl,
29+ xs_html_tag("di",
30+ xs_html_tag("dt",
31+ xs_html_text(L("Site description"))),
32+ xs_html_tag("dd",
33+ xs_html_raw(sdesc))));
34+ } else {
35+ xs_html_add(dl,
36+ xs_html_tag("di",
37+ xs_html_tag("dt",
38+ xs_html_text(L("Site description"))),
39+ xs_html_tag("dd",
40+ xs_html_text(sdesc))));
41+ }
42 }
43 if (email && *email) {
44 xs *mailto = xs_fmt("mailto:%s", email);
M
utils.c
+1,
-0
1@@ -36,6 +36,7 @@ static const char *default_srv_config = "{"
2 "\"admin_account\": \"\","
3 "\"title\": \"\","
4 "\"short_description\": \"\","
5+ "\"short_description_raw\": false,"
6 "\"protocol\": \"https\","
7 "\"fastcgi\": false"
8 "}";