mirror of
https://framagit.org/veretcle/oolatoocs.git
synced 2025-07-21 04:51:17 +02:00
Almost initial commit
This commit is contained in:
11
src/utils.rs
Normal file
11
src/utils.rs
Normal 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(())
|
||||
}
|
Reference in New Issue
Block a user