diff options
| author | 2023-11-29 15:02:29 +0100 | |
|---|---|---|
| committer | 2023-11-29 15:02:29 +0100 | |
| commit | d6b3333d4a7083612fd2508c53be7a0d07873689 (patch) | |
| tree | 2533cf0561c146a6d87278b2157248e90f421991 /html.c | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-d6b3333d4a7083612fd2508c53be7a0d07873689.tar.gz snac2-d6b3333d4a7083612fd2508c53be7a0d07873689.tar.xz snac2-d6b3333d4a7083612fd2508c53be7a0d07873689.zip | |
Use a configurable line height in replace_shortnames().
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -41,7 +41,7 @@ int login(snac *snac, const xs_dict *headers) | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | xs_str *replace_shortnames(xs_str *s, xs_list *tag) | 44 | xs_str *replace_shortnames(xs_str *s, xs_list *tag, int ems) |
| 45 | /* replaces all the :shortnames: with the emojis in tag */ | 45 | /* replaces all the :shortnames: with the emojis in tag */ |
| 46 | { | 46 | { |
| 47 | if (!xs_is_null(tag)) { | 47 | if (!xs_is_null(tag)) { |
| @@ -55,6 +55,8 @@ xs_str *replace_shortnames(xs_str *s, xs_list *tag) | |||
| 55 | tag_list = xs_dup(tag); | 55 | tag_list = xs_dup(tag); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | xs *style = xs_fmt("height: %dem; vertical-align: middle;", ems); | ||
| 59 | |||
| 58 | xs_list *p = tag_list; | 60 | xs_list *p = tag_list; |
| 59 | char *v; | 61 | char *v; |
| 60 | 62 | ||
| @@ -71,7 +73,7 @@ xs_str *replace_shortnames(xs_str *s, xs_list *tag) | |||
| 71 | xs_html_attr("loading", "lazy"), | 73 | xs_html_attr("loading", "lazy"), |
| 72 | xs_html_attr("src", u), | 74 | xs_html_attr("src", u), |
| 73 | xs_html_attr("title", n), | 75 | xs_html_attr("title", n), |
| 74 | xs_html_attr("style", "height: 1em; vertical-align: middle;")); | 76 | xs_html_attr("style", style)); |
| 75 | 77 | ||
| 76 | xs *s1 = xs_html_render(img); | 78 | xs *s1 = xs_html_render(img); |
| 77 | s = xs_replace_i(s, n, s1); | 79 | s = xs_replace_i(s, n, s1); |
| @@ -95,7 +97,7 @@ xs_str *actor_name(xs_dict *actor) | |||
| 95 | } | 97 | } |
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | return replace_shortnames(xs_html_encode(v), xs_dict_get(actor, "tag")); | 100 | return replace_shortnames(xs_html_encode(v), xs_dict_get(actor, "tag"), 1); |
| 99 | } | 101 | } |
| 100 | 102 | ||
| 101 | 103 | ||
| @@ -1422,7 +1424,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, | |||
| 1422 | } | 1424 | } |
| 1423 | 1425 | ||
| 1424 | /* replace the :shortnames: */ | 1426 | /* replace the :shortnames: */ |
| 1425 | c = replace_shortnames(c, xs_dict_get(msg, "tag")); | 1427 | c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2); |
| 1426 | 1428 | ||
| 1427 | /* c contains sanitized HTML */ | 1429 | /* c contains sanitized HTML */ |
| 1428 | xs_html_add(snac_content, | 1430 | xs_html_add(snac_content, |