Add/handle <!--end-mx-reply--> at end of native reply fallbacks. Fixes #133
This commit is contained in:
@@ -92,7 +92,7 @@ async def _add_forward_header(source, text: str, html: Optional[str],
|
||||
text = "\n".join([f"> {line}" for line in text.split("\n")])
|
||||
text = f"Forwarded from {fwd_from_text}:\n{text}"
|
||||
html = (f"Forwarded message from {fwd_from_html}<br/>"
|
||||
f"<blockquote><forward>{html}</forward></blockquote>")
|
||||
f"<blockquote data-tg-forward>{html}</blockquote>")
|
||||
return text, html
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ async def _add_reply_header(source: u.User, text: str, html: str, evt: Message,
|
||||
|
||||
r_keyword = "In reply to" if not is_edit else "Edit to"
|
||||
r_msg_link = f"<a href='https://matrix.to/#/{msg.mx_room}/{msg.mxid}'>{r_keyword}</a>"
|
||||
html = (f"<blockquote data-mx-reply>{r_msg_link} {r_sender_link}\n{r_html_body}</blockquote>"
|
||||
html = (f"<blockquote data-mx-reply>{r_msg_link} {r_sender_link}\n{r_html_body}<!--end-mx-reply--></blockquote>"
|
||||
+ (html or escape(text)))
|
||||
|
||||
lines = r_text_body.strip().split("\n")
|
||||
|
||||
@@ -47,8 +47,7 @@ def trim_reply_fallback_text(text: str) -> str:
|
||||
|
||||
html_reply_fallback_regex = re.compile("^<blockquote data-mx-reply>"
|
||||
r"[\s\S]+?"
|
||||
"(</forward></blockquote>)?"
|
||||
"</blockquote>")
|
||||
"<!--end-mx-reply--></blockquote>")
|
||||
|
||||
|
||||
def trim_reply_fallback_html(html: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user