diff options
| author | 2024-07-18 17:19:14 +0200 | |
|---|---|---|
| committer | 2024-07-18 17:19:14 +0200 | |
| commit | f3b392e06a72cc1461ab2c9587c96991a2731e9c (patch) | |
| tree | a14437db2e4b4563fc54ea9de579cc7f2ce8a156 | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-f3b392e06a72cc1461ab2c9587c96991a2731e9c.tar.gz snac2-f3b392e06a72cc1461ab2c9587c96991a2731e9c.tar.xz snac2-f3b392e06a72cc1461ab2c9587c96991a2731e9c.zip | |
Show bold+italic (text between ***) correctly.
| -rw-r--r-- | format.c | 12 | ||||
| -rw-r--r-- | html.c | 2 |
2 files changed, 10 insertions, 4 deletions
| @@ -88,9 +88,9 @@ static xs_str *format_line(const char *line, xs_list **attach) | |||
| 88 | /* split by markup */ | 88 | /* split by markup */ |
| 89 | xs *sm = xs_regex_split(line, | 89 | xs *sm = xs_regex_split(line, |
| 90 | "(" | 90 | "(" |
| 91 | "`[^`]+`" "|" | 91 | "`[^`]+`" "|" |
| 92 | "\\*\\*?[^\\*]+\\*?\\*" "|" | 92 | "\\*\\*?\\*?[^\\*]+\\*?\\*?\\*" "|" |
| 93 | "\\[[^]]+\\]\\([^\\)]+\\)" "|" | 93 | "\\[[^]]+\\]\\([^\\)]+\\)" "|" |
| 94 | "https?:/" "/[^[:space:]]+" | 94 | "https?:/" "/[^[:space:]]+" |
| 95 | ")"); | 95 | ")"); |
| 96 | int n = 0; | 96 | int n = 0; |
| @@ -106,6 +106,12 @@ static xs_str *format_line(const char *line, xs_list **attach) | |||
| 106 | s = xs_str_cat(s, s2); | 106 | s = xs_str_cat(s, s2); |
| 107 | } | 107 | } |
| 108 | else | 108 | else |
| 109 | if (xs_startswith(v, "***")) { | ||
| 110 | xs *s1 = xs_crop_i(xs_dup(v), 3, -3); | ||
| 111 | xs *s2 = xs_fmt("<b><i>%s</i></b>", s1); | ||
| 112 | s = xs_str_cat(s, s2); | ||
| 113 | } | ||
| 114 | else | ||
| 109 | if (xs_startswith(v, "**")) { | 115 | if (xs_startswith(v, "**")) { |
| 110 | xs *s1 = xs_crop_i(xs_dup(v), 2, -2); | 116 | xs *s1 = xs_crop_i(xs_dup(v), 2, -2); |
| 111 | xs *s2 = xs_fmt("<b>%s</b>", s1); | 117 | xs *s2 = xs_fmt("<b>%s</b>", s1); |
| @@ -2090,7 +2090,7 @@ xs_html *html_footer(void) | |||
| 2090 | xs_html_tag("a", | 2090 | xs_html_tag("a", |
| 2091 | xs_html_attr("href", WHAT_IS_SNAC_URL), | 2091 | xs_html_attr("href", WHAT_IS_SNAC_URL), |
| 2092 | xs_html_tag("abbr", | 2092 | xs_html_tag("abbr", |
| 2093 | xs_html_attr("title", "Social Network Are Crap"), | 2093 | xs_html_attr("title", "Social Networks Are Crap"), |
| 2094 | xs_html_text("snac")))); | 2094 | xs_html_text("snac")))); |
| 2095 | } | 2095 | } |
| 2096 | 2096 | ||