Fix quotes in room subtitles

This commit is contained in:
miruka 2020-03-13 03:55:04 -04:00
parent 630e011cfd
commit 9d3e2dbfc4
2 changed files with 13 additions and 6 deletions

View File

@ -2,6 +2,7 @@
## Before release
- Atomic
- Catch server 5xx errors when sending message and retry
- Update README.md

View File

@ -120,7 +120,9 @@ class HTMLProcessor:
inline_quote_regex = re.compile(r"(^|⏎)(\s*>[^⏎\n]*)", re.MULTILINE)
quote_regex = re.compile(
r"(^|<p/?>|<br/?>|<h\d/?>)(\s*&gt;.*?)(</?p>|<br/?>|</?h\d>|$)",
r"(^|<span/?>|<p/?>|<br/?>|<h\d/?>)"
r"(\s*&gt;.*?)"
r"(<span/?>|</?p>|<br/?>|</?h\d>|$)",
re.MULTILINE,
)
@ -178,12 +180,16 @@ class HTMLProcessor:
return html
# Client-side modifications
if inline:
return self.inline_quote_regex.sub(
r'\1<span class="quote">\2</span>', html,
)
return self.quote_regex.sub(r'\1<span class="quote">\2</span>\3', html)
html = self.quote_regex.sub(r'\1<span class="quote">\2</span>\3', html)
if not inline:
return html
return self.inline_quote_regex.sub(
r'\1<span class="quote">\2</span>', html,
)
def sanitize_settings(