diff options
| author | grunfink <grunfink@noreply.codeberg.org> | 2025-02-05 09:17:02 +0000 |
|---|---|---|
| committer | grunfink <grunfink@noreply.codeberg.org> | 2025-02-05 09:17:02 +0000 |
| commit | 6b4b3317e3ba5fb6570c43a307383b43cd609eb1 (patch) | |
| tree | 793f15edf1695c4e9a5603b80e6fe647f62e19f2 /format.c | |
| parent | 1d37e33e405975ce740be89fc02968cc7ec09b0f (diff) | |
| parent | 52c45718208f076ba1e4a30d7d54655cb4dcc78c (diff) | |
Merge pull request 'Fix link detection. Fixes: #290' (#296) from inz/snac2:link-detect into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/296
Diffstat (limited to 'format.c')
| -rw-r--r-- | format.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -78,6 +78,8 @@ xs_dict *emojis(void) return d; } +/* Non-whitespace without trailing comma, period or closing paren */ +#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+" static xs_str *format_line(const char *line, xs_list **attach) /* formats a line */ @@ -96,8 +98,8 @@ static xs_str *format_line(const char *line, xs_list **attach) "__[^_]+__" "|" //anzu "!\\[[^]]+\\]\\([^\\)]+\\)" "|" "\\[[^]]+\\]\\([^\\)]+\\)" "|" - "[a-z]+:/" "/[^[:space:]]+" "|" - "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+" + "[a-z]+:/" "/" NOSPACE "|" + "(mailto|xmpp):[^@[:space:]]+@" NOSPACE ")"); int n = 0; |