diff options
| -rw-r--r-- | RELEASE_NOTES.md | 8 | ||||
| -rw-r--r-- | doc/snac.5 | 7 | ||||
| -rw-r--r-- | doc/snac.8 | 31 | ||||
| -rw-r--r-- | format.c | 22 | ||||
| -rw-r--r-- | html.c | 6 | ||||
| -rw-r--r-- | snac.h | 2 | ||||
| -rw-r--r-- | xs.h | 6 | ||||
| -rw-r--r-- | xs_version.h | 2 |
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 | |||
| 5 | Markdown-style links are now supported. | ||
| 6 | |||
| 7 | The avatar and/or the header images can now be deleted (contributed by louis77). | ||
| 8 | |||
| 9 | The webfinger content-type response header is now RFC-compliant (contributed by steve-bate). | ||
| 10 | |||
| 3 | ## 2.53 | 11 | ## 2.53 |
| 4 | 12 | ||
| 5 | New user feature to search by post content (using regular expressions) or tag. | 13 | New user feature to search by post content (using regular expressions) or tag. |
| @@ -38,7 +38,12 @@ int main(int argc, char *argv[]) | |||
| 38 | ``` | 38 | ``` |
| 39 | .Ed | 39 | .Ed |
| 40 | .It links | 40 | .It links |
| 41 | Standalone URLs. | 41 | Standalone URLs are converted to links. Also, from version 2.54, |
| 42 | markdown-style links in the form of [link label](url) are also | ||
| 43 | supported. | ||
| 44 | .It Line separators | ||
| 45 | Horizonal rules can be inserted by typing three minus symbols | ||
| 46 | alone in a line. | ||
| 42 | .It quoted text | 47 | .It quoted text |
| 43 | Lines starting with >. | 48 | Lines starting with >. |
| 44 | .It User Mentions | 49 | .It User Mentions |
| @@ -304,15 +304,25 @@ supports: | |||
| 304 | Complete support, on input and output. | 304 | Complete support, on input and output. |
| 305 | .It Vt Undo | 305 | .It Vt Undo |
| 306 | For | 306 | For |
| 307 | .Vt Follow | 307 | .Vt Follow , |
| 308 | .Vt Like | ||
| 309 | and | ||
| 310 | .Vt Announce | ||
| 308 | objects, on input and output. | 311 | objects, on input and output. |
| 309 | .It Vt Create | 312 | .It Vt Create |
| 310 | For | 313 | For |
| 311 | .Vt Note , | 314 | .Vt Note , |
| 312 | .Vt Question | 315 | .Vt Question , |
| 316 | .Vt Page , | ||
| 317 | .Vt Article , | ||
| 318 | .Vt Event | ||
| 313 | and | 319 | and |
| 314 | .Vt Page | 320 | .Vt Video |
| 315 | objects, on input and output. | 321 | objects on input, and for |
| 322 | .Vt Note | ||
| 323 | and | ||
| 324 | .Vt Question | ||
| 325 | on output. | ||
| 316 | .It Vt Accept | 326 | .It Vt Accept |
| 317 | For | 327 | For |
| 318 | .Vt Follow | 328 | .Vt Follow |
| @@ -327,11 +337,16 @@ For | |||
| 327 | objects, on input and output. | 337 | objects, on input and output. |
| 328 | .It Vt Update | 338 | .It Vt Update |
| 329 | For | 339 | For |
| 330 | .Vt Person , | 340 | .Vt Note , |
| 331 | .Vt Note | 341 | .Vt Question , |
| 342 | .Vt Page , | ||
| 343 | .Vt Article , | ||
| 344 | .Vt Event | ||
| 332 | and | 345 | and |
| 333 | .Vt Question | 346 | .Vt Video |
| 334 | objects, on input and output. | 347 | objects on input, and for |
| 348 | .Vt Note | ||
| 349 | on output. | ||
| 335 | .It Vt Delete | 350 | .It Vt Delete |
| 336 | Supported for | 351 | Supported for |
| 337 | .Vt Note | 352 | .Vt Note |
| @@ -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 |
| @@ -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", |
| @@ -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 | ||
| @@ -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) | |||
| 1286 | int xs_data_size(const xs_data *value) | 1286 | int 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 */ | ||