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,9 +25,9 @@ pub(crate) type State = Arc<RwLock<(DataManager, Tera, Client)>>;
|
||||||
|
|
||||||
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
|
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
|
||||||
Ok(
|
Ok(
|
||||||
CustomEmoji::replace(&tetratto_shared::markdown::render_markdown(
|
tetratto_shared::markdown::render_markdown(&CustomEmoji::replace(value.as_str().unwrap()))
|
||||||
value.as_str().unwrap(),
|
.replace("\\@", "@")
|
||||||
))
|
.replace("%5C@", "@")
|
||||||
.into(),
|
.into(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,6 +309,7 @@ impl User {
|
||||||
for char in input.chars() {
|
for char in input.chars() {
|
||||||
if (char == '\\') && !escape {
|
if (char == '\\') && !escape {
|
||||||
escape = true;
|
escape = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (char == '@') && !escape {
|
if (char == '@') && !escape {
|
||||||
|
|
|
@ -111,15 +111,10 @@ impl CustomEmoji {
|
||||||
|
|
||||||
let mut chars = input.chars();
|
let mut chars = input.chars();
|
||||||
while let Some(char) = chars.next() {
|
while let Some(char) = chars.next() {
|
||||||
if escape == true {
|
|
||||||
buffer.push(char);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if char == '\\' && escape == false {
|
if char == '\\' && escape == false {
|
||||||
escape = true;
|
escape = true;
|
||||||
continue;
|
continue;
|
||||||
} else if char == ':' {
|
} else if char == ':' && escape == false {
|
||||||
let mut community_id: String = String::new();
|
let mut community_id: String = String::new();
|
||||||
let mut accepting_community_id_chars: bool = true;
|
let mut accepting_community_id_chars: bool = true;
|
||||||
let mut emoji_name: String = String::new();
|
let mut emoji_name: String = String::new();
|
||||||
|
@ -164,6 +159,8 @@ impl CustomEmoji {
|
||||||
} else if in_emoji {
|
} else if in_emoji {
|
||||||
buffer.push(char);
|
buffer.push(char);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
escape = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out
|
out
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue