MMM: Fixed hashtag serialization

This commit is contained in:
Natty 2023-10-29 12:52:20 +01:00
parent 0755dac002
commit 7dc38ada9a
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 13 additions and 3 deletions

View File

@ -12,8 +12,8 @@ use redis::IntoConnectionInfo;
use sea_orm::sea_query::IntoIden;
use sea_orm::ActiveValue::Set;
use sea_orm::{
ColumnTrait, ConnectOptions, DatabaseConnection, DbErr, EntityTrait, JoinType, QueryFilter,
QueryOrder, RelationDef, RelationTrait, TransactionTrait,
ColumnTrait, ConnectOptions, DatabaseConnection, DbErr, EntityTrait, QueryFilter, QueryOrder,
RelationDef, RelationTrait, TransactionTrait,
};
use serde::{Deserialize, Serialize};
use std::future::Future;

View File

@ -414,7 +414,7 @@ impl Token {
Token::Hashtag(tag) => {
writer
.create_element("hashtag")
.with_attribute(("tag", tag.as_str()));
.write_text_content(BytesText::new(tag.as_str()))?;
}
}
@ -2325,6 +2325,16 @@ text</center>"#
r#"<mmm><mention name="natty" type="user"/> <fn name="spin" arg-speed="0.5s"><ue>🥺</ue></fn><ee>cat_attack</ee> test</mmm>"#
);
assert_eq!(
&to_xml_string(&parse_full(
"Ring Galaxy AM 0644 741 from Hubble\nCredits: AURA, STScI, J. Higdon, Cornell, ESA, #NASA\n#nature #space #astrophotography"
))
.unwrap(),
r#"<mmm>Ring Galaxy AM 0644 741 from Hubble
Credits: AURA, STScI, J. Higdon, Cornell, ESA, <hashtag>NASA</hashtag>
<hashtag>nature</hashtag> <hashtag>space</hashtag> <hashtag>astrophotography</hashtag></mmm>"#
);
assert_eq!(
&to_xml_string(&parse_full(
r#"