fix formatting of item descriptions

This commit is contained in:
2023-06-02 19:37:04 +02:00
parent d58ddadacd
commit 32ee617038
+5 -5
View File
@@ -32,17 +32,17 @@ fn validity_time_to_timestamp(input: &str) -> anyhow::Result<i64> {
} }
fn html_to_discord_markdown(input: &str) -> String { fn html_to_discord_markdown(input: &str) -> String {
let re_times = regex!(r#"^.*<br/><br/>"#i); let re_times = regex!(r#"^.*<br\s*/>\s*<br\s*/>"#i);
let re_bold = regex!(r#"<b\s*>((.|\n)*?)</b\s*>"#i);
let re_italic = regex!(r#"<i\s*>((.|\n)*?)</i\s*>"#i);
let re_strikethrough = regex!(r#"<s\s*>((.|\n)*?)</s\s*>"#i);
let re_newline = regex!(r#"<br\s*/?>"#i); let re_newline = regex!(r#"<br\s*/?>"#i);
let re_bold = regex!(r#"<b>(.*?)</b>"#i);
let re_italic = regex!(r#"<i>(.*?)</i>"#i);
let re_strikethrough = regex!(r#"<s>(.*?)</s>"#i);
let input = re_times.replace(input, ""); let input = re_times.replace(input, "");
let input = re_newline.replace_all(&input, "\n");
let input = re_bold.replace_all(&input, "**$1**"); let input = re_bold.replace_all(&input, "**$1**");
let input = re_italic.replace_all(&input, "*$1*"); let input = re_italic.replace_all(&input, "*$1*");
let input = re_strikethrough.replace_all(&input, "~~$1~~"); let input = re_strikethrough.replace_all(&input, "~~$1~~");
let input = re_newline.replace_all(&input, "\n");
input.to_string() input.to_string()
} }