summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authorGravatar violette2026-01-12 06:03:04 +0100
committerGravatar grunfink2026-01-12 06:03:04 +0100
commitde9d546d70cfcbf3b2450b70039470c9a68ecdc6 (patch)
treeaf3fcc8f82966420a59f0af9b5158d26d93bdb5a /format.c
parentUpdated documentation. (diff)
downloadsnac2-de9d546d70cfcbf3b2450b70039470c9a68ecdc6.tar.gz
snac2-de9d546d70cfcbf3b2450b70039470c9a68ecdc6.tar.xz
snac2-de9d546d70cfcbf3b2450b70039470c9a68ecdc6.zip
Added emoji categories.
Diffstat (limited to 'format.c')
-rw-r--r--format.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/format.c b/format.c
index 803e5a5..95c1b12 100644
--- a/format.c
+++ b/format.c
@@ -79,6 +79,24 @@ xs_dict *emojis(void)
79 return d; 79 return d;
80} 80}
81 81
82
83xs_dict *emojis_rm_categories() {
84 xs *emjs = emojis();
85 char *res = xs_dict_new();
86 const char *k, *v;
87 xs_dict_foreach(emjs, k, v) {
88 if (xs_type(v) == XSTYPE_DICT) {
89 const char *v2;
90 xs_dict_foreach(v, k, v2)
91 res = xs_dict_append(res, k, v2);
92 }
93 else
94 res = xs_dict_append(res, k, v);
95 }
96 return res;
97}
98
99
82/* Non-whitespace without trailing comma, period or closing paren */ 100/* Non-whitespace without trailing comma, period or closing paren */
83#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+" 101#define NOSPACE "([^[:space:],.)]+|[,.)]+[^[:space:],.)])+"
84 102
@@ -405,7 +423,7 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag
405 423
406 { 424 {
407 /* traditional emoticons */ 425 /* traditional emoticons */
408 xs *d = emojis(); 426 xs *d = emojis_rm_categories();
409 int c = 0; 427 int c = 0;
410 const char *k, *v; 428 const char *k, *v;
411 429