diff options
| author | 2023-06-16 15:11:18 +0000 | |
|---|---|---|
| committer | 2023-06-16 15:11:18 +0000 | |
| commit | 4b75b2a75fcd0b5e8d6de155ac38a70b29fc81fb (patch) | |
| tree | a647c10dbe126a007b4df38065f7c539fd8282cb | |
| parent | Bumped version. (diff) | |
| parent | added titles to images and emojis (diff) | |
| download | snac2-4b75b2a75fcd0b5e8d6de155ac38a70b29fc81fb.tar.gz snac2-4b75b2a75fcd0b5e8d6de155ac38a70b29fc81fb.tar.xz snac2-4b75b2a75fcd0b5e8d6de155ac38a70b29fc81fb.zip | |
Merge pull request 'added titles to images and emojis' (#54) from Haijo7/snac2:titles into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/54
| -rw-r--r-- | html.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -967,7 +967,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 967 | if (n && i) { | 967 | if (n && i) { |
| 968 | char *u = xs_dict_get(i, "url"); | 968 | char *u = xs_dict_get(i, "url"); |
| 969 | xs *img = xs_fmt("<img src=\"%s\" style=\"height: 1em\" " | 969 | xs *img = xs_fmt("<img src=\"%s\" style=\"height: 1em\" " |
| 970 | "loading=\"lazy\"/>", u); | 970 | "loading=\"lazy\" title=\"%s\"/>", u, n); |
| 971 | 971 | ||
| 972 | c = xs_replace_i(c, n, img); | 972 | c = xs_replace_i(c, n, img); |
| 973 | } | 973 | } |
| @@ -1073,9 +1073,11 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 1073 | char *name = xs_dict_get(v, "name"); | 1073 | char *name = xs_dict_get(v, "name"); |
| 1074 | 1074 | ||
| 1075 | if (url != NULL) { | 1075 | if (url != NULL) { |
| 1076 | if (xs_is_null(name)) | ||
| 1077 | name = ""; | ||
| 1076 | xs *s1 = xs_fmt( | 1078 | xs *s1 = xs_fmt( |
| 1077 | "<a href=\"%s\" target=\"_blank\"><img src=\"%s\" alt=\"%s\" loading=\"lazy\"/></a>\n", | 1079 | "<a href=\"%s\" target=\"_blank\"><img src=\"%s\" alt=\"%s\" title=\"%s\" loading=\"lazy\"/></a>\n", |
| 1078 | url, url, xs_is_null(name) ? "" : name); | 1080 | url, url, name, name); |
| 1079 | 1081 | ||
| 1080 | s = xs_str_cat(s, s1); | 1082 | s = xs_str_cat(s, s1); |
| 1081 | } | 1083 | } |