fix: mentions parser escapes, emoji parser escapes
This commit is contained in:
parent
78443cba13
commit
687766f5ee
3 changed files with 8 additions and 10 deletions
|
@ -25,10 +25,10 @@ pub(crate) type State = Arc<RwLock<(DataManager, Tera, Client)>>;
|
|||
|
||||
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
|
||||
Ok(
|
||||
CustomEmoji::replace(&tetratto_shared::markdown::render_markdown(
|
||||
value.as_str().unwrap(),
|
||||
))
|
||||
.into(),
|
||||
tetratto_shared::markdown::render_markdown(&CustomEmoji::replace(value.as_str().unwrap()))
|
||||
.replace("\\@", "@")
|
||||
.replace("%5C@", "@")
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -309,6 +309,7 @@ impl User {
|
|||
for char in input.chars() {
|
||||
if (char == '\\') && !escape {
|
||||
escape = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (char == '@') && !escape {
|
||||
|
|
|
@ -111,15 +111,10 @@ impl CustomEmoji {
|
|||
|
||||
let mut chars = input.chars();
|
||||
while let Some(char) = chars.next() {
|
||||
if escape == true {
|
||||
buffer.push(char);
|
||||
continue;
|
||||
}
|
||||
|
||||
if char == '\\' && escape == false {
|
||||
escape = true;
|
||||
continue;
|
||||
} else if char == ':' {
|
||||
} else if char == ':' && escape == false {
|
||||
let mut community_id: String = String::new();
|
||||
let mut accepting_community_id_chars: bool = true;
|
||||
let mut emoji_name: String = String::new();
|
||||
|
@ -164,6 +159,8 @@ impl CustomEmoji {
|
|||
} else if in_emoji {
|
||||
buffer.push(char);
|
||||
}
|
||||
|
||||
escape = false;
|
||||
}
|
||||
|
||||
out
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue