summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-02-05 09:17:02 +0000
committerGravatar grunfink2025-02-05 09:17:02 +0000
commit6b4b3317e3ba5fb6570c43a307383b43cd609eb1 (patch)
tree793f15edf1695c4e9a5603b80e6fe647f62e19f2 /format.c
parentAdded a 'Context' link to each notification. (diff)
parentFix link detection. Fixes: #290 (diff)
downloadpenes-snac2-6b4b3317e3ba5fb6570c43a307383b43cd609eb1.tar.gz
penes-snac2-6b4b3317e3ba5fb6570c43a307383b43cd609eb1.tar.xz
penes-snac2-6b4b3317e3ba5fb6570c43a307383b43cd609eb1.zip
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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/format.c b/format.c
index e5934b8..4c8ed29 100644
--- a/format.c
+++ b/format.c
@@ -78,6 +78,8 @@ xs_dict *emojis(void)
78 return d; 78 return d;
79} 79}
80 80
81/* Non-whitespace without trailing comma, period or closing paren */
82#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+"
81 83
82static xs_str *format_line(const char *line, xs_list **attach) 84static xs_str *format_line(const char *line, xs_list **attach)
83/* formats a line */ 85/* formats a line */
@@ -96,8 +98,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
96 "__[^_]+__" "|" //anzu 98 "__[^_]+__" "|" //anzu
97 "!\\[[^]]+\\]\\([^\\)]+\\)" "|" 99 "!\\[[^]]+\\]\\([^\\)]+\\)" "|"
98 "\\[[^]]+\\]\\([^\\)]+\\)" "|" 100 "\\[[^]]+\\]\\([^\\)]+\\)" "|"
99 "[a-z]+:/" "/[^[:space:]]+" "|" 101 "[a-z]+:/" "/" NOSPACE "|"
100 "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+" 102 "(mailto|xmpp):[^@[:space:]]+@" NOSPACE
101 ")"); 103 ")");
102 int n = 0; 104 int n = 0;
103 105