summaryrefslogtreecommitdiff
path: root/src/general.rs
diff options
context:
space:
mode:
authorSavagePeanut <sourcehut@lazytapir.com>2023-09-03 15:43:06 -0500
committerSavagePeanut <sourcehut@lazytapir.com>2023-09-03 15:43:06 -0500
commit2028c5a6cff6f5b860b6419cbc1b27a1260dcd00 (patch)
tree6a0301485682e836516ba07cbeb712648b88ab27 /src/general.rs
parent651ab7c90f436de60035a138e91561b1848b5725 (diff)
count \s removed for telegram
Diffstat (limited to 'src/general.rs')
-rw-r--r--src/general.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/general.rs b/src/general.rs
index 517bf92..110a1c7 100644
--- a/src/general.rs
+++ b/src/general.rs
@@ -4,8 +4,6 @@ use pyo3::prelude::*;
use crate::parser::parse_with_limits;
-const PLACEHOLDER: &str = "\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}\u{200B}";
-
#[pyfunction]
pub fn format_body(body: String, new_tags: HashMap<String, (String, String)>) -> PyResult<String> {
let mut chars: Vec<char> = body.chars().collect();
@@ -28,7 +26,7 @@ pub fn format_body(body: String, new_tags: HashMap<String, (String, String)>) ->
};
tags.push((start, opening_tag, remove_start));
tags.push((end, new_tags.get(&keyword).unwrap().1.clone(), remove_end));
- } else if (keyword == ">>" && parse_quotes) || keyword == "```>" {
+ } else if (keyword == ">>" && parse_quotes) || keyword == "```>" || keyword == "\\" {
tags.push((start, "".to_string(), start+1));
}
}
@@ -45,11 +43,5 @@ pub fn format_body(body: String, new_tags: HashMap<String, (String, String)>) ->
chars.into_iter().collect::<String>()
};
- Ok(remove_non_escaped_backslashes(text))
-}
-
-fn remove_non_escaped_backslashes(text: String) -> String {
- let tmp_string = text.replace("\\\\", PLACEHOLDER);
- let tmp_string = tmp_string.replace("\\", "");
- tmp_string.replace(PLACEHOLDER, "\\")
+ Ok(text)
}