summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Eirik Oeverby2025-01-06 20:03:00 +0100
committerGravatar Eirik Oeverby2025-01-06 20:04:24 +0100
commit3b818f557ae3c1073f1464fe0a7319a0e025ba86 (patch)
treeb9c30f207dd1d094be956cb686396d767c409000
parentUpdated TODO. (diff)
downloadsnac2-3b818f557ae3c1073f1464fe0a7319a0e025ba86.tar.gz
snac2-3b818f557ae3c1073f1464fe0a7319a0e025ba86.tar.xz
snac2-3b818f557ae3c1073f1464fe0a7319a0e025ba86.zip
Add short_description_raw option
-rw-r--r--doc/snac.82
-rw-r--r--html.c30
-rw-r--r--utils.c1
3 files changed, 23 insertions, 10 deletions
diff --git a/doc/snac.8 b/doc/snac.8
index 3a4bfcf..db47ae5 100644
--- a/doc/snac.8
+++ b/doc/snac.8
@@ -205,6 +205,8 @@ The email address of the instance administrator (optional).
205The user name of the instance administrator (optional). 205The user name of the instance administrator (optional).
206.It Ic short_description 206.It Ic short_description
207A textual short description about the instance (optional). 207A textual short description about the instance (optional).
208.It Ic short_description_raw
209Whether to interpret short_descript as raw string or convert to HTML (optional)
208.It Ic fastcgi 210.It Ic fastcgi
209If set to true, 211If set to true,
210.Nm 212.Nm
diff --git a/html.c b/html.c
index e8803ab..b54556d 100644
--- a/html.c
+++ b/html.c
@@ -537,10 +537,11 @@ xs_html *html_instance_head(void)
537 537
538static xs_html *html_instance_body(void) 538static xs_html *html_instance_body(void)
539{ 539{
540 const char *host = xs_dict_get(srv_config, "host"); 540 const char *host = xs_dict_get(srv_config, "host");
541 const char *sdesc = xs_dict_get(srv_config, "short_description"); 541 const char *sdesc = xs_dict_get(srv_config, "short_description");
542 const char *email = xs_dict_get(srv_config, "admin_email"); 542 const char *sdescraw = xs_dict_get(srv_config, "short_description_raw");
543 const char *acct = xs_dict_get(srv_config, "admin_account"); 543 const char *email = xs_dict_get(srv_config, "admin_email");
544 const char *acct = xs_dict_get(srv_config, "admin_account");
544 545
545 xs *blurb = xs_replace(snac_blurb, "%host%", host); 546 xs *blurb = xs_replace(snac_blurb, "%host%", host);
546 547
@@ -553,12 +554,21 @@ static xs_html *html_instance_body(void)
553 dl = xs_html_tag("dl", NULL))); 554 dl = xs_html_tag("dl", NULL)));
554 555
555 if (sdesc && *sdesc) { 556 if (sdesc && *sdesc) {
556 xs_html_add(dl, 557 if (!xs_is_null(sdescraw) && xs_type(sdescraw) == XSTYPE_TRUE) {
557 xs_html_tag("di", 558 xs_html_add(dl,
558 xs_html_tag("dt", 559 xs_html_tag("di",
559 xs_html_text(L("Site description"))), 560 xs_html_tag("dt",
560 xs_html_tag("dd", 561 xs_html_text(L("Site description"))),
561 xs_html_text(sdesc)))); 562 xs_html_tag("dd",
563 xs_html_raw(sdesc))));
564 } else {
565 xs_html_add(dl,
566 xs_html_tag("di",
567 xs_html_tag("dt",
568 xs_html_text(L("Site description"))),
569 xs_html_tag("dd",
570 xs_html_text(sdesc))));
571 }
562 } 572 }
563 if (email && *email) { 573 if (email && *email) {
564 xs *mailto = xs_fmt("mailto:%s", email); 574 xs *mailto = xs_fmt("mailto:%s", email);
diff --git a/utils.c b/utils.c
index 0740d4d..0f97a2f 100644
--- a/utils.c
+++ b/utils.c
@@ -36,6 +36,7 @@ static const char *default_srv_config = "{"
36 "\"admin_account\": \"\"," 36 "\"admin_account\": \"\","
37 "\"title\": \"\"," 37 "\"title\": \"\","
38 "\"short_description\": \"\"," 38 "\"short_description\": \"\","
39 "\"short_description_raw\": false,"
39 "\"protocol\": \"https\"," 40 "\"protocol\": \"https\","
40 "\"fastcgi\": false" 41 "\"fastcgi\": false"
41 "}"; 42 "}";