mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-27 11:37:02 +00:00
fix tiktok user parsing
This commit is contained in:
@@ -70,7 +70,7 @@ fn replace_reddit_user(input: &str) -> Cow<str> {
|
||||
}
|
||||
|
||||
static TIKTOK_USER: Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(r"(tiktok(.com)?/@?([\w\-_]+))").expect("regex should compile")
|
||||
Regex::new(r"(tiktok(.com)?/@?([\w\.\-_]+))").expect("regex should compile")
|
||||
});
|
||||
|
||||
fn replace_tiktok_user(input: &str) -> Cow<str> {
|
||||
@@ -197,6 +197,12 @@ mod tests {
|
||||
"<p><a href=\"https://www.tiktok.com/@storyteller_ai\">tiktok/@storyteller_ai</a></p>\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn tiktok_user_with_dot() {
|
||||
assert_eq!(&markdown_with_socials_to_html("tiktok/@foo.bar"),
|
||||
"<p><a href=\"https://www.tiktok.com/@foo.bar\">tiktok/@foo.bar</a></p>\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn tiktok_dot_com() {
|
||||
assert_eq!(&markdown_with_socials_to_html("tiktok.com/@storyteller_ai"),
|
||||
@@ -219,6 +225,12 @@ mod tests {
|
||||
"<p><a href=\"https://www.tiktok.com/@storyteller_ai\">tiktok/storyteller_ai</a></p>\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn tiktok_user_with_dot() {
|
||||
assert_eq!(&markdown_with_socials_to_html("tiktok/foo.bar"),
|
||||
"<p><a href=\"https://www.tiktok.com/@foo.bar\">tiktok/foo.bar</a></p>\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn tiktok_dot_com() {
|
||||
assert_eq!(&markdown_with_socials_to_html("tiktok.com/storyteller_ai"),
|
||||
|
||||
Reference in New Issue
Block a user