Move microsyntax parsers to mastodon_api::statuses::microsyntax module

This commit is contained in:
silverpill 2023-03-23 18:35:05 +00:00
parent ac6491d030
commit 5ba8b8d6ae
8 changed files with 12 additions and 9 deletions

View file

@ -6,15 +6,17 @@ use crate::database::{DatabaseClient, DatabaseError};
use crate::models::{ use crate::models::{
emojis::types::DbEmoji, emojis::types::DbEmoji,
posts::{ posts::{
emojis::find_emojis,
hashtags::{find_hashtags, replace_hashtags},
helpers::{add_related_posts, add_user_actions}, helpers::{add_related_posts, add_user_actions},
links::{replace_object_links, find_linked_posts},
mentions::{find_mentioned_profiles, replace_mentions},
types::Post, types::Post,
}, },
users::types::User, users::types::User,
}; };
use super::microsyntax::{
emojis::find_emojis,
hashtags::{find_hashtags, replace_hashtags},
links::{replace_object_links, find_linked_posts},
mentions::{find_mentioned_profiles, replace_mentions},
};
use super::types::Status; use super::types::Status;
pub struct PostContent { pub struct PostContent {

View file

@ -4,7 +4,7 @@ use regex::{Captures, Match, Regex};
use crate::activitypub::fetcher::helpers::get_post_by_object_id; use crate::activitypub::fetcher::helpers::get_post_by_object_id;
use crate::database::{DatabaseClient, DatabaseError}; use crate::database::{DatabaseClient, DatabaseError};
use super::types::{Post, Visibility}; use crate::models::posts::types::{Post, Visibility};
// MediaWiki-like syntax: [[url|text]] // MediaWiki-like syntax: [[url|text]]
const OBJECT_LINK_SEARCH_RE: &str = r"(?m)\[\[(?P<url>[^\s\|]+)(\|(?P<text>.+?))?\]\]"; const OBJECT_LINK_SEARCH_RE: &str = r"(?m)\[\[(?P<url>[^\s\|]+)(\|(?P<text>.+?))?\]\]";

View file

@ -0,0 +1,4 @@
pub mod emojis;
pub mod hashtags;
pub mod links;
pub mod mentions;

View file

@ -1,3 +1,4 @@
pub mod helpers; pub mod helpers;
mod microsyntax;
pub mod types; pub mod types;
pub mod views; pub mod views;

View file

@ -1,7 +1,3 @@
pub mod emojis;
pub mod hashtags;
pub mod helpers; pub mod helpers;
pub mod links;
pub mod mentions;
pub mod queries; pub mod queries;
pub mod types; pub mod types;