summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md8
-rw-r--r--doc/snac.57
-rw-r--r--doc/snac.831
-rw-r--r--format.c22
-rw-r--r--html.c6
-rw-r--r--snac.h2
-rw-r--r--xs.h6
-rw-r--r--xs_version.h2
8 files changed, 66 insertions, 18 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index cea217a..7573246 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,13 @@
1# Release Notes 1# Release Notes
2 2
3## 2.54
4
5Markdown-style links are now supported.
6
7The avatar and/or the header images can now be deleted (contributed by louis77).
8
9The webfinger content-type response header is now RFC-compliant (contributed by steve-bate).
10
3## 2.53 11## 2.53
4 12
5New user feature to search by post content (using regular expressions) or tag. 13New user feature to search by post content (using regular expressions) or tag.
diff --git a/doc/snac.5 b/doc/snac.5
index c460c7b..42b257e 100644
--- a/doc/snac.5
+++ b/doc/snac.5
@@ -38,7 +38,12 @@ int main(int argc, char *argv[])
38``` 38```
39.Ed 39.Ed
40.It links 40.It links
41Standalone URLs. 41Standalone URLs are converted to links. Also, from version 2.54,
42markdown-style links in the form of [link label](url) are also
43supported.
44.It Line separators
45Horizonal rules can be inserted by typing three minus symbols
46alone in a line.
42.It quoted text 47.It quoted text
43Lines starting with >. 48Lines starting with >.
44.It User Mentions 49.It User Mentions
diff --git a/doc/snac.8 b/doc/snac.8
index 7c35aeb..389cd0e 100644
--- a/doc/snac.8
+++ b/doc/snac.8
@@ -304,15 +304,25 @@ supports:
304Complete support, on input and output. 304Complete support, on input and output.
305.It Vt Undo 305.It Vt Undo
306For 306For
307.Vt Follow 307.Vt Follow ,
308.Vt Like
309and
310.Vt Announce
308objects, on input and output. 311objects, on input and output.
309.It Vt Create 312.It Vt Create
310For 313For
311.Vt Note , 314.Vt Note ,
312.Vt Question 315.Vt Question ,
316.Vt Page ,
317.Vt Article ,
318.Vt Event
313and 319and
314.Vt Page 320.Vt Video
315objects, on input and output. 321objects on input, and for
322.Vt Note
323and
324.Vt Question
325on output.
316.It Vt Accept 326.It Vt Accept
317For 327For
318.Vt Follow 328.Vt Follow
@@ -327,11 +337,16 @@ For
327objects, on input and output. 337objects, on input and output.
328.It Vt Update 338.It Vt Update
329For 339For
330.Vt Person , 340.Vt Note ,
331.Vt Note 341.Vt Question ,
342.Vt Page ,
343.Vt Article ,
344.Vt Event
332and 345and
333.Vt Question 346.Vt Video
334objects, on input and output. 347objects on input, and for
348.Vt Note
349on output.
335.It Vt Delete 350.It Vt Delete
336Supported for 351Supported for
337.Vt Note 352.Vt Note
diff --git a/format.c b/format.c
index b021f55..1020ddd 100644
--- a/format.c
+++ b/format.c
@@ -87,7 +87,12 @@ static xs_str *format_line(const char *line, xs_list **attach)
87 87
88 /* split by markup */ 88 /* split by markup */
89 xs *sm = xs_regex_split(line, 89 xs *sm = xs_regex_split(line,
90 "(`[^`]+`|\\*\\*?[^\\*]+\\*?\\*|https?:/" "/[^[:space:]]+)"); 90 "("
91 "`[^`]+`" "|"
92 "\\*\\*?[^\\*]+\\*?\\*" "|"
93 "\\[[^]]+\\]\\([^\\)]+\\)" "|"
94 "https?:/" "/[^[:space:]]+"
95 ")");
91 int n = 0; 96 int n = 0;
92 97
93 p = sm; 98 p = sm;
@@ -136,6 +141,21 @@ static xs_str *format_line(const char *line, xs_list **attach)
136 } 141 }
137 } 142 }
138 else 143 else
144 if (*v == '[') {
145 /* markdown-like links [label](url) */
146 xs *w = xs_strip_chars_i(xs_dup(v), "[)");
147 xs *l = xs_split_n(w, "](", 1);
148
149 if (xs_list_len(l) == 2) {
150 xs *link = xs_fmt("<a href=\"%s\">%s</a>",
151 xs_list_get(l, 1), xs_list_get(l, 0));
152
153 s = xs_str_cat(s, link);
154 }
155 else
156 s = xs_str_cat(s, v);
157 }
158 else
139 s = xs_str_cat(s, v); 159 s = xs_str_cat(s, v);
140 } 160 }
141 else 161 else
diff --git a/html.c b/html.c
index 6267adf..bacee5b 100644
--- a/html.c
+++ b/html.c
@@ -1016,7 +1016,7 @@ xs_html *html_top_controls(snac *snac)
1016 xs_html_sctag("input", 1016 xs_html_sctag("input",
1017 xs_html_attr("type", "checkbox"), 1017 xs_html_attr("type", "checkbox"),
1018 xs_html_attr("name", "avatar_delete")), 1018 xs_html_attr("name", "avatar_delete")),
1019 xs_html_text(L("Delete current avatar"))), 1019 xs_html_text(L("Delete current avatar"))),
1020 xs_html_tag("p", 1020 xs_html_tag("p",
1021 xs_html_text(L("Header image (banner): ")), 1021 xs_html_text(L("Header image (banner): ")),
1022 xs_html_sctag("input", 1022 xs_html_sctag("input",
@@ -1026,8 +1026,8 @@ xs_html *html_top_controls(snac *snac)
1026 xs_html_sctag("input", 1026 xs_html_sctag("input",
1027 xs_html_attr("type", "checkbox"), 1027 xs_html_attr("type", "checkbox"),
1028 xs_html_attr("name", "header_delete")), 1028 xs_html_attr("name", "header_delete")),
1029 xs_html_text(L("Delete current header image"))), 1029 xs_html_text(L("Delete current header image"))),
1030 xs_html_tag("p", 1030 xs_html_tag("p",
1031 xs_html_text(L("Bio:")), 1031 xs_html_text(L("Bio:")),
1032 xs_html_sctag("br", NULL), 1032 xs_html_sctag("br", NULL),
1033 xs_html_tag("textarea", 1033 xs_html_tag("textarea",
diff --git a/snac.h b/snac.h
index 5c2f731..a821b18 100644
--- a/snac.h
+++ b/snac.h
@@ -1,7 +1,7 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */ 2/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */
3 3
4#define VERSION "2.53" 4#define VERSION "2.54-dev"
5 5
6#define USER_AGENT "snac/" VERSION 6#define USER_AGENT "snac/" VERSION
7 7
diff --git a/xs.h b/xs.h
index 972665c..56771e1 100644
--- a/xs.h
+++ b/xs.h
@@ -277,7 +277,7 @@ int _xs_get_size(const xs_val *ptr)
277/* must match _XS_TYPE_SIZE */ 277/* must match _XS_TYPE_SIZE */
278{ 278{
279 int i; 279 int i;
280 memcpy(&i, ptr, sizeof(i)); 280 memcpy(&i, ptr + 1, sizeof(i));
281 return i; 281 return i;
282} 282}
283 283
@@ -299,7 +299,7 @@ int xs_size(const xs_val *data)
299 case XSTYPE_LIST: 299 case XSTYPE_LIST:
300 case XSTYPE_DICT: 300 case XSTYPE_DICT:
301 case XSTYPE_DATA: 301 case XSTYPE_DATA:
302 len = _xs_get_size(data + 1); 302 len = _xs_get_size(data);
303 303
304 break; 304 break;
305 305
@@ -1286,7 +1286,7 @@ xs_data *xs_data_new(const void *data, int size)
1286int xs_data_size(const xs_data *value) 1286int xs_data_size(const xs_data *value)
1287/* returns the size of the data stored inside value */ 1287/* returns the size of the data stored inside value */
1288{ 1288{
1289 return _xs_get_size(value + 1) - (1 + _XS_TYPE_SIZE); 1289 return _xs_get_size(value) - (1 + _XS_TYPE_SIZE);
1290} 1290}
1291 1291
1292 1292
diff --git a/xs_version.h b/xs_version.h
index 7a7ba53..2e86334 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* 65769f25ed99b886a643522bef21628396cd118d 2024-05-25T08:18:51+02:00 */ /* e148ab08d5a55ac7bd30ff900f5eb048a57e21af 2024-05-27T05:33:01+02:00 */