Almost initial commit

This commit is contained in:
VC
2023-11-07 17:14:49 +01:00
parent e8c2d35e21
commit 8c7e60881b
5 changed files with 444 additions and 38 deletions

11
src/utils.rs Normal file
View File

@@ -0,0 +1,11 @@
use megalodon::entities::status::Tag;
use std::error::Error;
use regex::Regex;
pub fn strip_mastodon_tags(content: &mut String, tags: &Vec<Tag>) -> Result<(), Box<dyn Error>> {
for tag in tags {
let re = Regex::new(&format!("(?i)(#{} ?)", &tag.name))?;
*content = re.replace(content, "").to_string();
}
Ok(())
}